在 Debian 中的软件包管理器
dpkg -s <packagename> | grep '^Version:'
查看 .deb 需要的依赖：
# dpkg -I SunloginClient-10.1.1.38139_amd64.deb | grep 'Depends:' Depends: libappindicator3-1,libwebkitgtk-3.0-0
dpkg [option...] ACTIONS
provided by dpkg –help.
does when installing and removing packages are particularly inadequate.
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.
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.
INFORMATION ABOUT PACKAGES
and flags. These values are intended to be changed mainly with dselect.
Package selection states
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.
unpacked but unconfigured packages are configured.
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.
is reinstalled later (conffiles are configuration files that are listed in the DEBIAN/conffiles control file). If -a or
–pending is given instead of a package name, then all packages unpacked, but marked to be removed in file
/var/lib/dpkg/status, are removed.
instead of a package name, then all packages unpacked or removed, but marked to be purged in file /var/lib/dpkg/status, are
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.
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
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 future, and as such, programs parsing this command output should be explicit about the format they expect.
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.
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». 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
if you don’t use dselect but an APT-based frontend: APT has its own system to keep track of available packages.
or -R option is specified, package-file must refer to a directory instead.
that do not contain user information such as package selections.
previously purged) will not be shown.
install, hold, deinstall or purge. Blank lines and comment lines beginning with ‘#’ are also permitted.
warning. See the –update-avail and –merge-avail commands for more information.
immediately before –set-selections, to deinstall any packages not in list given to –set-selections.
dpkg 1.16.2). The architecture dpkg is built for (i.e. the output of –print-architecture) is always part of that list.
(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.
dpkg cannot provide support for it yet, and 2 if the feature is unknown. The current list of assertable features is:
invalid but might be accepted in lax contexts, and 2 if the string is invalid. The current list of validatable things is:
false (1) 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: < << <= = >= >> >. The < and > operators
are obsolete and should not be used, due to confusing semantics. To illustrate: 0.1 < 0.1 evaluates to true.
/var/lib/dpkg/available. Users of APT-based frontends
should use apt-cache show package-name instead.
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 ‘#’).
this option will cause automatic deconfiguration of the package which depended on the removed package.
change in future releases). -Dh or –debug=help display these debugging values.
2 Invocation and status of maintainer scripts
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
specified below. –force-help displays a message describing them. Things marked with (*) are forced by default.
break your whole system.
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.
parts of the package to remain on the system, which will then be forgotten by dpkg.
commands. Removing them might cause the whole system to stop working, so use with caution.
(removing) made to the file.
prompting, unless the –force-confdef is also specified, in which case the default action is preferred.
prompting, unless the –force-confdef is also specified, in which case the default action is preferred.
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.
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.
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.
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.
operation (since dpkg 1.18.5).
given, nothing else).
specified action, without actually modifying anything.
–no-act will first purge package foo and then try to purge package –no-act, even though you probably expected it to actually
can be used with -i, -A, –install, –unpack and –record-avail actions.
uninstalled packages, etc. (Defaults to «/var/lib/dpkg»)
directory passed to chroot(2) before running package’s installation scripts, which means that the scripts see instdir as a root
directory. (Defaults to «/»)
handles packages. For example, when a package is removed, it will be marked selected for deinstallation.
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.
patterns during install (since dpkg 1.15.8).
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.
the last rule that matches a file name making the decision.
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.
start with 9 characters to report each specific check result, a ‘?’ implies the check could not be done (lack of support, file
permissions, etc), ‘.’ implies the check passed, and an alphanumeric character implies a specific check failed; the md5sum
verification failure (the file contents have changed) is denoted with a ‘5’ on the third character. The line is followed by a
space and an attribute character (currently ‘c’ for conffiles), another space and the pathname.
times. The information is generally one record per line, in one of the following forms:
trigproc, disappear, remove, purge.
(since dpkg 1.16.0). This option can be specified multiple times. The output format used is the same as in –status-fd.
times, the last filename is used. Log messages are of the form:
configure, triggers-only, remove or purge).
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.
is intended to be prepended to any path maintainer scripts operate on. During normal operation, this variable is empty. When
installing packages into a different instdir, dpkg normally invokes maintainer scripts using chroot(2) and leaves this variable
empty, but if –force-script-chrootless is specified then the chroot(2) call is skipped and instdir is non-empty.
This variable is always set to the current –admindir value.
the old conffile.
the new conffile.
a state greater than not-installed (since dpkg 1.17.2).
postrm (since dpkg 1.15.7).
the –debug option) for the maintainer scripts (since dpkg 1.18.4).
it is installed or not, etc. See section INFORMATION ABOUT PACKAGES for more info.
–no-act usually gives less information than might be helpful.
Additional functionality can be gained by installing any of the following packages: apt, aptitude and debsums.
the dpkg-query –load-avail option should be used instead for that):
dpkg -i vim_4.5-3.deb
of choice (see
https://wiki.debian.org/Teams/Dpkg/FAQ for more details), for example:
apt-cache dumpavail >”$avail”
dpkg –merge-avail “$avail”
dpkg –set-selections <myselections
some other application to actually download and install the requested packages. For example, run apt-get dselect-upgrade.
aptitude(1), apt(1), dselect(1), dpkg-deb(1), dpkg-query(1), deb(5), deb-control(5), dpkg.cfg(5), and dpkg-reconfigure(8).
man 1 dpkg, Version 1.18.23kali1
command line – How can I find the version number of an installed package via dpkg? – Ask Ubuntu
software installation – How can I check dependency list for a deb package – Ask Ubuntu