APT-CACHE – 5个基础命令
1 : 列出所有有效包名
$ apt-cache pkgnames
esseract-ocr-epo pipenightdreams ...
apt-cache pkgnames |grep ext3 查找关键字ext3的包名 (精确到包名) == apt-cache pkgnames ext3
2 : 根据包名或详细查找软件
$ apt-cache search vsftpd
vsftpd - lightweight, efficient FTP server written for security ccze - A robust, modular log coloriser yasat - simple stupid audit tool...
3 : 查看包详细信息
apt-cache show netcat
Package: netcat Priority: optional Section: universe/net ...
4 : 查看包依赖
apt-cache showpkg vsftpd
Package: vsftpd Versions: 2.3.5-3ubuntu1 (/var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_binary-i386_Packages) ...
5 : 查看统计信息
apt-cache stats
Total package names: 51868 (1,037 k) Total package structures: 51868 (2,490 k)...
APT-GET – 20个基础命令
1 : 更新系统包
sudo apt-get update
[sudo] password for tecmint: Ign http://security.ubuntu.com quantal-security InRelease Get:1 http://security.ubuntu.com quantal-security Release.gpg [933 B] ...
2 : 升级软件包
sudo apt-get upgrade
Reading package lists... Done Building dependency tree Reading state information... Done ...
然而,如果你想升级,不关心是否软件包将被添加或删除满足依赖关系,使用“系统升级”子命令。
sudo apt-get dist-upgrade
3 : 安装或升级的具体的包
sudo apt-get install netcat
Reading package lists... Done Building dependency tree Reading state information... Done
4 : 同时安装多个软件包
sudo apt-get install nethogs goaccess
Reading package lists... Done Building dependency tree Reading state information... Done
5 : 安装包时使用通配符
sudo apt-get install '*name*'
Wildcard Matches
* 零个或者更多字符
? 恰好一个字符
[abcde] 恰好列举中的一个字符
[a-e] 恰好在所给范围中的一个字符
[!abcde] 任何字符都不在列举中
[!a-e] 任何字符都不在所给的范围中
{debian,linux} 恰好在所给选项中的一整个单词
6 : 安装包时不升级
sudo apt-get install packageName --no-upgrade
Reading package lists... Done Building dependency tree Reading state information... Done Skipping vsftpd, it is already installed and upgrade is not set. 0 upgraded, 0 newly installed, 0 to remove and 328 not upgraded.
7 : 更新特定包
sudo apt-get install packageName --only-upgrade
Reading package lists... Done Building dependency tree Reading state information... Done vsftpd is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 328 not upgraded.
8 : 安装特定版本包(使用=)
sudo apt-get install vsftpd=2.3.5-3ubuntu1
Reading package lists... Done Building dependency tree Reading state information... Done vsftpd is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 328 not upgraded.
9 : 删除包(不删除配置文件)
sudo apt-get remove vsftpd
[sudo] password for tecmint: Reading package lists... Done Building dependency tree
10 : 完全删除包(删除配置文件)
sudo apt-get purge vsftpd
Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED:
或者 同时使用
sudo apt-get remove --purge vsftpd
11 : 释放空间,清除下载包
sudo apt-get clean
12 : 下载只有源代码的包
sudo apt-get --download-only source vsftpd
Reading package lists... Done Building dependency tree Reading state information... Done
13 : 下载并解压源代码包
sudo apt-get source vsftpd
Reading package lists... Done Building dependency tree Reading state information... Done Need to get 220 kB of source archives.
14 : 下载 解压 编译包
sudo apt-get --compile source goaccess
[sudo] password for tecmint: Reading package lists... Done Building dependency tree
15 : 下载 不安装包
sudo apt-get download nethogs
Get:1 Downloading nethogs 0.8.0-1 [27.1 kB] Fetched 27.1 kB in 3s (7,506 B/s)
16 : 查看包更新日志
sudo apt-get changelog vsftpd
vsftpd (2.3.5-3ubuntu1) quantal; urgency=low * Merge from Debian testing (LP: #1003644). Remaining changes: + debian/vsftpd.upstart: migrate vsftpd to upstart. + Add apport hook (LP: #513978):
17 : 检查破损的依赖关系
sudo apt-get check
[sudo] password for tecmint: Reading package lists... Done Building dependency tree
18 : 搜索 建立依赖关系
sudo apt-get build-dep netcat
The following NEW packages will be installed: debhelper dh-apparmor html2text po-debconf quilt 0 upgraded, 5 newly installed, 0 to remove and 328 not upgraded. Need to get 1,219 kB of archives.
19 : 自动清楚apt-get缓存
sudo apt-get autoclean
Reading package lists... Done Building dependency tree Reading state information... Done
20 : 自动删除安装包
sudo apt-get autoremove vsftpd
Reading package lists... Done Building dependency tree Reading state information... Done