Debian Admin - Your way to Debian World

November 23, 2006

Debian/Ubuntu Package management Using dpkg

by @ 8:56 pm. Filed under Package Mgmt

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Dpkg is the Debian package manager dpkg is a medium-level tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg is dselect.dpkg itself is controlled entirely via command line parameters,which consist of exactly one action and zero or more options. The action-parameter tells dpkg what to do and options control the behavior of the action in some way.

Now we will see all the available commands for dpkg with examples

1)Install a package

Syntax

dpkg -i <.deb file name>

Example

dpkg -i avg71flm_r28-1_i386.deb

2)Install all packages recursively from a directory

Syntax

dpkg -R

Example

dpkg -R /usr/local/src

3)Unpack the package, but don’t configure it.

Syntax

dpkg --unpack package_file

If you use -R option is specified, package_file must refer to a directory instead.

Example

dpkg --unpack avg71flm_r28-1_i386.deb

4)Reconfigure an unpacked package

Syntax

dpkg --configure package

If -a is given instead of package, all unpacked but uncon-figured packages are configured.

Example

dpkg --configure avg71flm_r28-1_i386.deb

5)Remove an installed package except configuration files

Syntax

dpkg -r

Example

dpkg -r avg71flm_r28-1_i386.deb

6)Remove an installed package including configuration files

Syntax

dpkg -P

If you use -a is given instead of a package name, then all packages unpacked, but marked to be removed or purged in file /var/lib/dpkg/status, are removed or purged, respectively.

Example

dpkg -P avg71flm

7)Replace available packages info

Syntax

dpkg --update-avail <Packages-file>

With this option old information is replaced with the information in the Packages-file.

8)Merge with info from file

Syntax

dpkg --merge-avail <Packages-file>

With this option old informa-tion is combined with information from Packages-file.

The Packages-file distributed with Debian is simply named Packages.dpkg keeps its record of available packages in /var/lib/dpkg/available.

9)Update dpkg and dselect’s idea of which packages are available with information from the package pack-age_file.

Syntax

dpkg -A package_file

10)Forget about uninstalled unavailable packages.

Syntax

dpkg --forget-old-unavail

11)Erase the existing information about what packages are available.

Syntax

dpkg --clear-avail

12)Searches for packages that have been installed only partially on your system.

Syntax

dpkg -C

13)Compare Package versions version numbers

Syntax

dpkg --compare-versions ver1 op ver2

14)Display a brief help message.

Syntax

dpkg --help

15)Display dpkg licence.

Syntax

dpkg --licence (or) dpkg --license

16)Display dpkg version information.

Syntax

dpkg --version

17)Build a deb package.

Syntax

dpkg -b directory [filename]

18)List contents of a deb package.

Syntax

dpkg -c filename

19)Show information about a package.

Syntax

dpkg -I filename [control-file]

20)List packages matching given pattern.

Syntax

dpkg -l package-name-pattern

Example

dpkg -l vim

21)List all installed packages, along with package version and short description

Syntax

dpkg -l

22)Report status of specified package.

Syntax

dpkg -s package-name

Example

dpkg -s ssh

23)List files installed to your system from package.

Syntax

dpkg -L package-Name

Example

dpkg -L apache2

24)Search for a filename from installed packages.

Syntax

dpkg -S filename-search-pattern

Example

dpkg -S /sbin/ifconfig

25)Display details about package

Syntax

dpkg -p package-name

Example

dpkg -p cacti

If you want more information about dpkg and available options check dpkg man page

If you are looking for GUI for dpkg check dselect

Tags: , , , , , , ,

You may also be interested in...

5 Responses to “Debian/Ubuntu Package management Using dpkg”

  1. chip Says:

    OK, how do I find out when a package was installed on my machine? Or if I want to sort my packages by install date?
    Thanks,
    Chip

  2. Jaap Says:

    Please refer to aptitude i.s.o. dselect as being the text-based tool on top of dpkg.

  3. mek Says:

    dpkg-query
    should do it -l|–list lists all Packages in ur /var/lib/dpkg/list, but purged

  4. saf Says:

    This is great. Thanks. :)

  5. Aston Says:

    Is it possible to upgrade installed package with something like dpkg upgrade ? (without apt-get)

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.