Linux Commands Examples

A great documentation place for Linux commands


package manager for Debian

see also : dpkg-deb - dpkg-query - dpkg-reconfigure


dpkg [option...] action

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


dpkg --build carex

To list installed packages related to the editor vi(1) (note that dpkg-query does not load the available file anymore by default, and the dpkg-query --load-avail option should be used instead for that):
dpkg -l '*vi*'

To see the entries in /var/lib/dpkg/available of two packages:
dpkg --print-avail elvis vim | less

To search the listing of packages yourself:
less /var/lib/dpkg/available

To remove an installed elvis package:
dpkg -r elvis

To install a package, you first need to find it in an archive or CDROM. The "available" file shows that the vim package is in section "editors":
cd /media/cdrom/pool/main/v/vim
dpkg -i vim_4.5-3.deb

To make a local copy of the package selection states:
dpkg --get-selections >myselections

You might transfer this file to another computer, and install it there with:
dpkg --clear-selections
dpkg --set-selections <myselections

Note that this will not actually install or remove anything, but just set the selection state on the requested packages. You will need some other application to actually download and install the requested packages. For example, run apt-get dselect-upgrade.

Ordinarily, you will find that dselect(1) provides a more convenient way to modify the package selection states.

sudo dpkg --configure -a

Install deb packages in another directory (or equivalent)

You can use --root to install packages into another directory, but you can't use most programs from there as most programs look for some files in fixed places (like /etc). The option is there for cases like installing packages into a NFS root for diskless clients.

Maybe you could use something like UnionFS to merge the two file systems.


How to fix"error while loading shared libraries:"

It's probably because some linked libraries got broken when you uninstalled several package at once. You should have run dpkg -l |grep ^rc|awk '{print $2}' before hand to know what will happen. Luckily this can be solved using sudo ldconfig. This recreates the linked libraries cache and will (hopefully) fix your libraries.

Of course, that will only works if you really have the /usr/lib/ library installed:

ls -l /usr/lib/x86_64-linux-gnu/
lrwxrwxrwx 1 root root 15 sep 18 14:03 /usr/lib/x86_64-linux-gnu/ ->
dpkg -S
libgl1-mesa-glx:i386: /usr/lib/i386-linux-gnu/mesa/
libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/
libgl1-mesa-glx:i386: /usr/lib/i386-linux-gnu/mesa/
libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/

