Gentoo

Portage

Directories

The default ebuild folder is /var/db/repos/gentoo/
The package.mask file is is at /var/db/repos/gentoo/profiles/package.mask
Portage stores source files in /var/cache/distfiles/
The standard directory for documentations is /usr/share/doc/
Explicitly installed packages are listed in /var/lib/portage/world
The common configuration file for merging is at /etc/portage/make.conf

Cheat sheet

ActionCommand
Update the repositoryemerge --sync
Search for softwareemerge --search [keyword]
emerge --searchdesc [keyword]
Install softwareemerge --ask gui-wm/sway
Check dependenciesemerge --pretend sway
Only download sourcesemerge --fetchonly sway
View USE flagsemerge -vp gui-wm/sway
Mark package as removableemerge --deselect sway
Update installed packagesemerge --update --ask @world
+ their dependencies--deep
+ their build dependencies--with-bdeps=y
+ account for USE changes--newuse
Remove deselected/unneeded packagesemerge --depclean --ask
Query a variableportageq envvar USE

Updating packages

Update the repository with emerge --sync, then emerge --update --ask @world

Removing unneeded packages

Manually deselect the packages to remove with emerge --deselect, or make the desired changes to USE flags
Update with dependencies: emerge --update --deep --newuse --ask @world
Remove unneeded packages: emerge --depclean --ask

Accepting licenses

A package's license will be shown by results of emerge --search
The ACCEPT_LICENSE variable is defined in /etc/portage/make.conf
Acceptance of licenses for individual packages can be done in /etc/portage/package.license
Individual licenses are stored in /var/db/repos/gentoo/licenses/
License groups are stored in var/db/repos/gentoo/profiles/license_groups

License GroupSummary
@GPL-COMPATIBLEGPL, BSD, MIT, Apache-2.0, zlib, unicode, ...
@FSF-APPROVEDApache-1.0, openssl, IBM, PHP-3.01, ...
@OSI-APPROVEDGPL, BSD, MIT, zlib, ...
@MISC-FREEUnapproved but follow the Free Software Definition
@FREE-SOFTWARE@FSF-APPROVED + @OSI-APPROVED + @MISC-FREE
@FSF-APPROVED-OTHER"free documentation" or "works of practical use besides software and documentation"
@MISC-FREE-DOCSNot listed under @FSF-APPROVED-OTHER but still follow the free definition
@FREE-DOCUMENTS@FSF-APPROVED-OTHER + @MISC-FREE-DOCS
@FREE@FREE-SOFTWARE + @FREE-DOCUMENTS
@BINARY-REDISTRIBUTABLEAt the very least allows free redistribution in binary form
@EULATries to take away your rights

Network

The hostname is defined at /etc/conf.d/hostname

# hostname
hostname="oldboy"

You can define several fields under /etc/conf.d/net

# dns domain name
dns_domain_lo="home"
# ip interface
config_eno1="192.168.1.141 netmask 255.255.255.0 brd 192.168.1.255"
routes_eno1="default via 192.168.1.1"

Linux

Fonts are in /usr/share/fonts/
Update environment variables for the current session with env-update and source /etc/profile

Find all available modules by running

find /lib/modules/`uname -r` -type f -iname '*.o' -or -iname '*.ko'

Find all detected CPU vulnerabilities by running

tail -n +1 /sys/devices/system/cpu/vulnerabilities/*

To load modules automatically on boot, list them in /etc/modprobe.d/*.conf files.

Configure the kernel with make menuconfig
Build the kernel by doing make -j5 && make modules_install -j5

OpenRC

To add a service to a runlevel (sysinit, boot, default):

rc-update add <service_name> <runlevel>

To manage a service (start, stop, restart):

rc-service <service_name> <command>