Apt-* 命令
啊哈, 终于到了Debian系列啦~
apt-cache search 搜索软件包
➤ apt-cache search ^apache2$
apache2 - Apache HTTP Server
这个例子搜索了apache2这个软件, 可以看到, 支持正则表达式哦~
dpkg -l列出当前安装的软件包
其实也不仅列出了安装的软件包, 还列出了曾经安装过, 现在没有完全卸载的软件包, 前面有几个标识符, 比如i
,r
:
apache2 - Apache HTTP Server
➤ dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================================-=======================-=======================-=============================================================================
ii account-plugin-aim 3.12.10-0ubuntu2 amd64 Messaging account plugin for AIM
ii account-plugin-facebook 0.12+15.10.20150723-0ub all GNOME Control Center account plugin for single signon - facebook
ii account-plugin-flickr 0.12+15.10.20150723-0ub all GNOME Control Center account plugin for single signon - flickr
ii account-plugin-google 0.12+15.10.20150723-0ub all GNOME Control Center account plugin for single signon
ii account-plugin-jabber 3.12.10-0ubuntu2 amd64 Messaging account plugin for Jabber/XMPP
ii account-plugin-salut 3.12.10-0ubuntu2 amd64 Messaging account plugin for Local XMPP (Salut)
ii account-plugin-yahoo 3.12.10-0ubuntu2 amd64 Messaging account plugin for Yahoo!
ii accountsservice 0.6.40-2ubuntu5 amd64 query and manipulate user account information
ii acct 6.5.5-2.1ubuntu1 amd64 The GNU Accounting utilities for process and login accounting
ii ack-grep 2.14-4 all grep-like program specifically for large source trees
ii acl 2.2.52-2 amd64 Access control list utilities
ii acpi-support 0.142 amd64 scripts for handling many ACPI events
...
...
...
可以看到, 乱七八糟一大堆…
这个命令也能安装软件.dpkg -i packge_name.deb
apt-get install 安装软件
也很简单啊, 只要把你需要安装的软件告诉他, 然后他就会按照依赖关系把需要的包一个一个都给装好:
$ sudo apt-get install apache2
[sudo] password for ramesh:
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils
apache2.2-common libapr1 libaprutil1 libpq5
0 upgraded, 7 newly installed, 0 to remove and 26 not upgraded.
apt-get remove 卸载软件
$ sudo apt-get purge apache2
(or)
$ sudo apt-get remove apache2
两者都可以卸载, 区别是什么? 第一个是彻底卸载, 包括各种配置文件,可以理解为apt-get remove apache2*
第二个只是移除二进制文件, 单纯的把apache2卸载.
除此之外, 还有apt-get update
, apt-get upgrade
, apt-get dist-upgrade
等一系列命令… 想知道他们都是什么吗? 自己去搜吧 :)
相当的easy~