LinuxCommandLibrary

xbps-query

Query available or installed packages

TLDR

Search for a package in remote repositories using a regex or a keyword (if --regex is omitted)

$ xbps-query [[-s|--search]] [regex|keyword] --repository --regex
copy

Show information about an installed package
$ xbps-query [[-S|--show]] [package]
copy

Show information about a package in remote repositories
$ xbps-query [[-S|--show]] [package] --repository
copy

List packages registered in the package database
$ xbps-query [[-l|--list-pkgs]]
copy

List explicitly installed packages (i.e. not automatically installed as dependencies)
$ xbps-query [[-m|--list-manual-pkgs]]
copy

SYNOPSIS

xbps-query [options] [package_name]

PARAMETERS

-l, --list
    List all installed packages on the system.
Example: xbps-query -l

-s pattern, --search pattern
    Search installed packages whose name or description matches the specified pattern. Case-insensitive by default.
Example: xbps-query -s firefox

-S pattern, --search-remote pattern
    Search for packages in the configured remote repositories whose name or description matches the specified pattern.
Example: xbps-query -S gcc

-i pkgname, --info pkgname
    Display detailed information about a specified pkgname, including version, architecture, dependencies, and more.
Example: xbps-query -i vim

-o, --orphans
    List all installed packages that are considered 'orphaned' (not explicitly installed by the user and no longer a dependency of another installed package).

-f pkgname, --files pkgname
    List all files installed by the specified pkgname.
Example: xbps-query -f bash

-d pkgname, --deps pkgname
    Show the direct runtime dependencies of the specified pkgname.
Example: xbps-query -d openssl

-t pkgname, --transitive-deps pkgname
    Show all transitive (recursive) runtime dependencies of the specified pkgname.
Example: xbps-query -t systemd

-w file, --what-provides file
    Determine which installed package provides the specified file.
Example: xbps-query -w /bin/ls

-x pattern, --regex pattern
    Treat the search pattern as a regular expression. Can be combined with -s or -S.
Example: xbps-query -Sx '^lib[a-z]+-dev$'

-R, --repository
    Operate in repository mode. Often used with -S to specify that the search should be performed against remote repositories.

-r rootdir, --rootdir rootdir
    Specify an alternative root directory for package operations (useful for chroot environments).

-C configfile, --config configfile
    Specify an alternative configuration file for XBPS instead of the default.

-p prop, --property prop
    Display a specific property of a package, e.g., 'version', 'architecture', 'size'.
Example: xbps-query -p version bash

-v, --verbose
    Enable verbose output, providing more detailed information during the query.

-h, --help
    Display a help message with available options.

-V, --version
    Show the XBPS version information.

DESCRIPTION

xbps-query is a powerful command-line utility within the XBPS (X Binary Package System) suite, primarily used on Void Linux. It enables users to retrieve extensive information about installed packages, available packages in configured repositories, package dependencies, contained files, and various package properties. This command is an essential tool for system administrators and users to understand, manage, and troubleshoot their software installations, providing detailed metadata without requiring network access for local queries, and offering comprehensive search capabilities for remote repositories.

CAVEATS

xbps-query is an integral part of the XBPS package manager and is therefore specific to systems that use XBPS, most notably Void Linux. Its functionality depends on the integrity of the local package database and the availability of configured remote repositories for network-based queries. Queries for remote packages require an active internet connection and correctly configured repository URLs in /etc/xbps.d/ or via the -C option.

COMBINED FLAGS

Many flags can be combined for more specific queries. For instance, -Rs performs a remote search and displays full information for matching packages, while -Rx allows remote regex search. This flexibility makes xbps-query a very versatile tool for package investigation.

QUERYING PACKAGE PROPERTIES

The -p option is incredibly powerful for scripting or obtaining specific metadata. You can query properties like 'maintainer', 'shlib-provides', 'shlib-requires', 'homepage', and more, allowing for fine-grained information retrieval about any package.

DATABASE CORRUPTION

If the local XBPS package database becomes corrupted (e.g., due to system crashes during package operations), xbps-query may return inaccurate results or errors. In such cases, xbps-pkgdb -a can often be used to fix common database inconsistencies.

HISTORY

xbps-query is a core component of the X Binary Package System (XBPS), which was created by Juan RP (Runar Kristiansen) in 2008. XBPS was designed from the ground up to be a simple, fast, and robust package manager for Unix-like systems, emphasizing simplicity and performance. It became the default package manager for Void Linux in 2013, contributing significantly to the distribution's reputation for speed and efficiency. The command's development has been closely tied to the evolution of Void Linux, continually improving its querying capabilities and integration with the wider XBPS ecosystem.

SEE ALSO

xbps(8), xbps-install(8), xbps-remove(8), xbps-pkgdb(8), xbps-src(8), xbps.d(5)

Copied to clipboard