pacman-query
Query package information from the Arch Linux database
TLDR
[Q]uery the local package database and list installed packages and versions
List only packages and versions that were [e]xplicitly installed
Find which package [o]wns a file
Display information about an [i]nstalled package
Display the [l]ist of files owned by a specific package
List orphan packages (installed as [d]ependencies but unrequired ([t]) by any package and print in [q]uiet mode (only package name is displayed))
List installed packages foreign ([m]) to the repository database
List packages that can be [u]pgraded
SYNOPSIS
pacman-query [options] [package(s)]
Equivalent to: pacman -Q [options] [package(s)]
PARAMETERS
-q, --quiet
Show less information for certain query operations, suppressing non-essential output.
-i, --info
Display package information such as version, description, build date, installed size, dependencies, and conflicts.
-l, --list
List all files owned by a specified package. Can be combined with --recursive to show files for dependencies.
-o, --owns
Identify the package that owns the specified file. Useful for troubleshooting file ownership.
-s, --search
Search for installed packages matching the provided regular expression or string in their names and descriptions.
-f, --files
List files owned by a package based on the local database, or query information from a specified package file (.pkg.tar.zst) directly.
-k, --check
Check the local package database for integrity issues, such as missing files from installed packages.
-e, --explicit
List explicitly installed packages, i.e., those not installed as dependencies of other packages.
-d, --deps
List packages installed as dependencies of other explicitly installed packages.
-t, --unrequired
List packages that are unrequired by any other package; often used to find orphaned packages.
-u, --upgrades
List all packages that are outdated and have newer versions available in configured repositories.
-p, --file
Query information from a package file (.pkg.tar.zst) instead of the local database, useful for inspecting downloaded packages.
-g, --groups
List all packages belonging to a specified group, such as 'base-devel'.
-a, --all
List all installed packages. When used with -Q, it provides a comprehensive list of every package on the system.
--foreign
List all foreign packages, meaning those not found in any of the configured sync databases (e.g., packages installed from AUR).
--native
List all native packages, meaning those installed from the official Arch Linux repositories.
--tree
Show the dependency tree for specified packages, illustrating how they depend on other packages.
DESCRIPTION
The pacman-query command, which typically refers to the query operations of the pacman package manager (primarily via `pacman -Q`), allows users to inspect locally installed packages and their attributes. It provides a comprehensive set of options for retrieving information about packages, such as their version, size, dependencies, files they own, and installation status. Unlike other pacman operations like installation or removal, pacman-query (or `pacman -Q`) does not modify the system; it solely acts as an information retrieval tool. This command is crucial for system administration tasks, including verifying package integrity, listing package contents, identifying orphaned packages, and searching for specific software.
CAVEATS
The command pacman-query is not a standard executable found in a typical Arch Linux installation. The functionality it implies, which is querying installed packages, is universally provided by the command pacman -Q. Users should primarily rely on pacman -Q for these operations. This command is specific to Arch Linux and its derivatives (e.g., Manjaro, EndeavourOS) and is not available on other Linux distributions that use different package managers (e.g., Debian/Ubuntu with apt, Fedora with dnf/rpm).
<I>USAGE CONTEXT</I>
This command is an essential tool for system auditing, troubleshooting, and verifying installed software on Arch Linux systems. It helps administrators and users understand their system's software landscape without altering its state, making it a safe command to run for informational purposes.
<I>DATABASE INTERACTION</I>
The command primarily interacts with the local package database, typically located at /var/lib/pacman/local. This means it can provide comprehensive information about installed packages even without an active internet connection, as it relies on locally cached metadata rather than live repository data for most operations.
HISTORY
The pacman package manager was initially developed by Judd Vinet for Arch Linux, with its first release in 2002. From its inception, robust querying capabilities have been a fundamental part of pacman's design, enabling users to easily inspect their installed software. The -Q flag for querying has been a consistent and central feature, evolving with new options to provide more granular control over package information retrieval as pacman itself has matured. While a dedicated 'pacman-query' command is not standard, the querying functionality of pacman has always been a core strength.