.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "dpkg-query 1" .TH dpkg-query 1 2024-03-10 1.22.6 "dpkg suite" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME dpkg\-query \- a tool to query the dpkg database .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fBdpkg-query\fR [\fIoption\fR...] \fIcommand\fR .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBdpkg-query\fR is a tool to show information about packages listed in the \fBdpkg\fR database. .SH COMMANDS .IX Header "COMMANDS" .IP "\fB\-l\fR, \fB\-\-list\fR [\fIpackage-name-pattern\fR...]" 4 .IX Item "-l, --list [package-name-pattern...]" List all known packages matching one or more patterns, regardless of their status, which includes any real or virtual package referenced in any dependency relationship field (such as \fBBreaks\fR, \fBEnhances\fR, etc.). If no \fIpackage-name-pattern\fR is given, list all packages in \&\fI/var/lib/dpkg/status\fR, excluding the ones marked as not-installed (i.e. those which have been previously purged). Normal shell wildcard characters are allowed in \fIpackage-name-pattern\fR. Please note you will probably have to quote \fIpackage-name-pattern\fR to prevent the shell from performing filename expansion. For example this will list all package names starting with \(lqlibc6\(rq: .RS 4 .Sp .Vb 1 \& dpkg\-query \-l \*(Aqlibc6*\*(Aq .Ve .RE .RS 4 .Sp The first three columns of the output show the desired action, the package status, and errors, in that order. .Sp Desired action: .IP "u = Unknown" 4 .IX Item "u = Unknown" .PD 0 .IP "i = Install" 4 .IX Item "i = Install" .IP "h = Hold" 4 .IX Item "h = Hold" .IP "r = Remove" 4 .IX Item "r = Remove" .IP "p = Purge" 4 .IX Item "p = Purge" .RE .RS 4 .PD .Sp Package status: .IP "n = Not-installed" 4 .IX Item "n = Not-installed" .PD 0 .IP "c = Config-files" 4 .IX Item "c = Config-files" .IP "H = Half-installed" 4 .IX Item "H = Half-installed" .IP "U = Unpacked" 4 .IX Item "U = Unpacked" .IP "F = Half-configured" 4 .IX Item "F = Half-configured" .IP "W = Triggers-awaiting" 4 .IX Item "W = Triggers-awaiting" .IP "t = Triggers-pending" 4 .IX Item "t = Triggers-pending" .IP "i = Installed" 4 .IX Item "i = Installed" .RE .RS 4 .PD .Sp Error flags: .IP " = (none)" 4 .IX Item " = (none)" .PD 0 .IP "R = Reinst-required" 4 .IX Item "R = Reinst-required" .RE .RS 4 .PD .Sp An uppercase status or error letter indicates the package is likely to cause severe problems. Please refer to \fBdpkg\fR\|(1) for information about the above states and flags. .Sp The output format of this option is not configurable, but varies automatically to fit the terminal width. It is intended for human readers, and is not easily machine-readable. See \fB\-W\fR (\fB\-\-show\fR) and \fB\-\-showformat\fR for a way to configure the output format. .RE .IP "\fB\-W\fR, \fB\-\-show\fR [\fIpackage-name-pattern\fR...]" 4 .IX Item "-W, --show [package-name-pattern...]" Just like the \fB\-\-list\fR option this will list all packages matching the given patterns. However the output can be customized using the \&\fB\-\-showformat\fR option. .Sp The default output format gives one line per matching package, each line consisting of the package name and its installed version, separated by a tab. The package name will be architecture qualified for packages with a \&\fBMulti-Arch\fR field with the value \fBsame\fR or with a foreign architecture, which is an architecture that is neither the native one nor \fBall\fR. .IP "\fB\-s\fR, \fB\-\-status\fR [\fIpackage-name\fR...]" 4 .IX Item "-s, --status [package-name...]" Report status of specified packages. This just displays the entry in the installed package status database. If no \fIpackage-name\fR is specified it will display all package entries in the status database (since dpkg 1.19.1). When multiple \fIpackage-name\fR entries are listed, the requested status entries are separated by an empty line, with the same order as specified on the argument list. .IP "\fB\-L\fR, \fB\-\-listfiles\fR \fIpackage-name\fR..." 4 .IX Item "-L, --listfiles package-name..." List files installed to your system from \fIpackage-name\fR. When multiple \&\fIpackage-name\fRs are listed, the requested lists of files are separated by an empty line, with the same order as specified on the argument list. .Sp Each file diversion is printed on its own line after its diverted file, prefixed with one of the following localized strings: .Sp locally diverted to: \fIdiverted-to\fR package diverts others to: \fIdiverted-to\fR diverted by \fIpkg\fR to: \fIdiverted-to\fR .Sp \&\fBHint\fR: When machine parsing the output, it is customary to set the locale to \&\fBC.UTF\-8\fR to get reproducible results. On some systems this might also require adapting the \fBLANGUAGE\fR environment variable appropriately if it is already set (see \fBlocale\fR\|(7)). .Sp This command will not list extra files created by maintainer scripts, nor will it list alternatives. .IP "\fB\-\-control\-list\fR \fIpackage-name\fR" 4 .IX Item "--control-list package-name" List control files installed to your system from \fIpackage-name\fR (since dpkg 1.16.5). These can be used as input arguments to \fB\-\-control\-show\fR. .IP "\fB\-\-control\-show\fR \fIpackage-name\fR \fIcontrol-file\fR" 4 .IX Item "--control-show package-name control-file" Print the \fIcontrol-file\fR installed to your system from \fIpackage-name\fR to the standard output (since dpkg 1.16.5). .IP "\fB\-c\fR, \fB\-\-control\-path\fR \fIpackage-name\fR [\fIcontrol-file\fR]" 4 .IX Item "-c, --control-path package-name [control-file]" List paths for control files installed to your system from \fIpackage-name\fR (since dpkg 1.15.4). If \fIcontrol-file\fR is specified then only list the path for that control file if it is present. .Sp \&\fBWarning\fR: this command is deprecated as it gives direct access to the internal dpkg database, please switch to use \fB\-\-control\-list\fR and \&\fB\-\-control\-show\fR instead for all cases where those commands might give the same end result. Although, as long as there is still at least one case where this command is needed (i.e. when having to remove a damaging postrm maintainer script), and while there is no good solution for that, this command will not get removed. .IP "\fB\-S\fR, \fB\-\-search\fR \fIfilename-search-pattern\fR..." 4 .IX Item "-S, --search filename-search-pattern..." Search for packages that own files corresponding to the given patterns. Standard shell wildcard characters can be used in the pattern, where asterisk (\fB*\fR) and question mark (\fB?\fR) will match a slash, and backslash (\fB\e\fR) will be used as an escape character. .Sp If the first character in the \fIfilename-search-pattern\fR is none of \(oq\fB*[?/\fR\(cq then it will be considered a substring match and will be implicitly surrounded by \(oq\fB*\fR\(cq (as in \&\fB*\fR\fIfilename-search-pattern\fR\fB*\fR). If the subsequent string contains any of \(oq\fB*[?\e\fR\(cq, then it will handled like a glob pattern, otherwise any trailing \(oq\fB/\fR\(cq or \(oq\fB/.\fR\(cq will be removed and a literal path lookup will be performed. .Sp This command will not list extra files created by maintainer scripts, nor will it list alternatives. .Sp The output format consists of one line per matching pattern, with a list of packages owning the pathname separated by a comma (U+002C \(oq\fB,\fR\(cq) and a space (U+0020 \(oq\fB \fR\(cq), followed by a colon (U+003A \(oq\fB:\fR\(cq) and a space, followed by the pathname. As in: .Sp .Vb 2 \& pkgname1, pkgname2: pathname1 \& pkgname3: pathname2 .Ve .Sp File diversions are printed with the following localized strings: .Sp diversion by \fIpkgname\fR from: \fIdiverted-from\fR diversion by \fIpkgname\fR to: \fIdiverted-to\fR .Sp or for local diversions: .Sp local diversion from: \fIdiverted-from\fR local diversion to: \fIdiverted-to\fR .Sp \&\fBHint\fR: When machine parsing the output, it is customary to set the locale to \&\fBC.UTF\-8\fR to get reproducible results. .IP "\fB\-p\fR, \fB\-\-print\-avail\fR [\fIpackage-name\fR...]" 4 .IX Item "-p, --print-avail [package-name...]" Display details about packages, as found in \fI/var/lib/dpkg/available\fR. If no \fIpackage-name\fR is specified, it will display all package entries in the \fIavailable\fR database (since dpkg 1.19.1). When multiple \fIpackage-name\fR are listed, the requested \fIavailable\fR entries are separated by an empty line, with the same order as specified on the argument list. .Sp Users of APT-based frontends should use \fBapt show\fR \fIpackage-name\fR instead as the \fIavailable\fR file is only kept up-to-date when using \fBdselect\fR. .IP "\fB\-?\fR, \fB\-\-help\fR" 4 .IX Item "-?, --help" Show the usage message and exit. .IP \fB\-\-version\fR 4 .IX Item "--version" Show the version and exit. .SH OPTIONS .IX Header "OPTIONS" .IP \fB\-\-admindir=\fR\fIdir\fR 4 .IX Item "--admindir=dir" Change the location of the \fBdpkg\fR database. The default location is \&\fI/var/lib/dpkg\fR. .IP \fB\-\-root=\fR\fIdirectory\fR 4 .IX Item "--root=directory" Set the root directory to \fIdirectory\fR, which sets the administrative directory to \(Fo\fIdirectory\fR/var/lib/dpkg\(Fc (since dpkg 1.21.0). .IP \fB\-\-load\-avail\fR 4 .IX Item "--load-avail" Also load the available file when using the \fB\-\-show\fR and \fB\-\-list\fR commands, which now default to only querying the status file (since dpkg 1.16.2). .IP \fB\-\-no\-pager\fR 4 .IX Item "--no-pager" Disables the use of any pager when showing information (since dpkg 1.19.2). .IP "\fB\-f\fR, \fB\-\-showformat=\fR\fIformat\fR" 4 .IX Item "-f, --showformat=format" This option is used to specify the format of the output \fB\-\-show\fR will produce (short option since dpkg 1.13.1). The format is a string that will be output for each package listed. .Sp In the format string, \(lq\fB\e\fR\(rq introduces escapes: .RS 4 .IP "\fB\en\fR newline" 4 .IX Item "n newline" .PD 0 .IP "\fB\er\fR carriage return" 4 .IX Item "r carriage return" .IP "\fB\et\fR tab" 4 .IX Item "t tab" .RE .RS 4 .PD .Sp \(lq\fB\e\fR\(rq before any other character suppresses any special meaning of the following character, which is useful for \(lq\fB\e\fR\(rq and \(lq\fB$\fR\(rq. .Sp Package information can be included by inserting variable references to package fields using the syntax \(lq\fB${\fR\fIfield\fR[\fB;\fR\fIwidth\fR]\fB}\fR\(rq. Fields are printed right-aligned unless the width is negative in which case left alignment will be used. The following \fIfield\fRs are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it): .IP \fBArchitecture\fR 4 .IX Item "Architecture" .PD 0 .IP \fBBugs\fR 4 .IX Item "Bugs" .IP "\fBConffiles\fR (internal)" 4 .IX Item "Conffiles (internal)" .IP "\fBConfig-Version\fR (internal)" 4 .IX Item "Config-Version (internal)" .IP \fBConflicts\fR 4 .IX Item "Conflicts" .IP \fBBreaks\fR 4 .IX Item "Breaks" .IP \fBDepends\fR 4 .IX Item "Depends" .IP \fBDescription\fR 4 .IX Item "Description" .IP \fBEnhances\fR 4 .IX Item "Enhances" .IP \fBProtected\fR 4 .IX Item "Protected" .IP \fBEssential\fR 4 .IX Item "Essential" .IP "\fBFilename\fR (internal, front-end related)" 4 .IX Item "Filename (internal, front-end related)" .IP \fBHomepage\fR 4 .IX Item "Homepage" .IP \fBInstalled-Size\fR 4 .IX Item "Installed-Size" .IP "\fBMD5sum\fR (internal, front-end related)" 4 .IX Item "MD5sum (internal, front-end related)" .IP "\fBMSDOS-Filename\fR (internal, front-end related)" 4 .IX Item "MSDOS-Filename (internal, front-end related)" .IP \fBMaintainer\fR 4 .IX Item "Maintainer" .IP \fBOrigin\fR 4 .IX Item "Origin" .IP \fBPackage\fR 4 .IX Item "Package" .IP \fBPre-Depends\fR 4 .IX Item "Pre-Depends" .IP \fBPriority\fR 4 .IX Item "Priority" .IP \fBProvides\fR 4 .IX Item "Provides" .IP \fBRecommends\fR 4 .IX Item "Recommends" .IP \fBReplaces\fR 4 .IX Item "Replaces" .IP "\fBRevision\fR (obsolete)" 4 .IX Item "Revision (obsolete)" .IP \fBSection\fR 4 .IX Item "Section" .IP "\fBSize\fR (internal, front-end related)" 4 .IX Item "Size (internal, front-end related)" .IP \fBSource\fR 4 .IX Item "Source" .IP "\fBStatus\fR (internal)" 4 .IX Item "Status (internal)" .IP \fBSuggests\fR 4 .IX Item "Suggests" .IP "\fBTag\fR (usually not in .deb but in repository Packages files)" 4 .IX Item "Tag (usually not in .deb but in repository Packages files)" .IP "\fBTriggers-Awaited\fR (internal)" 4 .IX Item "Triggers-Awaited (internal)" .IP "\fBTriggers-Pending\fR (internal)" 4 .IX Item "Triggers-Pending (internal)" .IP \fBVersion\fR 4 .IX Item "Version" .RE .RS 4 .PD .Sp The following are virtual fields, generated by \fBdpkg-query\fR from values from other fields (note that these do not use valid names for fields in control files): .IP \fBbinary:Package\fR 4 .IX Item "binary:Package" It contains the binary package name with a possible architecture qualifier like \(lqlibc6:amd64\(rq (since dpkg 1.16.2). An architecture qualifier will be present to make the package name unambiguous, for packages with a \fBMulti-Arch\fR field with the value \fBsame\fR or with a foreign architecture, which is an architecture that is neither the native one nor \fBall\fR. .IP \fBbinary:Synopsis\fR 4 .IX Item "binary:Synopsis" It contains the package short description (since dpkg 1.19.1). .IP \fBbinary:Summary\fR 4 .IX Item "binary:Summary" This is an alias for \fBbinary:Synopsis\fR (since dpkg 1.16.2). .IP \fBdb:Status\-Abbrev\fR 4 .IX Item "db:Status-Abbrev" It contains the abbreviated package status (as three characters), such as \(lqii \(rq or \(lqiHR\(rq (since dpkg 1.16.2). See the \fB\-\-list\fR command description for more details. .IP \fBdb:Status\-Want\fR 4 .IX Item "db:Status-Want" It contains the package wanted status, part of the Status field (since dpkg 1.17.11). .IP \fBdb:Status\-Status\fR 4 .IX Item "db:Status-Status" It contains the package status word, part of the Status field (since dpkg 1.17.11). .IP \fBdb:Status\-Eflag\fR 4 .IX Item "db:Status-Eflag" It contains the package status error flag, part of the Status field (since dpkg 1.17.11). .IP \fBdb\-fsys:Files\fR 4 .IX Item "db-fsys:Files" It contains the list of the package filesystem entries separated by newlines (since dpkg 1.19.3). .IP \fBdb\-fsys:Last\-Modified\fR 4 .IX Item "db-fsys:Last-Modified" It contains the timestamp in seconds of the last time the package filesystem entries were modified (since dpkg 1.19.3). .IP \fBsource:Package\fR 4 .IX Item "source:Package" It contains the source package name for this binary package (since dpkg 1.16.2). .IP \fBsource:Version\fR 4 .IX Item "source:Version" It contains the source package version for this binary package (since dpkg 1.16.2) .IP \fBsource:Upstream\-Version\fR 4 .IX Item "source:Upstream-Version" It contains the source package upstream version for this binary package (since dpkg 1.18.16) .RE .RS 4 .Sp The default format string is \(lq\fB${binary:Package}\et${Version}\en\fR\(rq. Actually, all other fields found in the status file (i.e. user defined fields) can be requested, too. They will be printed as-is, though, no conversion nor error checking is done on them. To get the name of the \&\fBdpkg\fR maintainer and the installed version, you could run: .Sp .Vb 2 \& dpkg\-query \-f=\*(Aq${binary:Package} ${Version}\et${Maintainer}\en\*(Aq \e \& \-W dpkg .Ve .RE .RS 4 .RE .SH "EXIT STATUS" .IX Header "EXIT STATUS" .IP \fB0\fR 4 .IX Item "0" The requested query was successfully performed. .IP \fB1\fR 4 .IX Item "1" The requested query failed either fully or partially, due to no file or package being found (except for \fB\-\-control\-path\fR, \&\fB\-\-control\-list\fR and \fB\-\-control\-show\fR were such errors are fatal). .IP \fB2\fR 4 .IX Item "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. .SH ENVIRONMENT .IX Header "ENVIRONMENT" .SS "External environment" .IX Subsection "External environment" .IP \fBSHELL\fR 4 .IX Item "SHELL" Sets the program to execute when spawning a command via a shell (since dpkg 1.19.2). .IP \fBPAGER\fR 4 .IX Item "PAGER" .PD 0 .IP \fBDPKG_PAGER\fR 4 .IX Item "DPKG_PAGER" .PD Sets the pager command to use (since dpkg 1.19.1), which will be executed with \(Fo\fR\f(CB$SHELL\fR\fB \-c\fR\(Fc. If \fBSHELL\fR is not set, \(Fo\fBsh\fR\(Fc will be used instead. The \fBDPKG_PAGER\fR overrides the \fBPAGER\fR environment variable (since dpkg 1.19.2). .IP \fBDPKG_ROOT\fR 4 .IX Item "DPKG_ROOT" If set and the \fB\-\-root\fR option has not been specified, it will be used as the filesystem root directory (since dpkg 1.21.0). .IP \fBDPKG_ADMINDIR\fR 4 .IX Item "DPKG_ADMINDIR" If set and the \fB\-\-admindir\fR option has not been specified, it will be used as the \fBdpkg\fR data directory. .IP \fBDPKG_DEBUG\fR 4 .IX Item "DPKG_DEBUG" Sets the debug mask (since dpkg 1.21.10) from an octal value. The currently accepted flags are described in the \fBdpkg \-\-debug\fR option, but not all these flags might have an effect on this program. .IP \fBDPKG_COLORS\fR 4 .IX Item "DPKG_COLORS" Sets the color mode (since dpkg 1.18.5). The currently accepted values are: \fBauto\fR (default), \fBalways\fR and \&\fBnever\fR. .SS "Internal environment" .IX Subsection "Internal environment" .IP \fBLESS\fR 4 .IX Item "LESS" Defined by \fBdpkg-query\fR to \(lq\fB\-FRSXMQ\fR\(rq, if not already set, when spawning a pager (since dpkg 1.19.2). To change the default behavior, this variable can be preset to some other value including an empty string, or the \fBPAGER\fR or \fBDPKG_PAGER\fR variables can be set to disable specific options with \(Fo\fB\-+\fR\(Fc, for example \fBDPKG_PAGER="less \-+F"\fR. .SH SECURITY .IX Header "SECURITY" Query operations should never require root, and delegating their execution to unprivileged users via some gain-root command can have security implications (such as privilege escalation), for example when a pager is automatically invoked by the tool. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBdpkg\fR\|(1).