Gentoo Cheat Sheet

This is a reference card of useful commands for administrating Gentoo.

Portage Tree Sync Methods
Sync the Portage tree using the mirrors by fetching the latest differences:

Sync the Portage tree using the mirrors by obtaining a Portage snapshot that is at most a day old:

Sync local overlays and the Portage tree using eix.

can be installed by issuing this command:

You can gather more information on eix by reading its manual:

Package Installation and Removal
In the following tips www-client/firefox will be used as an example, simply substitute the package of interest with FireFox to perform the actions on your package.

List what packages would be installed without installing them:

Install a specific version of a package:

Remove a package and the dependencies that no other packages depend on:

Remove a package but not its dependencies:

Remove no longer needed packages:

Package Upgrades
Upgrade all installed packages, dependencies, and deep dependencies that are outdated or have USE flag changes:

Package Troubleshooting
Check for and rebuild missing libraries:

equery is part of. You can obtain it by issuing this command:

Tell which installed package provides a command using equery:

Tell which packages depend on a specific package (cat/pkg in the example) using equery:

Get information about a package using eix:

Portage Enhancements
A graphical user interface to use with the Portage tree:

Manage configuration changes after an emerge completes:

After Installations or Updates
Rebuilds packages that depend on an recently updated library:

After updating perl-core packages:

After updating python core packages:

USE Flag Tips
Obtain descriptions and usage of the USE flag X using euse:

You can gather more information on the euse by reading its manual page:

Obtain a description of the png USE flag:

Show what packages have mysql use flag option:

Show what use flags are available for a specific package:

Quickly add a required USE flag for a package install

Important Portage Files

 * : Global settings (USE flags, compiler options)
 * : USE flags of individual packages
 * : Keyword individual packages; e.g. ~amd64, ~x86, or ∼arm
 * : Accepted licenses
 * : List of explicitly installed package atoms
 * : Contains for every installed package a set of files about the installation

genlop
genlop is a Portage log processor, also estimating build times when emerging packages.

Install genlop by issuing this command:

You can gather more information on by reading its manual page:

View last 10 emerges (installs), run:

View how long emerging OpenOffice took, run:

Estimate how much 'emerge -uND --with-bdeps=y @world' will take, run:

Have a console watching the latest merging ebuild during system upgrades, run:

Typical Administration Tips
Obtain root shell (if the current user is listed in the sudoers list):

Start the ssh daemon in the default runlevel at boot:

Start the xdm service now:

Check if the sshd service is running or not:

Tips From the Gentoo Monthly Newsletter
Search packages in Portage by regular expressions:

Overlays vary from very small to very large in size. As a result they slow down the majority of Portage operations. That happens because overlays do not contain metadata caches. The cache is used to speed up searches and the building of dependency trees. A neat trick is to generate local metadata cache after syncing overlays.

This trick also works in conjunction with eix. can use metadata cache generated by  to speed up things. To enable this, add the following variable to :

Use qcheck to verify installed packages:

qcheck comes with and can be installed by running this command:

You can learn more about qcheck by reading its manual page:

External Resources

 * Original gentoo-cheat repository
 * Forum post about gentoo-cheat
 * Collection of gentoo tips