Contents[Hide]

1. dpkg -l


List all installed packages.

EXAMPLES:

dpkg returns a number of installed packages:

$ dpkg -l | wc -l
1209

ask dpkg to return only packages related to php. This will include installed and non-installed packages:

$ dpkg -l *php*

Using dpkg with grep to see only installed packages

dpkg -l | grep php

2. dpkg -L <package>

dpkg -L will show whether the package is installed. If the package is installed dpkg will show related files and their locations whithin the filesystem.

EXAMPLES:

$ dpkg -L ntpdate
/.
/etc
/etc/network
/etc/network/if-up.d
/etc/network/if-up.d/ntpdate
/etc/logcheck
...

$ dpkg -L php5-json
Package `php5-json' is not installed.

3. dpkg -p <package>

dpkg -p will display an full information regarding to a package name provaded as an argument. The information will nclude but not limited to version, dependecies, sugested packages and more.

EXAMPLE:


$ dpkg -p dpkg
Package: dpkg
Essential: yes
Priority: required
Section: admin
Installed-Size: 7276
Origin: debian
Maintainer: Dpkg Developers <>
Bugs: debbugs://bugs.debian.org
Architecture: i386
Version: 1.14.28
Replaces: manpages-de (<= 0.4-3), manpages-pl (<= 20051117-1)
Pre-Depends: libc6 (>= 2.7-1), coreutils (>= 5.93-1), lzma
Suggests: apt
Conflicts: apt (<< 0.7.7), aptitude (<< 0.4.7-1), dpkg-dev (<< 1.14.16), dpkg-iasearch (<< 0.11), sysvinit (<< 2.82-1)
Size: 2353726
Description: Debian package management system
This package provides the low-level infrastructure for handling the
installation and removal of Debian software packages.
.
For Debian package development tools, install dpkg-dev.
Homepage: http://wiki.debian.org/Teams/Dpkg

4. dpkg -s <package>

dpkg -s will a status of the package suplied as an argument. This is similar to dpkg -p but also inlcudes a status and config files:

EXAMPLE:

$ dpkg -s dpkg
Package: dpkg
Essential: yes
Status: install ok installed
Priority: required
Section: admin
Installed-Size: 7276
Origin: debian
Maintainer: Dpkg Developers <>
Bugs: debbugs://bugs.debian.org
Architecture: i386
Version: 1.14.28
Replaces: manpages-de (<= 0.4-3), manpages-pl (<= 20051117-1)
Pre-Depends: libc6 (>= 2.7-1), coreutils (>= 5.93-1), lzma
Suggests: apt
Conflicts: apt (<< 0.7.7), aptitude (<< 0.4.7-1), dpkg-dev (<< 1.14.16), dpkg-iasearch (<< 0.11), sysvinit (<< 2.82-1)
Conffiles:
/etc/logrotate.d/dpkg 501f8c90b83c7ea180868ca82e1e82d1
/etc/dpkg/origins/debian 731423fa8ba067262f8ef37882d1e742
/etc/dpkg/dpkg.cfg f4413ffb515f8f753624ae3bb365b81b
/etc/alternatives/README 69c4ba7f08363e998e0f2e244a04f881
Description: Debian package management system
This package provides the low-level infrastructure for handling the
installation and removal of Debian software packages.
.
For Debian package development tools, install dpkg-dev.
Homepage: http://wiki.debian.org/Teams/Dpkg

5. dpkg -S <keyword>


this dpkg command will search and display filenames related to an installed package.

EXAMPLES:

$ dpkg -S dpkg.cfg
dpkg: /usr/share/man/hu/man5/dpkg.cfg.5.gz
dpkg: /usr/share/man/pl/man5/dpkg.cfg.5.gz
dpkg: /usr/share/man/sv/man5/dpkg.cfg.5.gz
dpkg: /etc/dpkg/dpkg.cfg
dpkg: /usr/share/man/fr/man5/dpkg.cfg.5.gz
dpkg: /usr/share/man/man5/dpkg.cfg.5.gz
dpkg: /usr/share/man/de/man5/dpkg.cfg.5.gz

$ dpkg -S ports.conf

apache2.2-common: /etc/apache2/ports.conf

6. dpkg -i <package>

-i option will tell dpkg to installe a package.deb. To run this command a superuser/root privilegies are required.

EXAMPLE:

# dpkg -i skype-debian_2.1.0.81-1_i386.deb

this command will install a package which is not part of the debian standard repositories. Synce dpkpg will not install a required prerequisites, dpkg may display an error that prerequisites for this package are not met.

7. dpkg -r <package>


dpkg will remove installed package but not its configurations. Root privilegies are required to execute this command.

EXAMPLE:


# dpkg -r apache2

this command will remove apache2 form system.

8. dpkg -P <package>


with -P option the dpkg command will remove and purge any configuration files related to the package.

EXAMPLE:

# dpkg -P apache2

This command will remove apache2 package from the system including its configuration files. Root permitions required.

9. dpkg-reconfigure <package>

dpkg-reconfigure is commadn of its own but related to the dpkg family and it is also worth to mention it here. dpkg-reconfigure will reconfigure alredy installed package in the system.

EXAMPLE:
# dpkg-reconfigure xserver-xorg

this command will reconfigure a xserver-xorg package. Root privilegies are required to execute this command.

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top