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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

以上是关于Linux使用技巧9--用dpkg管理你的软件的主要内容,如果未能解决你的问题,请参考以下文章

Linux 软件安装之apt+dpkg工具

RPM 与 DPKG 简介

RPM 与 DPKG 简介

RPM 与 DPKG 简介

Linux软件包管理

dpkg软件包管理