equery Command: Tutorial & Examples
The equery
command is a versatile utility provided by the Gentoo Linux distribution's Portage package management system. It is part of
the app-portage/gentoolkit
package and is used for querying various aspects of installed packages and the Portage tree. equery
makes it easy to get detailed
information about packages, dependencies, and use flags, among other things.
What Does equery
Do?
The equery
command provides detailed information about Gentoo packages. It allows users to:
- Check which files belong to a package.
- Find out which package owns a specific file.
- View package dependencies.
- See USE flags.
- Obtain package descriptions and homepages.
This command is particularly useful for system administrators and users who need to manage and troubleshoot packages on their Gentoo systems.
How equery
Works
When you run the equery
command, it interacts with the Portage tree and the installed package database to retrieve the requested information. It formats this
data in a human-readable way, making package management tasks more straightforward.
Why equery
is Important
For Gentoo users, equery
is an essential tool because it simplifies the process of managing and troubleshooting packages. Knowing which files belong to which
packages, understanding dependencies, and inspecting USE flags can save a lot of time and effort, especially when resolving issues
like high load or package conflicts.
How to Use equery
and Common Command-Line Parameters
To use equery
, you need to have the gentoolkit
package installed. You can install it using the following command:
emerge app-portage/gentoolkit
Here are some common equery
subcommands and their uses:
equery list <package>
: Lists all installed versions of a package.equery files <package>
: Lists files installed by a package.equery belongs <file>
: Finds which package owns a file.equery depgraph <package>
: Displays dependency graph for a package.equery uses <package>
: Shows USE flags for a package.equery meta <package>
: Displays metadata for a package.
Examples
Listing Installed Versions of a Package
equery list vim
Typical output:
* Searching for vim ...
[IP-] [ ] app-editors/vim-8.2.2434:0
Listing Files Installed by a Package
equery files vim
Typical output:
* Contents of app-editors/vim-8.2.2434:
/usr /usr/bin /usr/bin/vim ...
Finding Which Package Owns a File
equery belongs /usr/bin/vim
Typical output:
* Searching for /usr/bin/vim ...
app-editors/vim-8.2.2434 (/usr/bin/vim)
Potential Problems and Pitfalls
While equery
is a powerful tool, there are a few common issues you might encounter:
- Permission Denied: Running
equery
without the necessary permissions might result in errors. Usesudo
to run the command as root. - Outdated Database: Ensure your Portage tree is up to date by running
emerge --sync
before usingequery
for accurate results. - Missing gentoolkit: If
equery
is not found, make suregentoolkit
is installed usingemerge app-portage/gentoolkit
.
Conclusion
The equery
command is an indispensable tool for managing packages on Gentoo Linux. By mastering equery
, you can efficiently query package information,
troubleshoot issues, and ensure your system runs smoothly.