dpkg-query

Query tool for software packages in Debian Linux

Supplementary instructions

dpkg-query command is a query tool for software packages in Debian Linux. It queries and identifies software package information from the dpkg package database.

grammar

dpkg-query(options)(parameters)

Options

-l: List software packages matching the matching pattern;
-s: Query the status information of the software package;
-L: Display the list of files installed by the software package;
-S: Query files from installed software packages;
-w: Display software package information;
-c: Display the control file path of the software package;
-p: Display package details.

Parameters

Software package name: Specify the software package to be queried.

Example

Find which package file file1 is installed in:

dpkg-query -S file1

List the software installed under ubuntu:

dpkg-query -W --showformat='${Package} ${Version}\n' > filename

View package details:

dpkg-query -s capistrano

View the list of files installed to the system during package installation:

dpkg-query -L capistrano

List all installed packages:

dpkg-query-l

View the exact status of a package (installed or not) and version number:

dpkg-query -W -f='${Status} ${Version}\n' apache-perl