Gentoo Cheat Sheet

This is Article description::a reference card of useful commands for administrating Gentoo systems. Newcomers and grey beards alike are encouraged to add their helpful tips below.

Sync methods
Sync all repositories that are set to auto-sync including the Gentoo ebuild repository:

Sync the Gentoo ebuild repository using the mirrors by obtaining a snapshot that is (at most) a day old:

Sync custom package repository and the Gentoo ebuild repository using eix:

If there are overlays created by, to sync them:

can be installed by issuing:

can be installed by issuing:

Gather more information on by reading its manual:

Package listings
qlist is provided by

List installed packages with version number and name of used overlay:

To view the list of packages in the world set along with their available versions it is possible to use

You can keep color in the output by calling it with the "color" switch:

Package installation
In the following examples the package will be used, but users can replace it with their package of interest.

List what packages would be installed without installing them:

Install a specific version of a package (Use '\='(backslash and equal sign) if the current shell attaches special meaning to '=' in a command):

Install a package without adding it to the world file:

or

Recommended method
The recommended way to remove a package is by using deselect. This removes it from the @world set (i.e. says the package is no longer wanted). To clean up the system afterwards, run depclean as given below.

And then depclean afterwards (the -p should be removed if after running, it shows will not remove any needed packages):

Separately, to remove a package that no other packages depend on:

As a safety measure, depclean will not remove any packages unless all required dependencies have been resolved. As a consequence of this, it often becomes necessary to run:

Avoid unnecessary rebuilds when USE flags only get added to or dropped from the repository and use the  flag for quicker execution:

Unclean removal (ignoring dependencies)
Remove a package even if it is needed by other packages:

Package upgrades
Upgrade all installed packages, dependencies, and deep dependencies that are outdated or have USE flag changes (avoiding unnecessary rebuilds when USE changes have no impact):

Package troubleshooting
Check for and rebuild missing libraries (not normally needed):

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

Tell which installed package provides a command using equery:

Tell which (not) installed package provides a command using e-file:

Install e-file with:

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

Get information about a package using eix:

Portage enhancements
Manage configuration changes after an emerge completes:

Or alternatively:

After installations or updates
After updating perl-core packages:

or if previous didn't help:

For haskell packages:

USE flags
Obtain descriptions and usage of the USE flag  using euse:

Gather more information on by reading its manual page:

Obtain a description of the  USE flag:

Show what packages have the  USE flag:

Show what packages are currently built with the  USE flag:

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. Can also be a folder containing multiple files.
 * - Keyword individual packages; e.g., , or.
 * - Accepted licenses
 * - List of explicitly installed package atoms.
 * - Contains information 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 by issuing:

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

View the last 10 emerges (installs):

View how long emerging LibreOffice took:

Estimate how long will take:

Watch the latest merging ebuild during system upgrades:

eselect repository
can be installed by issuing:

List all existing overlays:

List all installed overlays:

See also Eselect/Repository

Layman
can be installed by issuing:

List all existing overlays:

List all installed overlays:

See also Layman

Services
Obtain root shell (if the current user is listed in the sudoers list):

OpenRC
Start the ssh daemon in the default runlevel at boot:

Start the sshd service now:

Check if the sshd service is running:

systemd
Start the ssh daemon at boot:

Start the sshd service now:

Check if the sshd service is running:

Gentoo Monthly Newsletter (GMN)
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 :

qcheck
Use to verify installed packages:

comes with and can be installed by running this command:

Learn more about by reading its manual page:

External resources

 * Original gentoo-cheat repository
 * Forum post about gentoo-cheat
 * Another Gentoo cheat sheet
 * Collection of Gentoo tips
 * Newbie cheat sheet