to rebuild the "toolchain" after changing which version of C++ compiler to use.
emerge -Ca package
to remove a package.
emerge -ca (--depclean --ask)
to remove unneeded dependencies.
emerge @preserved-rebuild
to rebuild packages using outdated libraries.
revdep-rebuild -p
to rebuild packages whose (dynamically linked) dependencies are no longer needed and have been removed (requires gentoolkit), pretending at first.
eclean -d -p distfiles
to delete leftover package installation/build files; destructive means to remove stuff except for packages explicitly installed, pretending at first.
rm /usr/portage/distfiles/*
to delete leftover package installation/build files, regardless of whether you might want them again.
eselect kernel
to choose a version of the kernel source.
cd /usr/src/linux && make menuconfig
to configure kernel.
cd /usr/src/linux && make oldconfig
to configure kernel, showing only options that have changed since the current .config file. Since this will only prompt you with a sequence of questions, you may want to run the above command at the same time in another terminal so that you can browse through the questions and gain some context of what's being asked.
make && make modules_install
to build kernel & modules.
mount /boot && cp arch/x86_64/boot/bzImage /boot/kernel-x.x.x-hardened && nano /etc/lilo.conf && lilo && umount /boot
to install kernel; change "x.x.x-hardened" to whatever version you're building.