LinuxCommandLibrary

pacman-q

Query installed packages

TLDR

View documentation for the original command

$ tldr pacman query
copy

SYNOPSIS

pacman -Q [-options] [package(s)]
pacman -Q [-q] [-e | -d | -t | -u]
pacman -Q [-l | -k | -s | -i] [package(s)]
pacman -Qo file

PARAMETERS

-Q, --query
    The main subcommand to query the package database. Used without further options, it lists all installed packages and their versions.

-q, --quiet
    Suppress all output messages except the requested information. Often used with -Q to get a clean list of package names, e.g., pacman -Qq.

-e, --explicit
    List only explicitly installed packages (not dependencies).

-d, --deps
    List only implicitly installed packages (dependencies).

-t, --unrequired
    List packages that are not required by any other installed package.

-u, --unowned
    List files in the filesystem not owned by any package.

-l, --list <package>
    List all files owned by the specified package(s).

-k, --check <package>
    Check specified package(s) for missing or modified files. Use -kk for a more thorough check (file checksums).

-o, --owns <file>
    Show which package owns the specified file. Useful for identifying the source of a particular file.

-s, --search <regex>
    Search for installed packages matching the given regular expression.

-i, --info <package>
    Display detailed information about the specified package(s), including version, size, dependencies, and description.

-p, --file <package_file>
    Query a local package file (not yet installed) for information.

DESCRIPTION

The command pacman -Q is the query subcommand for pacman, the Arch Linux package manager. While pacman-q is not a standalone command, it often refers to common usage of pacman -Q combined with the -q or --quiet option.

The primary function of pacman -Q is to interact with and retrieve information about packages installed on the system. It can list all installed packages, display detailed information about a specific package, verify package integrity, list files owned by a package, or determine which package owns a particular file. When the -q (quiet) option is used, pacman -Q minimizes output by showing only the requested information, suppressing non-essential messages like progress bars or status updates, making it suitable for scripting or when a clean, raw list of package names is desired. It is an essential tool for system administrators and users to inspect their installed software.

CAVEATS

This command is specific to Arch Linux and its derivatives (e.g., Manjaro). It will not work on systems using other package managers like APT (Debian/Ubuntu), DNF (Fedora/RHEL), or Zypper (openSUSE). While most query operations do not require root privileges, querying local package files (-p) or checking file ownership (-o) often do not, but system-wide integrity checks (-k) might benefit from them.

COMMON USAGE EXAMPLES

pacman -Q
    List all installed packages.

pacman -Qq
    List all installed packages in quiet mode (only names and versions).

pacman -Qqe
    List all explicitly installed packages in quiet mode.

pacman -Qi bash
    Show detailed information about the 'bash' package.

pacman -Ql pacman
    List all files owned by the 'pacman' package.

pacman -Qo /usr/bin/ls
    Identify which package owns the '/usr/bin/ls' file.

HISTORY

pacman (Package Manager) was created by Judd Vinet, the founder of Arch Linux, and first released in 2002. It was designed from the ground up to be simple, fast, and robust, aligning with Arch Linux's 'KISS' (Keep It Simple, Stupid) philosophy. The query functionality, including the -Q subcommand, has been a core part of pacman since its early versions, providing users with essential tools for inspecting and managing their installed software without unnecessary complexity. Its continuous development by the Arch Linux community has ensured its relevance and efficiency.

SEE ALSO

pacman(8), pacman-S(8), pacman-R(8), pacman-U(8), makepkg(8)

Copied to clipboard