Usage: dpkg [<option>...] <command>
Commands:
-i, --install <archive-spec>
Install the archives.
--unpack <archive-spec>
Unpack the archives.
--configure <package-spec>
Configure the packages.
--triggers-only <package-spec>
Process triggers for the packages.
-r, --remove <package-spec>
Remove the packages.
-P, --purge <package-spec>
Purge the packages.
-V, --verify [<package>...]
Verify the integrity of packages.
-C, --audit [<package>...]
Check for broken packages.
-s, --status [<package>...]
Show package status details.
-l, --list [<pattern>...]
List packages concisely.
-L, --listfiles <package>...
List files 'owned' by packages.
-S, --search <pattern>...
Find packages owning files.
--get-selections [<pattern>...]
Get list of selections to stdout.
--set-selections
Set package selections from stdin.
--clear-selections
Deselect every non-essential package.
-p, --print-avail [<package>...]
Show available package version details.
-A, --record-avail <archive-spec>
Record the archives in the available file.
--update-avail [<Packages-file>]
Replace available packages information.
--merge-avail [<Packages-file>]
Merge available package information.
--clear-avail
Erase existing available package information.
--add-architecture <arch>
Add <arch> to the list of architectures.
--remove-architecture <arch>
Remove <arch> from the list of architectures.
--print-architecture
Print native dpkg architecture.
--print-foreign-architectures
Print allowed foreign architectures.
--validate-<thing> <string>
Validate a <thing>'s <string>.
--compare-versions <a> <op> <b>
Compare version numbers (see below).
--predep-package
Print pre-dependencies to unpack.
--assert-help
Show help on assertions.
--assert-<feature>
Assert support for the specified feature.
--force-help
Show help on forcing.
-Dh, --debug=help
Show help on debugging.
-?, --help
Show this help message.
--version
Show the version.
<archive-spec> is: <.deb file name>... | (-R|--recursive) <directory>...
<package-spec> is: <package>... | (-a|--pending)
Validatable things: pkgname, archname, trigname, version.
Use dpkg with -b, --build, -c, --contents, -e, --control, -I, --info,
-f, --field, -x, --extract, -X, --vextract, --ctrl-tarfile, --fsys-tarfile
on archives (type dpkg-deb --help).
Options:
-O, --selected-only
Skip packages not selected for install/upgrade.
-E, --skip-same-version
Skip packages with same installed version/arch.
-G, --refuse-downgrade
Skip packages with earlier version than installed.
-B, --auto-deconfigure
Install even if it would break some other package.
--triggers
Force consequential trigger processing.
--no-triggers
Skip consequential trigger processing.
--verify-format=<format>
Verify output format (supported: 'rpm').
--robot
Use machine-readable output on some commands.
--no-pager
Disables the use of any pager.
--no-debsig
Do not try to verify package signatures.
--ignore-depends=<package>[,...]
Ignore dependencies involving <package>.
--force-<thing>[,...]
Override problems (see --force-help).
[default: security-mac,downgrade]
[env: DPKG_FORCE=]
--no-force-<thing>[,...]
Stop when problems encountered.
--refuse-<thing>[,...]
Alias for --no-force.
--abort-after <n>
Abort after encountering <n> errors.
--no-act
Print what would be done, but perform no action.
--dry-run
Alias for --no-act.
--simulate
Alias for --no-act.
-D, --debug=<octal>
Enable debugging output (see -Dhelp or --debug=help).
--path-exclude=<pattern>
Do not install paths which match a shell pattern.
--path-include=<pattern>
Re-include a pattern after a previous exclusion.
--pre-invoke=<command>
Set a pre-invoke hook.
--post-invoke=<command>
Set a post-invoke hook.
--status-fd <n>
Send status change updates to file descriptor <n>.
--status-logger=<command>
Send status change updates to <command>'s stdin.
--log=<filename>
Log status changes and actions to <filename>.
--admindir=<directory>
Change the database directory.
[default: /var/lib/dpkg]
[env: DPKG_ADMINDIR=]
--instdir=<directory>
Change the installation directory.
[default: /]
--root=<directory>
Change the root directory.
[default: /]
[env: DPKG_ROOT=]
Comparison operators for --compare-versions are:
lt le eq ne ge gt (treat empty version as earlier than any version);
lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version);
< << <= = >= >> > (only for compatibility with control file syntax).
Use 'apt' or 'aptitude' for user-friendly package management.
Options (64)
| Option | Description | Source |
|---|---|---|
-i, --install archive-spec | Install the archives. | help |
--unpack archive-spec | Unpack the archives. | help |
--configure package-spec | Configure the packages. | help |
--triggers-only package-spec | Process triggers for the packages. | help |
-r, --remove package-spec | Remove the packages. | help |
-P, --purge package-spec | Purge the packages. | help |
-V, --verify package>... | Verify the integrity of packages. | help |
-C, --audit package>... | Check for broken packages. | help |
-s, --status package>... | Show package status details. | help |
-l, --list pattern>... | List packages concisely. | help |
-L, --listfiles package>... | List files 'owned' by packages. | help |
-S, --search pattern>... | Find packages owning files. | help |
--get-selections pattern>... | Get list of selections to stdout. | help |
--set-selections | Set package selections from stdin. | help |
--clear-selections | Deselect every non-essential package. | help |
-p, --print-avail package>... | Show available package version details. | help |
-A, --record-avail archive-spec | Record the archives in the available file. | help |
--update-avail Packages-file | Replace available packages information. | help |
--merge-avail Packages-file | Merge available package information. | help |
--clear-avail | Erase existing available package information. | help |
--add-architecture arch | Add <arch> to the list of architectures. | help |
--remove-architecture arch | Remove <arch> from the list of architectures. | help |
--print-architecture | Print native dpkg architecture. | help |
--print-foreign-architectures | Print allowed foreign architectures. | help |
--validate- thing | Validate a <thing>'s <string>. | help |
--predep-package | Print pre-dependencies to unpack. | help |
--assert-help | Show help on assertions. | help |
--assert- feature | Assert support for the specified feature. | help |
--force-help | Show help on forcing. | help |
-Dh, --debug, -Doctal help | Show help on debugging. | help + man |
-?, --help | Show this help message. | help |
--version | Show the version. | help |
-f, --field, -x, --extract, -X, --vextract, --ctrl-tarfile, --fsys-tarfile | help | |
-O, --selected-only | Only process the packages that are selected for installation. | help + man |
-E, --skip-same-version | Don't install the package if the same version and architecture of the package is already installed. | help + man |
-G, --refuse-downgrade | Don't install a package if a newer version of the same package is already installed. | help + man |
-B, --auto-deconfigure | When a package is removed, there is a possibility that another installed package depended on the removed package. | help + man |
--triggers | Force consequential trigger processing. | help + man |
--no-triggers | Do not run any triggers in this run, but activations will still be recorded. | help + man |
--verify-format format | Sets the output format for the --verify command. | help + man |
--robot | Use machine-readable output on some commands. | help + man |
--no-pager | Disables the use of any pager when showing information. | help + man |
--no-debsig | Do not try to verify package signatures. | help + man |
--ignore-depends package | Ignore dependency-checking for specified packages (actually, checking is performed, but only warnings about conflicts are given, nothing else). | help + man |
--force- thing | Override problems (see --force-help). | help |
--no-force- thing | Stop when problems encountered. | help |
--refuse- thing | Alias for --no-force. | help |
--abort-after n | Change after how many errors dpkg will abort. | help + man |
--no-act | Print what would be done, but perform no action. | help + man |
--dry-run | Alias for --no-act. | help + man |
--simulate | Do everything which is supposed to be done, but don't write any changes. | help + man |
--path-exclude pattern | Do not install paths which match a shell pattern. | help + man |
--path-include pattern | Set glob-pattern as a path filter, either by excluding or re-including previously excluded paths matching the specified patterns during install. | help + man |
--pre-invoke command | Set a pre-invoke hook. | help + man |
--post-invoke command | 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 actions (since dpkg 1.15.4), and add-architecture… | help + man |
--status-fd n | Send machine-readable package status and progress information to file descriptor n. | help + man |
--status-logger command | Send machine-readable package status and progress information to the shell command's standard input, to be run via “sh -c”. | help + man |
--log filename | Log status change updates and actions to filename, instead of the default /var/log/dpkg.log. | help + man |
--admindir directory | Set the administrative directory to directory. | help + man |
--instdir directory | Set the installation directory, which refers to the directory where packages are to be installed. | help + man |
--root directory | Set the root directory to directory, which sets the installation directory to «directory» and the administrative directory to «directory/var/lib/dpkg» if DPKG_ROOT has not been set (since dpkg… | help + man |
--force-things | (in the manual page but not in --help) | man |
--no-force-things, --refuse-things | Force or refuse (no-force and refuse mean the same thing) to do some things. (in the manual page but not in --help) | man |
-R, --recursive | Recursively handle all regular files matching pattern .deb found at specified directories and all of its subdirectories. (in the manual page but not in --help) | man |
Exit status (3) from the manual page
0 | The requested command was successfully performed. |
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. |
Examples (8) from the manual page, untested
dpkg -l '*vi*'
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…dpkg --print-avail vim neovim | less
To see the entries in /var/lib/dpkg/available of two packages:dpkg --print-avail | less
To search the listing of packages yourself:dpkg -r neovim
To remove an installed neovim package:dpkg -i /media/bdrom/pool/main/v/vim/vim_9.0.2018-1_amd64.deb
To install a package, you first need to find it in an archive or media disc.dpkg --get-selections >myselections
To make a local copy of the package selection states:apt-cache dumpavail | dpkg --merge-avail
You might transfer this file to another computer, and after having updated the available file there with your package manager frontend of choice (see…dpkg --clear-selections
you can install it with: