Linux使用技巧9--用dpkg管理你的软件

dpkg(package manager for Debian): debian体系中的包管理工具。

Commands:
  -i|--install       <.deb file name> ... | -R|--recursive <directory> ...
-r|--remove        <package> ... | -a|--pending

1.查看已经安装的软件

$ 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.8.6-0ubuntu9.1     amd64                Messaging account plugin for AIM
ii  ack-grep                        2.12-1               all                  grep-like program specifically for large source trees

2.安装deb格式的软件

有时候会下载deb的软件,如virtualbox,那么我们就可以这样安装:

$ sudo dpkg -i virtualbox-4.3_4.3.26-98988~Ubuntu~raring_amd64.deb 
Selecting previously unselected package virtualbox-4.3.
(Reading database ... 237712 files and directories currently installed.)
Preparing to unpack virtualbox-4.3_4.3.26-98988~Ubuntu~raring_amd64.deb ...
Unpacking virtualbox-4.3 (4.3.26-98988~Ubuntu~raring) ...
Setting up virtualbox-4.3 (4.3.26-98988~Ubuntu~raring) ...
Adding group `vboxusers‘ (GID 127) ...
Done.

3.查看deb的信息

-I参数,查看详细信息

$ dpkg -I virtualbox-4.3_4.3.26-98988~Ubuntu~raring_amd64.deb 
 new debian package, version 2.0.
 size 64750912 bytes: control archive=23332 bytes.
     118 bytes,     4 lines      conffiles            
    1371 bytes,    20 lines      control              
   58951 bytes,   641 lines      md5sums              
   14579 bytes,   365 lines   *  postinst             #!/bin/sh
    2144 bytes,    59 lines   *  postrm               #!/bin/sh
    3335 bytes,    98 lines   *  preinst              #!/bin/bash
    3100 bytes,   100 lines   *  prerm                #!/bin/sh
    4666 bytes,   107 lines      templates            
 Package: virtualbox-4.3
 Version: 4.3.26-98988~Ubuntu~raring
 Architecture: amd64
 Maintainer: Oracle Corporation <[email protected]>
 Installed-Size: 147848

-c,查看包中的文件结构

$ dpkg -c virtualbox-4.3_4.3.26-98988~Ubuntu~raring_amd64.deb 
drwxr-xr-x root/root         0 2015-03-17 02:12 ./
drwxr-xr-x root/root         0 2015-03-17 02:12 ./etc/
drwxr-xr-x root/root         0 2015-03-17 02:12 ./etc/init.d/
-rwxr-xr-x root/root      6796 2015-03-17 02:12 ./etc/init.d/vboxautostart-service
-rwxr-xr-x root/root     12680 2015-03-17 02:12 ./etc/init.d/vboxdrv

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。