Important: You are required to change your passwords used for Gentoo services and set an email address for your Wiki account if you haven't done so. See the full announcement and Wiki email policy change for more information.

Gentoo Cheat Sheet

From Gentoo Wiki
Jump to: navigation, search
This article is a stub. You can help Gentoo Wiki by expanding it.

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

Portage Package Management

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

root # emerge --sync

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

root # emerge-webrsync

Sync the overlay and Portage tree using eix:

root # eix-sync

List what packages would be installed without installing them:

root # emerge -pv cat/pkg

Install a specific version of a package:

root # emerge =cat/pkg-1.0

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

root # emerge -cav cat/pkg

Remove a package but not its dependencies:

root # emerge -C cat/pkg

Check for and rebuild missing libraries

root # revdep-rebuild -v

Remove no longer needed packages:

root # emerge -av --depclean

Upgrade the selected packages, dependencies and deep dependencies that are outdated or have USE flag changes:

root # emerge -uDN world

equery is a collection of modules for querying the state of Gentoo packages, files and USE flags.

root # man equery

Tell which installed package provides a command.

user $ equery b `which vim`

Tell which packages depend on cat/pkg:

user $ equery d cat/pkg

Get information about a package using eix:

root # eix cat/pkg

A graphical user interface to use with the Portage tree:

root # porthole

Manage configuration changes after an emerge completes:

root # dispatch-conf

After installations / updates

Rebuilds packages that depend on an recently updated library:

root # revdep-rebuild

After updating Perl-core packages:

root # perl-cleaner --all

After updating python core packages:

root # python-updater


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

root # man genlop

To view last 10 merges, run

root # genlop -l | tail -n 10

To view how long merging openoffice took

root # genlop -t openoffice

To estimate how much 'emerge -uU world' will take

root # emerge -pU world | genlop --pretend

Have a console watching the latest merging ebuild during upgrade

root # watch genlop -unc

USE flags

Obtain descriptions and usage of the USE flag X:

user $ euse -i X

Obtain a description of the png USE flag:

user $ euse -i | grep png

Show what packages have mysql use flag option:

user $ equery hasuse mysql

Show what use flags are available for a specific package:

user $ equery uses <package-name>

Quickly add a required USE flag for a package install

root # echo 'dev-util/cmake -qt4' >> /etc/portage/package.use

Typical Administration

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

user $ sudo -s

Start the ssh daemon in the default runlevel at boot:

root # rc-update add sshd default

Start the xdm service now:

root # rc-service xdm start

Check if the sshd service is running or not:

root # rc-status sshd

Important Files

  • /etc/portage/make.conf: Global settings (USE flags, compiler options)
  • /etc/portage/package.use: USE flags of individual packages
  • /etc/portage/package.accept_keywords: Keyword individual packages; e.g. ~amd64, ~x86, or ∼arm
  • /etc/portage/package.license: Accepted licenses
  • /var/lib/portage/world: List of explicitly installed package atoms
  • /var/db/pkg: Contains for every installed package a set of files about the installation

External resources