dpkg - package manager for Debian
| Use Case | Command | Description |
|---|---|---|
| Install a .deb package | dpkg -i pkg.deb | Install the given package file |
| Unpack but don't configure | dpkg --unpack pkg.deb | Extract files without running setup scripts |
| Remove a package (keep config) | dpkg -r pkgname | Delete binaries but leave config files |
| Purge a package (remove all) | dpkg -P pkgname | Delete everything including config files |
| Configure unpacked packages | dpkg --configure pkgname | Run setup scripts for an unpacked package |
| List matching packages | dpkg -l 'pattern' | List installed packages matching shell glob |
| Show package status | dpkg -s pkgname | Display detailed status of a package |
| List files from a package | dpkg -L pkgname | Show all files installed by the package |
| Find package owning file | dpkg -S /path/to/file | Search which installed package provides a file |
| Verify package integrity | dpkg -V [pkgname] | Check md5sums of installed files |
| Audit package database | dpkg -C | Check for broken or partially installed packages |
| Add foreign architecture | dpkg --add-architecture i386 | Enable installation of packages for a different arch |
| Print installed architecture | dpkg --print-architecture | Show the host architecture (e.g., amd64) |
| Get/set package selections | dpkg --get-selections / dpkg --set-selections | Save/restore package selection state |
| Compare version numbers | dpkg --compare-versions 1.2 lt 2.0 | Exit 0 if condition true |
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.
dpkg is a medium-level tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg as a CLI (command-line interface) is apt(8) and as a TUI (terminal user interface) is aptitude(8). 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.
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.
not-installed β The package is not installed on your system.config-files β Only the configuration files or the postrm script and the data it needs to remove of the package exist on the system.half-installed β The installation of the package has been started, but not completed for some reason.unpacked β The package is unpacked, but not configured.half-configured β The package is unpacked and configuration has been started, but not yet completed for some reason.triggers-awaited β The package awaits trigger processing by another package.triggers-pending β The package has been triggered.installed β The package is correctly unpacked and configured.install β The package is selected for installation.hold β A package marked to be on hold is kept on the same version; no automatic installs, upgrades or removals will be performed, unless actions are requested explicitly or --force-hold is used.deinstall β The package is selected for deinstallation (remove all files except configuration files).purge β The package is selected to be purged (remove everything from system directories, even configuration files).unknown β The package selection is unknown. A package that is also in a not-installed state, and with an ok flag will be forgotten in the next database store.ok β A package marked ok is in a known state, but might need further processing.reinstreq β A package marked reinstreq is broken and requires reinstallation. These packages cannot be removed, unless forced with option --force-remove-reinstreq.-i, --install package-file...Install the package. If --recursive or -R is specified, package-file must refer to a directory instead.
Installation consists of the following steps:
prerm script of the old package.preinst script, if provided by the package.postrm script of the old package. This script is executed after the preinst script of the new package.--configure for detailed information.--unpack package-file...Unpack the package, but don't configure it. If --recursive or -R is specified, package-file must refer to a directory instead.
--configure package...|-a|--pendingConfigure a package which has been unpacked but not yet configured. If -a or --pending is given, 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:
postinst script, if provided by the package.--triggers-only package...|-a|--pendingProcesses only triggers (since dpkg 1.14.17). 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 improper triggers-awaited and triggers-pending states. This can be fixed later by running: dpkg --configure --pending.
-r, --remove package...|-a|--pendingRemove an installed package. This removes everything except conffiles and other data cleaned up by the postrm script, which may avoid having to reconfigure the package if reinstalled later. If there is no DEBIAN/conffiles control file nor DEBIAN/postrm script, this command is equivalent to calling --purge. If -a or --pending is given instead of a package name, then all packages unpacked, but marked to be removed in /var/lib/dpkg/status, are removed.
Removing of a package consists of the following steps:
prerm scriptpostrm script-P, --purge package...|-a|--pendingPurge an installed or already removed package. This removes everything, including conffiles, and anything else cleaned up from postrm. If -a or --pending is given instead of a package name, then all packages unpacked or removed, but marked to be purged in /var/lib/dpkg/status, are purged.
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.
Purging of a package consists of the following steps:
--remove for detailed information about how this is done.postrm script.-V, --verify [package-name...]Verifies the integrity of package-name or all packages if omitted, by comparing information from the files installed by a package with the files metadata information stored in the dpkg database (since dpkg 1.17.2). The origin of the files metadata information in the database is the binary packages themselves. That metadata gets collected at package unpack time during the installation process.
Currently the only functional check performed is an md5sum verification of the file contents against the stored value in the files database. It will only get checked if the database contains the file md5sum. To check for any missing metadata in the database, the --audit command can be used.
The output format is selectable with the --verify-format option, which by default uses the rpm format, but that might change in the future, and as such, programs parsing this command output should be explicit about the format they expect.
-C, --audit [package-name...]Performs database sanity and consistency checks for package-name or all packages if omitted (per package checks since dpkg 1.17.10). For example, searches for packages that have been installed only partially on your system or that have missing, wrong or obsolete control data or files. dpkg will suggest what to do with them to get them fixed.
--update-avail [Packages-file] / --merge-avail [Packages-file]Update dpkg's and dselect's idea of which packages are available. With --merge-avail, old information is combined with information from Packages-file. With --update-avail, old information is replaced with the information in the Packages-file. The Packages-file distributed with Debian is simply named Β«PackagesΒ». If the Packages-file argument is missing or named Β«-Β» then it will be read from standard input (since dpkg 1.17.7). 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.
--forget-old-unavailNow obsolete and a no-op as dpkg will automatically forget uninstalled unavailable packages (since dpkg 1.15.4), but only those that do not contain user information such as package selections.
--clear-availErase the existing information about what packages are available.
--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-selectionsSet 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.
The available file needs to be up-to-date for this command to be useful, otherwise unknown packages will be ignored with a warning. See the --update-avail and --merge-avail commands for more information.
--clear-selectionsSet the requested state of every non-essential package to deinstall (since dpkg 1.13.18). This is intended to be used immediately before --set-selections, to deinstall any packages not in list given to --set-selections.
--yet-to-unpackSearches for packages selected for installation, but which for some reason still haven't been installed.
Note: This command makes use of both the available file and the package selections.
--predep-packagePrint a single package which is the target of one or more relevant pre-dependencies and has itself no unsatisfied pre-dependencies.
If such a package is present, output it as a Packages file entry, which can be massaged as appropriate.
Note: This command makes use of both the available file and the package selections.
Returns 0 when a package is printed, 1 when no suitable package is available and 2 on error.
--add-architecture architectureAdd architecture to the list of architectures for which packages can be installed without using --force-architecture (since dpkg 1.16.2). The architecture dpkg is built for (i.e. the output of --print-architecture) is always part of that list.
--remove-architecture architectureRemove architecture from the list of architectures for which packages can be installed without using --force-architecture (since dpkg 1.16.2). 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-architecturePrint architecture of packages dpkg installs (for example, βi386β).
--print-foreign-architecturesPrint a newline-separated list of the extra architectures dpkg is configured to allow packages to be installed for (since dpkg 1.16.2).
--assert-helpGive help about the --assert-feature options (since dpkg 1.21.0).
--assert-featureAsserts that dpkg supports the requested feature. Returns 0 if the feature is fully supported, 1 if the feature is known but dpkg cannot provide support for it yet, and 2 if the feature is unknown. The current list of assertable features is:
support-predepends β Supports the Pre-Depends field (since dpkg 1.1.0).working-epoch β Supports epochs in version strings (since dpkg 1.4.0.7).long-filenames β Supports long filenames in deb(5) archives (since dpkg 1.4.1.17).multi-conrep β Supports multiple Conflicts and Replaces (since dpkg 1.4.1.19).multi-arch β Supports multi-arch fields and semantics (since dpkg 1.16.2).versioned-provides β Supports versioned Provides (since dpkg 1.17.11).protected-field β Supports the Protected field (since dpkg 1.20.1).--validate-thing stringValidate that the thing string has a correct syntax (since dpkg 1.18.16). Returns 0 if the string is valid, 1 if the string is invalid but might be accepted in lax contexts, and 2 if the string is invalid. The current list of validatable things is:
pkgname β Validates the given package name (since dpkg 1.18.16).trigname β Validates the given trigger name (since dpkg 1.18.16).archname β Validates the given architecture name (since dpkg 1.18.16).version β Validates the given version (since dpkg 1.18.16).--compare-versions ver1 op ver2Compare version numbers, where op is a binary operator. dpkg returns true (0) if the specified condition is satisfied, and false (1) otherwise. There are two groups of operators:
lt le eq ne ge gtlt-nl le-nl ge-nl gt-nl< << <= = >= >> > (The < and > operators are obsolete and should not be used, due to confusing semantics. For example, 0.1 < 0.1 evaluates to true.)-?, --helpDisplay a brief help message.
--force-helpGive help about the --force-thing options.
-Dh, --debug=helpGive help about debugging options.
--versionDisplay dpkg version information. When used with --robot, the output will be the program version number in a dotted numerical format, with no newline.
See dpkg-deb(1) for more information about the following actions, and other actions and options not exposed by the dpkg front-end.
-b, --build directory [archive|directory] β Build a deb package.-c, --contents archive β List contents of a deb package.-e, --control archive [directory] β Extract control-information from a package.-x, --extract archive directory β Extract the files contained by package.-X, --vextract archive directory β Extract and display the filenames contained by a package.-f, --field archive [control-field...] β Display control field(s) of a package.--ctrl-tarfile archive β Output the control tar-file contained in a Debian package.--fsys-tarfile archive β Output the filesystem tar-file contained by a Debian package.-I, --info archive [control-file...] β Show information about a package.See dpkg-query(1) for more information about the following actions, and other actions and options not exposed by the dpkg front-end.
-l, --list package-name-pattern... β List packages matching given pattern.-s, --status package-name... β Report status of specified package.-L, --listfiles package-name... β List files installed to your system from package-name.-S, --search filename-search-pattern... β Search for a filename from installed packages.-p, --print-avail package-name... β Display details about package-name, as found in /var/lib/dpkg/available. Users of APT-based frontends should use apt show package-name instead.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 hyphens) or a comment (if it starts with a #).
--abort-after=numberChange after how many errors dpkg will abort. The default is 50.
-B, --auto-deconfigureWhen 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=octalSwitch debugging on. octal is formed by bitwise-ORing 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 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.configure-any β Configure also any unpacked but unconfigured packages on which the current package depends.hold β Allow automatic installs, upgrades or removals of packages even when marked to be on βholdβ. Note: This does not prevent these actions when requested explicitly.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-protected β Remove, even if the package is considered protected (since dpkg 1.20.1). Protected packages contain mostly important system boot infrastructure. Removing them might cause the whole system to be unable to boot, so use with caution.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. This affects the Pre-Depends and Depends fields.depends-version β Don't care about versions when checking dependencies. This affects the Pre-Depends and Depends fields.breaks β Install, even if this would break another package (since dpkg 1.14.6). This affects the Breaks field.conflicts β Install, even if it conflicts with another package. This is dangerous, for it will usually cause overwriting of some files. This affects the Conflicts field.confmiss β 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 --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 --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 (since dpkg 1.15.8). If any of --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.statoverride-add β Overwrite an existing stat override when adding it (since dpkg 1.19.5).statoverride-remove β Ignore a missing stat override when removing it (since dpkg 1.19.5).security-mac(*) β Use platform-specific Mandatory Access Controls (MAC) based security when installing files into the filesystem (since dpkg 1.19.5). On Linux systems the implementation uses SELinux.unsafe-io β Do not perform safe I/O operations when unpacking (since dpkg 1.15.8.6). 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.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.script-chrootless β Run maintainer scripts without chroot(2)ing into instdir even if the package does not support this mode of operation (since dpkg 1.18.5).architecture β Process even packages with wrong or no architecture.bad-version β Process even packages with wrong versions (since dpkg 1.16.1).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-depends=package,...Ignore dependency-checking for specified packages (actually, checking is performed, but only warnings about conflicts are given, nothing else). This affects the Pre-Depends, Depends and Breaks fields.
--no-act, --dry-run, --simulateDo 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, --recursiveRecursively 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 --record-avail actions.
-GDon't install a package if a newer version of the same package is already installed. This is an alias of --refuse-downgrade.
--admindir=dirSet the administrative directory to directory. This directory contains many files that give information about status of installed or uninstalled packages, etc. Defaults to Β«/var/lib/dpkgΒ».
--instdir=dirSet the 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 Β«/Β».
--root=dirSet the root directory to directory, which sets the installation directory to Β«dirΒ» and the administrative directory to Β«dir/var/lib/dpkgΒ».
-O, --selected-onlyOnly 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-versionDon't install the package if the same version of the package is already installed.
--pre-invoke=command / --post-invoke=commandSet an invoke hook command to be run via βsh -cβ before or after the dpkg run for the unpack, configure, install, triggers-only, remove, purge, add-architecture and remove-architecture dpkg actions (since dpkg 1.15.4; add-architecture and remove-architecture actions since dpkg 1.17.19). 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.
--path-exclude=glob-pattern / --path-include=glob-patternSet glob-pattern as a path filter, either by excluding or re-including previously excluded paths matching the specified patterns during install (since dpkg 1.15.8).
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, in particular when there is a more specific re-inclusion, 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:
--path-exclude=/usr/share/doc/*
--path-include=/usr/share/doc/*/copyright
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.
The filters are applied when unpacking the binary packages, and as such only have knowledge of the type of object currently being filtered (e.g. a normal file or a directory) and have not visibility of what objects will come next. Because these filters have side effects (in contrast to find(1) filters), excluding an exact pathname that happens to be a directory object like /usr/share/doc will not have the desired result, and only that pathname will be excluded (which could be automatically reincluded if the code sees the need). Any subsequent files contained within that directory will fail to unpack.
Hint: make sure the globs are not expanded by your shell.
--verify-format format-nameSets the output format for the --verify command (since dpkg 1.17.2).
The only currently supported output format is rpm, which consists of a line for every path that failed any check. These lines have the following format:
missing [c] pathname [(error-message)]
??5?????? [c] pathname
The first 9 characters are used to report the checks result, either a literal missing when the file is not present or its metadata cannot be fetched, or one of the following special characters that report the result for each check:
? β Implies the check could not be done (lack of support, file permissions, etc).. β Implies the check passed.A-Za-z0-9 β Implies a specific check failed. The following positions and alphanumeric characters are currently supported:
?β β These checks are currently not supported, will always be β?β.Mβ β The file mode check failed (since dpkg 1.21.0). Because pathname metadata is currently not tracked, this check can only be partially emulated via a very simple heuristic for pathnames that have a known digest, which implies they should be regular files, where the check will fail if the pathname is not a regular file on the filesystem. This check will currently never succeed as it does not have enough information available.5β β The digest check failed, which means the file contents have changed.?β β These checks are currently not supported, will always be β?β.The line is followed by a space and an attribute character. The following attribute character is supported:
c β The pathname is a conffile.Finally followed by another space and the pathname.
In case the entry was of the missing type, and the file was not actually present on the filesystem, then the line is followed by a space and the error message enclosed within parenthesis.
--status-fd nSend 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:
status: package: status # Package status changed; status as in status file
status: package : error : extended-error # Error occurred; any newlines converted to spaces
status: file : conffile-prompt : 'real-old' 'real-new' useredited distedited # Conffile question
processing: stage: package # Start of a processing stage (upgrade, install, configure, trigproc, disappear, remove, purge)
--status-logger=commandSend machine-readable package status and progress information to the shell command's standard input, to be run via βsh -cβ (since dpkg 1.16.0). This option can be specified multiple times. The output format used is the same as in --status-fd.
--log=filenameLog 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 startup type command # type: archives (unpack/install) or packages (configure,triggers-only,remove,purge)
YYYY-MM-DD HH:MM:SS status state pkg installed-version # status change updates
YYYY-MM-DD HH:MM:SS action pkg installed-version available-version # install, upgrade, configure, trigproc, disappear, remove, purge
YYYY-MM-DD HH:MM:SS conffile filename decision # decision: install or keep
--robotUse a machine-readable output format. This provides an interface for programs that need to parse the output of some of the commands that do not otherwise emit a machine-readable output format. No localization will be used, and the output will be modified to make it easier to parse.
The only currently supported command is --version.
--no-pagerDisables the use of any pager when showing information (since dpkg 1.19.2).
--no-debsigDo not try to verify package signatures.
--no-triggersDo not run any triggers in this run (since dpkg 1.14.17), but 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.
--triggersCancels a previous --no-triggers (since dpkg 1.14.17).
0 β The requested action was successfully performed. Or a check or assertion command returned true.1 β A check or assertion command returned false.2 β Fatal or unrecoverable error due to invalid command-line usage, or interactions with the system, such as accesses to the database, memory allocations, etc.PATH β Expected to be defined and point to system paths where required programs are found. If not set or programs missing, dpkg aborts.HOME β If set, dpkg uses it as the directory from which to read the user specific configuration file.TMPDIR β If set, dpkg uses it as the directory in which to create temporary files and directories.SHELL β The program dpkg will execute when starting a new interactive shell, or when spawning a command via a shell.PAGER, DPKG_PAGER β The program dpkg will execute when running a pager, executed with $SHELL -c. DPKG_PAGER overrides PAGER (since dpkg 1.19.2).DPKG_COLORS β Sets color mode (since dpkg 1.18.5). Values: auto (default), always, never.DPKG_FORCE β Sets the force flags (since dpkg 1.19.5). When present, no built-in force defaults are applied. If empty, all force flags are disabled.DPKG_ADMINDIR β If set and --admindir or --root not specified, it is used as the dpkg administrative directory (since dpkg 1.20.0).DPKG_FRONTEND_LOCKED β Set by a frontend to notify dpkg it should not acquire the frontend lock (since dpkg 1.19.1).LESS β Defined to -FRSXMQ if not already set, when spawning a pager (since dpkg 1.19.2). To override, preset this variable or use DPKG_PAGER="less -+F" to disable specific options.DPKG_ROOT β Indicates which installation to act on (since dpkg 1.18.5). Usually empty; when using --force-script-chrootless, it may be non-empty.DPKG_ADMINDIR β Always set to the current --admindir value (since dpkg 1.16.0).DPKG_FORCE β Contains currently enabled force option names separated by commas (since dpkg 1.19.5).DPKG_SHELL_REASON β Reason for spawning a shell on conffile prompt: conffile-prompt (since dpkg 1.15.6).DPKG_CONFFILE_OLD β Path to the old conffile (since dpkg 1.15.6).DPKG_CONFFILE_NEW β Path to the new conffile (since dpkg 1.15.6).DPKG_HOOK_ACTION β Current dpkg action when executing a hook (since dpkg 1.15.4).DPKG_RUNNING_VERSION β Version of the currently running dpkg instance (since dpkg 1.14.17).DPKG_MAINTSCRIPT_PACKAGE β Non-arch-qualified package name being handled (since dpkg 1.14.17).DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT β Number of package instances with state > not-installed (since dpkg 1.17.2).DPKG_MAINTSCRIPT_ARCH β Architecture the package was built for (since dpkg 1.15.4).DPKG_MAINTSCRIPT_NAME β Name of the running script: preinst, postinst, prerm or postrm (since dpkg 1.15.7).DPKG_MAINTSCRIPT_DEBUG β β0β or β1β noting whether debugging was requested for maintainer scripts (since dpkg 1.18.4)./etc/dpkg/dpkg.cfg.d/[0-9a-zA-Z_-]* β Configuration fragment files (since dpkg 1.15.4)./etc/dpkg/dpkg.cfg β Configuration file with default options./var/log/dpkg.log β Default log file (see /etc/dpkg/dpkg.cfg and option --log)./var/lib/dpkg/available β List of available packages./var/lib/dpkg/status β 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.The format and contents of a binary package are described in deb(5).
--no-act usually gives less information than might be helpful.
dpkg -l '*vi*'
Note that dpkg-query does not load the available file anymore by default; use dpkg-query --load-avail for that.
dpkg --print-avail elvis vim | less
Or search manually:
less /var/lib/dpkg/available
dpkg -r elvis
cd /media/cdrom/pool/main/v/vim
dpkg -i vim_4.5-3.deb
Save current selections:
dpkg --get-selections > myselections
On another computer, update the available file (example with apt-cache):
apt-cache dumpavail | dpkg --merge-avail
Then clear and set selections:
dpkg --clear-selections
dpkg --set-selections < myselections
This only sets the selection state; you still need to actually install/remove packages, e.g., with apt-get dselect-upgrade.
Ordinarily, dselect(1) provides a more convenient way to modify the package selection states.
Additional functionality can be gained by installing any of the following packages: apt, aptitude and debsums.
See /usr/share/doc/dpkg/THANKS for the list of people who have contributed to dpkg.
| Use Case | Expression | Description |
|---|---|---|
| Get current program name | $Dpkg::PROGNAME | Name of the running program |
| Get dpkg suite version | $Dpkg::PROGVERSION | Version string of the dpkg suite |
| Get path to GNU make | $Dpkg::PROGMAKE | Full path to the make program |
| Get path to GNU tar | $Dpkg::PROGTAR | Full path to tar |
| Get path to patch | $Dpkg::PROGPATCH | Full path to GNU patch (or safe alternative) |
| Get configuration directory | $Dpkg::CONFDIR | System dpkg config directory |
| Get database directory | $Dpkg::ADMINDIR | Path to /var/lib/dpkg |
| Get methods/plugins dir | $Dpkg::LIBDIR | Directory for dpkg methods and plugins |
| Get arch tables directory | $Dpkg::DATADIR | Path to architecture tables |
The Dpkg module provides a set of variables with information concerning this system installation. It is also the entry point to the Dpkg module hierarchy.
$Dpkg::PROGNAME β Contains the name of the current program.$Dpkg::PROGVERSION β Contains the version of the dpkg suite.$Dpkg::PROGMAKE β Contains the name of the system GNU make program.$Dpkg::PROGTAR β Contains the name of the system GNU tar program.$Dpkg::PROGPATCH β Contains the name of the system GNU patch program (or another implementation that is directory traversal resistant).$Dpkg::CONFDIR β Contains the path to the dpkg system configuration directory.$Dpkg::ADMINDIR β Contains the path to the dpkg database directory.$Dpkg::LIBDIR β Contains the path to the dpkg methods and plugins directory.$Dpkg::DATADIR β Contains the path to the dpkg architecture tables directory.The following is the list of public modules within the Dpkg hierarchy. Only modules with versions 1.00 or higher, and only the interfaces documented in their POD are considered public.
Dpkg::Arch β Architecture handling functions.Dpkg::Build::Info β Build information functions.Dpkg::BuildFlags β Set, modify and query compilation build flags.Dpkg::BuildOptions β Parse and manipulate DEB_BUILD_OPTIONS.Dpkg::BuildProfiles β Parse and manipulate build profiles.Dpkg::Changelog β Parse changelogs.Dpkg::Changelog::Entry β Represents a changelog entry.Dpkg::Changelog::Parse β Generic changelog parser for dpkg-parsechangelog.Dpkg::Checksums β Generate and parse checksums.Dpkg::Compression β Simple database of available compression methods.Dpkg::Compression::FileHandle β Transparently compress and decompress files.Dpkg::Compression::Process β Wrapper around compression tools.Dpkg::Conf β Parse dpkg configuration files.Dpkg::Control β Parse and manipulate Debian control information (.dsc, .changes, Packages/Sources entries, etc.).Dpkg::Control::Changelog β Represent fields output by dpkg-parsechangelog.Dpkg::Control::Fields β Manage (list of known) control fields.Dpkg::Control::Hash β Parse and manipulate a block of RFC822-like fields.Dpkg::Control::Info β Parse files like debian/control.Dpkg::Control::Tests β Parse files like debian/tests/control.Dpkg::Control::Tests::Entry β Represents a debian/tests/control stanza.Dpkg::Deps β Parse and manipulate dependencies.Dpkg::Deps::Simple β Represents a single dependency statement.Dpkg::Deps::Multiple β Base module to represent multiple dependencies.Dpkg::Deps::Union β List of unrelated dependencies.Dpkg::Deps::AND β List of AND dependencies.Dpkg::Deps::OR β List of OR dependencies.Dpkg::Deps::KnownFacts β List of installed and virtual packages.Dpkg::Exit β Push, pop and run exit handlers.Dpkg::Gettext β Wrapper around Locale::gettext.Dpkg::IPC β Spawn sub-processes and feed/retrieve data.Dpkg::Index β Collections of Dpkg::Control (Packages/Sources files for example).Dpkg::Interface::Storable β Base object serializer.Dpkg::Path β Common path handling functions.Dpkg::Source::Format β Parse and manipulate debian/source/format files.Dpkg::Source::Package β Extract Debian source packages.Dpkg::Substvars β Substitute variables in strings.Dpkg::Vendor β Identify current distribution vendor.Dpkg::Version β Parse and manipulate Debian package versions.Remove variables: $version, $progname, $admindir, $dpkglibdir and $pkgdatadir.
New variable: $PROGPATCH.
New variables: $PROGTAR, $PROGMAKE.
New variables: $PROGNAME, $PROGVERSION, $CONFDIR, $ADMINDIR, $LIBDIR and $DATADIR.
Deprecated variables: $version, $admindir, $dpkglibdir and $pkgdatadir.
Mark the module as public.
See the header comment on each module for their particular license.
Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-09 10:21 @2600:1f28:365:80b0:50b3:453e:ff52:20f7
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format