gentoolkit is a collection of command-line utilities that makes administering a Gentoo system—especially Portage—much easier. It supplements commands such as emerge, eselect, and emaint with tools for inspecting packages, dependencies, USE flags, installed files, and caches.
Install it with:
The most useful tool is usually equery. Think of it as a package-database inspection tool.
For example, find which package owns a file:
or shorter:
See every file installed by a package:
or:
This is particularly useful when you're wondering, "Where did this file come from?"
You can inspect dependencies:
And the reverse question—what installed packages depend on something:
Another extremely useful command is:
For example:
This displays the package's USE flags and helps explain why particular functionality or dependencies are being enabled. Since you've been working with Gentoo USE-flag dependency changes, this is one of the gentoolkit commands worth learning well.
euse works specifically with USE flags. For example:
You can search for USE flags:
And euse can enable or disable USE flags without manually editing make.conf.
eclean handles cleanup. Gentoo's /var/cache/distfiles can accumulate old source archives over time. You can inspect what could be removed first:
Then clean:
For old binary packages:
followed by:
Gentoo specifically documents eclean for cleaning old source files and binary packages.
Another famous gentoolkit command is:
It searches for programs with broken library dependencies and can rebuild affected packages. However, this command isn't something you normally need to run after every update anymore. Gentoo notes that Portage's preserve-libs feature made its original routine use largely unnecessary; it's now mainly useful in particular ABI/library-change situations.
A practical starter set I'd memorize is:
The conceptual distinction is:
Portage/emerge manages packages; gentoolkit helps you investigate and maintain what Portage is doing.
For troubleshooting Gentoo dependency and USE-flag problems, equery is probably the most valuable part of gentoolkit.