(mine is 64bits that's why the difference.)


How to prevent Ubuntu/Debian users from accessing apt-get or downloading from the web, etc?

I'd say your best bet is to remove the binaries that you don't want your root user to use (wget, apt-get, etc).

However this can break some system fuctionnalities because some applications assume you have a functionnal wget, dpkg, etc. And, well, as long as it's root, and even with no internet connection, he can insert a cd and recopy the binaries...


How do I install a package and its depencies with dpkg?

You don't need parameters, just install the dependencies or use a package manager like apt-get.


dpkg: error processing /var/cache/apt/archives/python2.6-minimal_2.6.6-5ubuntu1_i386.deb (--unpack)

The error message complains that /usr/lib/python2.6/site-packages is a directory but should be a symbolic link. The most likely explanation is that you have some packages installed that do not conform with the current python packaging policy (where extra packages go into /usr/lib/python2.6/dist-packages), but instead put files in /usr/lib/python2.6/site-packages.

Run dpkg -S /usr/lib/python2.6/site-packages to see what packages you have that don't conform with the current policy. The error message incites you to report a bug against these packages.

The easy solution is to remove the offending packages.

Another possibility is that you've installed things in /usr/lib/python2.6/dist-packages without going through the deb package manager. In this case, move these things to /usr/local/lib/python2.6/dist-packages. Generally speaking, you should not install or change anything in /usr except by going through dpkg or higher-level programs that call it (apt-get, aptitude, Synaptic, ...). The exception is /usr/local, where you can do anything you like. If dpkg -S /usr/lib/python2.6/site-packages tells you that no package has installed any file under that directory, you can simply move the directory to where it should be:

mv /usr/lib/python2.6/site-packages /usr/local/lib/python2.6/dist-packages

or if the target directory already exists:

mv -i /usr/lib/python2.6/site-packages/* /usr/local/lib/python2.6/dist-packages/
rmdir /usr/lib/python2.6/site-packages

If you have old-policy packages that you want to keep installed, I think you can use the following workaround:

mkdir -p /usr/local/lib/python2.6/dist-packages
mv -i /usr/lib/python2.6/site-packages/* /usr/local/lib/python2.6/dist-packages
rmdir /usr/lib/python2.6/site-packages
ln -s /usr/local/lib/python2.6/dist-packages /usr/lib/python2.6/site-packages

If the mv commands complains that some targets already exists, this needs to be resolved on a case-by-case basis.

If you do use the workaround, be prepared for considerable confusion if you install non-deb python packages in /usr/local, as /usr/local/lib/python2.6/dist-packages will contain some files managed by dpkg. Also I'm not completely sure that this won't cause any package management trouble down the line, such as errors if you later upgrade or remove the offending packages. Attempt the workaround only if you're prepared to have to do more troubleshooting later. Again, the safe option is to remove the offending packages before upgrading your python package.


Ubuntu dpkg error , after crash and filesystem error recovery

That sounds like the binary cache of the package management system might be corrupted; you can try removing /var/cache/apt/pkgcache.bin to fix this (if this file doesn't exist, apt will re-create it automaticly).


Is it safe to remove /usr/share/locale if 'locales' package is removed

I just removed the directory on a test-box here(tm), and didn't notice any issues. Reinstalling locales will re-create the directory.


How can I fix broken apt/perl libraries?

Try to reinstall the package containing That package is "perl-base". Try

apt-get --reinstall install perl-base

If this also fails, you can try to reinstall the package file (perl-base_5.14....deb). You can download it from the mirror manually or it might even still be cached from the last upgrade in /var/cache/apt/archives. Install it by

dpkg -i perl-base_5.14..whatever..deb

Oh and just a note: You can find out yourself which package a file belongs to:

$ dpkg -S
perl-base: /usr/lib/
perl-base: /usr/lib/


E: Internal Error, Could not perform immediate configuration (2) on util-linux

Maybe you could apt-get clean or apt-get autoclean, command is something like that to clear what you have cached, and then update and upgrade again


Linux, Debian, Wheezy, Aptitude/DPKG consistency check

You can see almost1 all the files of an installed package by running

dpkg -L thatpackage

Or this same information is available on — you pick a package in the required distribution, then on that package's page navigate the "list of files" link in a table row matching your hardware architecture.

Another package which might be of interest for you is debsums which is able to compare the files belonging to a package or a set of packages, as found on the filesystem, with their MD5 hash sums as recorded in the metadata of the packages. The intended usage is detection of tampering with the system files, but might be used in your case as well, I think.

1 Some packages create certain files and directories dynamically, and unfortunately this is not declarative: they do so using plain shell scripting in the so-called postinst and postrm scripts, which are called by the package manager when certain events happen in the package's lifetime. For instance, a package might generate its configuration file using ucf from a privately-kept template using the information obtained from the user during the package configuration phase, and install the generated file somewhere under the /etc hierarchy.

These "plumbing" scripts belonging to a package are kept under the /var/lib/dpkg/info hierarchy and have names matching the packagename.* pattern. By the way, the lists of the files installed by a package and the list of configuration files maintained by the package are kept under the same hierarchy in the files named like packagename.list and packagename.conffiles. This is an implementation detail (better use dpkg -L or similar devices) but still…


udev affects behavior of script, prevents dpkg from working

Not sure about the rest of it but the reason you are getting empty files is that you have a syntax error in your script:


/usr/local/sbin/ ${1} & > /tmp/updater.out`

should be (you should also capture STDERR):


/usr/local/sbin/ ${1} > /tmp/updater.out 2>/tmp/updater.error &

The way you have it, the script is put in the background before any output is generated and you get empty files. Also, I assume the ` at the end of the line is a typo right?

As for the rest, what user is this being run as? I don't know enough about udev to guess. Does whoever the script is run as have the rights to execute dpkg?


where does pkg-info takes its information from?

I don't use a distro that uses pkginfo, but as far as i know there is a pkginfo file that is part of the package. The file will contain all info about the packages, including installation info.


man 4 pkginfo

in the terminal :D


What do the outputs of dpkg -l mean?

The dpkg -l command is basically summarizing the file /var/lib/dpkg/status. If you go look at that file you will see that it contains all the package control files, and a Status: line for each package.

The first column is an abbreviation of the Status: lines, ii means the package supposed to be installed, and is installed. Basically it tells you both the current state, and the state dpkg should be changing the package too.

The third, and fourth columns come directly from the package control file. The version, is the Version: value in the control file. The describe, is the first line of the Description:. Longer descriptions may be truncated depending on your terminal width.

# apt-cache show wamerican 
Package: wamerican
Version: 6-3
Description: American English dictionary words for /usr/share/dict
 ... yadda, yadda, ...


E: Sub-process /usr/bin/dpkg returned an error code (1)

I do not think your question can be answered with the information provided, because we do not know, why the processing failed. This should have been printed on the screen while processing the packages.

In case the errors are due to non-existing or corrupted archives, you can try to clear the archives with aptitude cleanor apt-get clean.

edit: with the additional info, the problem becomes much clearer. Obviously there is something wrong between dpkg-deb (a program, which is part of the debian package management used by apt-get) and tar (which is packing/unpacking files from/into single archives).

Now the dpkg-deb is calling tar with an unsopported option, so somehow there is a version mismatch between those programs.

Possible solutions for the problem can be found by searching for the error message, eg.


dpkg is a tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg is aptitude(1). 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.

dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.


All options can be specified both on the command line and in the dpkg configuration file /etc/dpkg/dpkg.cfg or fragment files (with names matching this shell pattern '[0-9a-zA-Z_-]*') on the configuration directory /etc/dpkg/dpkg.cfg.d/. Each line in the configuration file is either an option (exactly the same as the command line option but without leading dashes) or a comment (if it starts with a #).

Change after how many errors dpkg will abort. The default is 50.

-B, --auto-deconfigure

When a package is removed, there is a possibility that another installed package depended on the removed package. Specifying this option will cause automatic deconfiguration of the package which depended on the removed package.

-Doctal, --debug=octal

Switch debugging on. octal is formed by bitwise-orring desired values together from the list below (note that these values may change in future releases). -Dh or --debug=help display these debugging values.

Number Description
1 Generally helpful progress information
2 Invocation and status of maintainer scripts
10 Output for each file processed
100 Lots of output for each file processed
20 Output for each configuration file
200 Lots of output for each configuration file
40 Dependencies and conflicts
400 Lots of dependencies/conflicts output
10000 Trigger activation and processing
20000 Lots of output regarding triggers
40000 Silly amounts of output regarding triggers
1000 Lots of drivel about e.g. the dpkg/info dir
2000 Insane amounts of drivel

--force-things, --no-force-things, --refuse-things

Force or refuse (no-force and refuse mean the same thing) to do some things. things is a comma separated list of things specified below. --force-help displays a message describing them. Things marked with (*) are forced by default.

Warning: These options are mostly intended to be used by experts only. Using them without fully understanding their effects may break your whole system.

all: Turns on (or off) all force options.

downgrade(*): Install a package, even if newer version of it is already installed.

Warning: At present dpkg does not do any dependency checking on downgrades and therefore will not warn you if the downgrade breaks the dependency of some other package. This can have serious side effects, downgrading essential system components can even make your whole system unusable. Use with care.

configure-any: Configure also any unpacked but unconfigured packages on which the current package depends.

hold: Process packages even when marked "hold".

remove-reinstreq: Remove a package, even if it’s broken and marked to require reinstallation. This may, for example, cause parts of the package to remain on the system, which will then be forgotten by dpkg.

remove-essential: Remove, even if the package is considered essential. Essential packages contain mostly very basic Unix commands. Removing them might cause the whole system to stop working, so use with caution.

depends: Turn all dependency problems into warnings.

depends-version: Don’t care about versions when checking dependencies.

breaks: Install, even if this would break another package.

conflicts: Install, even if it conflicts with another package. This is dangerous, for it will usually cause overwriting of some files.

confmiss: If a conffile is missing and the version in the package did change, always install the missing conffile without prompting. This is dangerous, since it means not preserving a change (removing) made to the file.

confnew: If a conffile has been modified and the version in the package did change, always install the new version without prompting, unless the --force-confdef is also specified, in which case the default action is preferred.

confold: If a conffile has been modified and the version in the package did change, always keep the old version without prompting, unless the --force-confdef is also specified, in which case the default action is preferred.

confdef: If a conffile has been modified and the version in the package did change, always choose the default action without prompting. If there is no default action it will stop to ask the user unless --force-confnew or --force-confold is also been given, in which case it will use that to decide the final action.

confask: If a conffile has been modified always offer to replace it with the version in the package, even if the version in the package did not change. If any of --force-confmiss, --force-confnew, --force-confold, or --force-confdef is also given, it will be used to decide the final action.

overwrite: Overwrite one package’s file with another’s file.

overwrite-dir Overwrite one package’s directory with another’s file.

overwrite-diverted: Overwrite a diverted file with an undiverted version.

unsafe-io: Do not perform safe I/O operations when unpacking. Currently this implies not performing file system syncs before file renames, which is known to cause substantial performance degradation on some file systems, unfortunately the ones that require the safe I/O on the first place due to their unreliable behaviour causing zero-length files on abrupt system crashes.

Note: For ext4, the main offender, consider using instead the mount option nodelalloc, which will fix both the performance degradation and the data safety issues, the latter by making the file system not produce zero-length files on abrupt system crashes with any software not doing syncs before atomic renames.

Warning: Using this option might improve performance at the cost of losing data, use with care.

architecture: Process even packages with wrong or no architecture.

bad-version: Process even packages with wrong versions.

bad-path: PATH is missing important programs, so problems are likely.

not-root: Try to (de)install things even when not root.

bad-verify: Install a package even if it fails authenticity check.


Ignore dependency-checking for specified packages (actually, checking is performed, but only warnings about conflicts are given, nothing else).

--no-act, --dry-run, --simulate

Do everything which is supposed to be done, but don’t write any changes. This is used to see what would happen with the specified action, without actually modifying anything.

Be sure to give --no-act before the action-parameter, or you might end up with undesirable results. (e.g. dpkg --purge foo --no-act will first purge package foo and then try to purge package --no-act, even though you probably expected it to actually do nothing)

-R, --recursive

Recursively handle all regular files matching pattern *.deb found at specified directories and all of its subdirectories. This can be used with -i, -A, --install, --unpack and --avail actions.


Don’t install a package if a newer version of the same package is already installed. This is an alias of --refuse-downgrade.


Change default administrative directory, which contains many files that give information about status of installed or uninstalled packages, etc. (Defaults to /var/lib/dpkg)


Change default installation directory which refers to the directory where packages are to be installed. instdir is also the directory passed to chroot(2) before running package’s installation scripts, which means that the scripts see instdir as a root directory. (Defaults to /)


Changing root changes instdir to dir and admindir to dir/var/lib/dpkg.

-O, --selected-only

Only process the packages that are selected for installation. The actual marking is done with dselect or by dpkg, when it handles packages. For example, when a package is removed, it will be marked selected for deinstallation.

-E, --skip-same-version

Don’t install the package if the same version of the package is already installed.


Set an invoke hook command to be run via “sh -c” before or after the dpkg run for the unpack, configure, install, triggers-only, remove and purge dpkg actions. This option can be specified multiple times. The order the options are specified is preserved, with the ones from the configuration files taking precedence. The environment variable DPKG_HOOK_ACTION is set for the hooks to the current dpkg action. Note: front-ends might call dpkg several times per invocation, which might run the hooks more times than expected.


Set glob-pattern as a path filter, either by excluding or re-including previously excluded paths matching the specified patterns during install.

Warning: take into account that depending on the excluded paths you might completely break your system, use with caution.

The glob patterns use the same wildcards used in the shell, were ’*’ matches any sequence of characters, including the empty string and also ’/’. For example, ’/usr/*/READ*’ matches ’/usr/share/doc/package/README’. As usual, ’?’ matches any single character (again, including ’/’). And ’[’ starts a character class, which can contain a list of characters, ranges and complementations. See glob(7) for detailed information about globbing. Note: the current implementation might re-include more directories and symlinks than needed, to be on the safe side and avoid possible unpack failures, future work might fix this.

This can be used to remove all paths except some particular ones; a typical case is:


to remove all documentation files except the copyright files.

These two options can be specified multiple times, and interleaved with each other. Both are processed in the given order, with the last rule that matches a file name making the decision.

--status-fd n

Send machine-readable package status and progress information to file descriptor n. This option can be specified multiple times. The information is generally one record per line, in one of the following forms:
package: status

Package status changed; status is as in the status file.

status: package : error : extended-error-message

An error occurred. Any possible newlines in extended-error-message will be converted to spaces before output.

status: file : conffile-prompt : ’real-old’ ’real-new
useredited distedited

User is being asked a conffile question.

processing: stage: package

Sent just before a processing stage starts. stage is one of upgrade, install (both sent before unpacking), configure, trigproc, disappear, remove, purge.


Send machine-readable package status and progress information to the shell command’s standard input. This option can be specified multiple times. The output format used is the same as in --status-fd.


Log status change updates and actions to filename, instead of the default /var/log/dpkg.log. If this option is given multiple times, the last filename is used. Log messages are of the form ’YYYY-MM-DD HH:MM:SS status state pkg installed-version’ for status change updates; ’YYYY-MM-DD HH:MM:SS action pkg installed-version available-version’ for actions where action is one of install, upgrade, remove, purge; and ’YYYY-MM-DD HH:MM:SS conffile filename decision’ for conffile changes where decision is either install or keep.


Do not try to verify package signatures.


Do not run any triggers in this run (activations will still be recorded). If used with --configure package or --triggers-only package then the named package postinst will still be run even if only a triggers run is needed. Use of this option may leave packages in the improper triggers-awaited and triggers-pending states. This can be fixed later by running: dpkg --configure --pending.


Cancels a previous --no-triggers.


-i, --install package-file...

Install the package. If --recursive or -R option is specified, package-file must refer to a directory instead.

Installation consists of the following steps:

1. Extract the control files of the new package.

2. If another version of the same package was installed before the new installation, execute prerm script of the old package.

3. Run preinst script, if provided by the package.

4. Unpack the new files, and at the same time back up the old files, so that if something goes wrong, they can be restored.

5. If another version of the same package was installed before the new installation, execute the postrm script of the old package. Note that this script is executed after the preinst script of the new package, because new files are written at the same time old files are removed.

6. Configure the package. See --configure for detailed information about how this is done.

--unpack package-file...

Unpack the package, but don’t configure it. If --recursive or -R option is specified, package-file must refer to a directory instead.

--configure package...|-a|--pending

Configure a package which has been unpacked but not yet configured. If -a or --pending is given instead of package, all unpacked but unconfigured packages are configured.

To reconfigure a package which has already been configured, try the dpkg-reconfigure(8) command instead.

Configuring consists of the following steps:

1. Unpack the conffiles, and at the same time back up the old conffiles, so that they can be restored if something goes wrong.

2. Run postinst script, if provided by the package.

--triggers-only package...|-a|--pending

Processes only triggers. All pending triggers will be processed. If package names are supplied only those packages’ triggers will be processed, exactly once each where necessary. Use of this option may leave packages in the improper triggers-awaited and triggers-pending states. This can be fixed later by running: dpkg --configure --pending.

-r, --remove, -P, --purge package...|-a|--pending

Remove an installed package. -r or --remove remove everything except conffiles. This may avoid having to reconfigure the package if it is reinstalled later. (Conffiles are configuration files that are listed in the DEBIAN/conffiles control file). -P or --purge removes everything, including conffiles. If -a or --pending 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. Note: some configuration files might be unknown to dpkg because they are created and handled separately through the configuration scripts. In that case, dpkg won’t remove them by itself, but the package’s postrm script (which is called by dpkg), has to take care of their removal during purge. Of course, this only applies to files in system directories, not configuration files written to individual users’ home directories.

Removing of a package consists of the following steps:

1. Run prerm script

2. Remove the installed files

3. Run postrm script

--update-avail, --merge-avail Packages-file

Update dpkg’s and dselect’s idea of which packages are available. With action --merge-avail, old information is combined with information from Packages-file. With action --update-avail, old information is replaced with the information in the Packages-file. The Packages-file distributed with Debian is simply named Packages. dpkg keeps its record of available packages in /var/lib/dpkg/available.

A simpler one-shot command to retrieve and update the available file is dselect update. Note that this file is mostly useless if you don’t use dselect but an APT-based frontend: APT has its own system to keep track of available packages.

-A, --record-avail package-file...

Update dpkg and dselect’s idea of which packages are available with information from the package package-file. If --recursive or -R option is specified, package-file must refer to a directory instead.


Now obsolete and a no-op as dpkg will automatically forget uninstalled unavailable packages.


Erase the existing information about what packages are available.

-C, --audit

Searches for packages that have been installed only partially on your system. dpkg will suggest what to do with them to get them working.

--get-selections [package-name-pattern...]

Get list of package selections, and write it to stdout. Without a pattern, non-installed packages (i.e. those which have been previously purged) will not be shown.


Set package selections using file read from stdin. This file should be in the format ’package state’, where state is one of install, hold, deinstall or purge. Blank lines and comment lines beginning with ’#’ are also permitted.


Set the requested state of every non-essential package to deinstall. This is intended to be used immediately before --set-selections, to deinstall any packages not in list given to --set-selections.


Searches for packages selected for installation, but which for some reason still haven’t been installed.

--add-architecture architecture

Add architecture to the list of architectures for which packages can be installed without using --force-architecture. The architecture dpkg is built for (i.e. the output of --print-architecture) is always part of that list.

--remove-architecture architecture

Remove architecture from the list of architectures for which packages can be installed without using --force-architecture. If the architecture is currently in use in the database then the operation will be refused, except if --force-architecture is specified. The architecture dpkg is built for (i.e. the output of --print-architecture) can never be removed from that list.


Print architecture of packages dpkg installs (for example, "i386").


Print a newline-separated list of the extra architectures dpkg is configured to allow packages to be installed for.

--compare-versions ver1 op ver2

Compare version numbers, where op is a binary operator. dpkg returns success (zero result) if the specified condition is satisfied, and failure (nonzero result) otherwise. There are two groups of operators, which differ in how they treat an empty ver1 or ver2. These treat an empty version as earlier than any version: lt le eq ne ge gt. These treat an empty version as later than any version: lt-nl le-nl ge-nl gt-nl. These are provided only for compatibility with control file syntax: < << <= = >= >> >.

-?, --help

Display a brief help message.


Give help about the --force-thing options.

-Dh, --debug=help

Give help about debugging options.


Display dpkg version information.

dpkg-deb actions

See dpkg-deb(1) for more information about the following actions.

-b, --build directory [archive|directory]
Build a deb package.
, --contents archive
List contents of a deb package.
, --control filename [directory]
Extract control-information from a package.
, --extract archive directory
Extract the files contained by package.
, --vextract archive directory
Extract and display the filenames contained by a
, --field archive [control-field...]
Display control field(s) of a package.
Display the filesystem tar-file contained by a
Debian package.
, --info archive [control-file...]
Show information about a package.

dpkg-query actions

See dpkg-query(1) for more information about the following actions.

-l, --list package-name-pattern...
List packages matching given pattern.
, --status package-name...
Report status of specified package.
, --listfiles package-name...
List files installed to your system from package-name.
, --search filename-search-pattern...
Search for a filename from installed packages.
, --print-avail package-name...
Display details about package-name, as found in
. Users of APT-based frontends
should use apt-cache show package-name instead.

additional functionality

Additional functionality can be gained by installing any of the following packages: apt, aptitude and debsums.



If set, dpkg will use it as the directory from which to read the user specific configuration file.


If set, dpkg will use it as the directory in which to create temporary files and directories.


The program dpkg will execute when displaying the conffiles.


The program dpkg will execute when starting a new shell.


Sets the number of columns dpkg should use when displaying formatted text. Currently only used by -l.


Defined by dpkg on the shell spawned on the conffile prompt to examine the situation. Current valid value: conffile-prompt.


Defined by dpkg on the shell spawned on the conffile prompt to examine the situation. Contains the path to the old conffile.


Defined by dpkg on the shell spawned on the conffile prompt to examine the situation. Contains the path to the new conffile.


Defined by dpkg on the maintainer script environment to the version of the currently running dpkg instance.


Defined by dpkg on the maintainer script environment to the package name being handled.


Defined by dpkg on the maintainer script environment to the architecture the package got built for.


Defined by dpkg on the maintainer script environment to the name of the script running (preinst, postinst, prerm, postrm).



Configuration fragment files.


Configuration file with default options.


Default log file (see /etc/dpkg/dpkg.cfg(5) and option --log).

The other files listed below are in their default directories, see option --admindir to see how to change locations of these files.

List of available packages.


Statuses of available packages. This file contains information about whether a package is marked for removing or not, whether it is installed or not, etc. See section INFORMATION ABOUT PACKAGES for more info.

The status file is backed up daily in /var/backups. It can be useful if it’s lost or corrupted due to filesystems troubles.

The following files are components of a binary package. See deb(5) for more information about them:



information about packages

dpkg maintains some usable information about available packages. The information is divided in three classes: states, selection states and flags. These values are intended to be changed mainly with dselect.


The package is not installed on your system.


Only the configuration files of the package exist on the system.


The installation of the package has been started, but not completed for some reason.


The package is unpacked, but not configured.


The package is unpacked and configuration has been started, but not yet completed for some reason.


The package awaits trigger processing by another package.


The package has been triggered.


The package is unpacked and configured OK.


The package is selected for installation.


A package marked to be on hold is not handled by dpkg, unless forced to do that with option --force-hold.


The package is selected for deinstallation (i.e. we want to remove all files, except configuration files).


The package is selected to be purged (i.e. we want to remove everything from system directories, even configuration files).


A package marked reinst-required is broken and requires reinstallation. These packages cannot be removed, unless forced with option --force-remove-reinstreq.


This manual is intended for users wishing to understand dpkg’s command line options and package states in more detail than that provided by dpkg --help.

It should not be used by package maintainers wishing to understand how dpkg will install their packages. The descriptions of what dpkg does when installing and removing packages are particularly inadequate.


--no-act usually gives less information than might be helpful.

see also

aptitude, apt, dselect, dpkg-deb , dpkg-query , deb, deb-control, dpkg.cfg, and dpkg-reconfigure .


See /usr/share/doc/dpkg/THANKS for the list of people who have contributed to dpkg.

How can this site be more helpful to YOU ?

give  feedback