LinuxCommandLibrary

dpkg-query

TLDR

List all installed packages

$ dpkg-query -l
copy
List packages matching pattern
$ dpkg-query -l '[libc6*]'
copy
List files installed by a package
$ dpkg-query -L [libc6]
copy
Show package information
$ dpkg-query -s [libc6]
copy
Search for packages owning files
$ dpkg-query -S [/etc/ld.so.conf.d]
copy

SYNOPSIS

dpkg-query action [options] [pattern|package]

DESCRIPTION

dpkg-query queries the dpkg database for information about installed packages. It can list packages, show their status, list files they contain, or find which package owns a file.

PARAMETERS

-l, --list [pattern]

List packages matching pattern
-L, --listfiles package
List files installed by package
-s, --status package
Show package status and information
-S, --search pattern
Find packages owning files matching pattern
-W, --show package
Show package in specified format
-f, --showformat format
Custom output format

CAVEATS

Only queries installed packages, not repositories. Pattern uses shell glob syntax, not regex. Part of dpkg package.

SEE ALSO

dpkg(1), apt-cache(8), dpkg-deb(1)

Copied to clipboard