Gentoo, portage cheat sheet.

While there is a perfectly good cheat sheet here to be honest I tend to blog as much as an aide-mémoire for myself so I’ve made my own notes and condensed it down to what I find most useful, hopefully it should be also useful for others!

Update the package db

emerge --sync

This will update all the meta information allowing the system to see if there are updated packages available compared to what you have installed

Actually updating the system

emerge --ask --update --deep --with-bdeps=y --newuse @world

Almost every occasion you use emerge always use the ––ask parameter this will do a dry run and ask if this is what’s intended, take for example this

emerge --ask glut

This would go ahead and install a load of haskel packages (something you might not have intended) as glut appears as part of dev-haskell section of packages, contrast this with

emerge --ask freeglut

and you see a different picture – and this is a minor foobar compared to what you could do by blindly running emerge

back to the update command, all the stuff you ask to be installed is recorded in the “world package set”, so updating this with a deep dependency check while also including any new USE flags, should comprehensibly update your system…


clean up after an update

emerge --depclean --ask

You should notice after updating your system it mentions to do this but its worth mentioning!

Find config’s needing attention

find /etc/ -name "._cfg*"

I’ll admit I couldn’t find those _cfg files for a while till realising they were hidden (dot) files – a simple find command will list them for you, its then just a case of using diff or meld to check out the differences.

Exploring dependencies

installing gentoolkit allows finding out why a package got installed.  For example what packages need to have bash installed

equery d bash

Probably more useful, to find out what packages are needed by bash

equery g bash

Although you might find you want to restrict it to a version number and changing the depth to unlimited probably isn’t a good idea…


There isn’t really an automated way to uninstall a package and its dependent packages as you could potentially gut your system, however a useful command is:

emerge --ask --depclean --verbose libsdl2

in this example you’ll get a list of all the dependent sdl libs like for example sdl2-image, you can then check all these and uninstall them, eventually you can then uninstall the original package too, another alternative after you’ve checked the dependent packages is to just use  ––unmerge followed up by a depclean on its own.  Be warned you still need to use ––ask when specifying a package for depclean, as it will uninstall stuff that doesn’t have dependent packages.

Of course I’ve not even touched on USE flags – that’s a whole other minefield ballgame and depends upon what you’re doing and to a certain extent taste, so maybe something for another post.

Leave a Reply

Your email address will not be published. Required fields are marked *