dpkg-query
query dpkg database information
TLDR
List all installed packages
SYNOPSIS
dpkg-query action [options] [pattern|package]
DESCRIPTION
dpkg-query queries the dpkg database for information about installed packages on Debian-based systems. It provides a read-only interface to the package database, allowing you to search for packages, inspect their metadata, and determine file ownership.
The tool is essential for system administration tasks like verifying package installations, troubleshooting file conflicts, and generating package inventories. Unlike dpkg itself, dpkg-query only reads information and never modifies the package database, making it safe to use without elevated privileges.
Its custom output formatting capabilities make it particularly useful in scripts and automation workflows.
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.
