Skip to content

gentoo-cheatsheet

Here is my personal wiki I created during years when I worked with Gentoo shell, feel free to use/copy/link this wiki as you wish but please add a url to my wiki.

qxpak

  • manipulate xpak archives

qxpak

qkeyword

  • list packages based on keywords

qkeyword qkeyword2

qdropped

qsize

  • calculate size usage

1

qlop

  • emerge log analyzer

Screenshot_20220512_124333

qlop

quse

  • find pkgs using useflags & print useflag description and much more

13221313

qtegrity

  • verify files with IMA

qtegrity

qsearch

  • search packages and descriptions and much more really really quick but its not faster then eix yet

2313131

  • qsearch vs eix

21312313112313

qcheck

  • verify integrity of installed packages

qcheck

qwhich

  • as which but for gentoo ebuild and packages

22

qgrep

  • like RipGrep or The Silver Searcherbut for Gentoo ebuilds

qgrep

qmanifest

  • verify or generate thick Manifest files

gpg signature is invalid

  • I doing this readme while I wait for portage to be finished and all is cool :)

qmanifest

qatom

1231

qfile

  • list all pkgs owning files

qfile

qpkg

  • create or manipulate Gentoo binpkgs

qpkg

qtbz2

qtbz2

qdepends

  • show dependency info

qdepends

eshowkw

  • Display keywords for specified package or for package that is in pwd
  • eshowkw is i from gentoolkit package and is not in stage3

gentoolkit eshowkw

Sync and update Portage tree via emerge

emerge --sync                                                                                              

Sync and update Portage tree via eix

eix-sync -a; eix-update -a      

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

emaint -a sync                                                                                             

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

emerge-webrsync                                 

Upgrade entire system

emerge -avuDN --with-bdeps y --keep-going world                                                            

Upgrade all installed packages, dependencies, and deep dependencies that are outdated or have USE flag changes

emerge -uDU --keep-going --with-bdeps=y @world                                                             

Run if you edited any use flags

emerge --update --changed-use --deep --quiet @world                                                        

Install a package but excluding it from the world file

emerge --oneshot www-client/firefox                                                                       

List what packages would be installed without installing them:

emerge -pv www-client/firefox                                                                              

Ask portage what would be installed when installing firefox

emerge -a www-client/firefox                                                                               

Make configuration files up-2-date if needed

etc-update                                                                                                 

Fix static library

lafilefixer --justfixit | grep -v skipping                                                                 

Remove packages no longer needed:

emerge -av --depclean                                                                                      

Reverse dynamic library Dependency

revdep-rebuild                                                                                             

Clean old distfiles

eclean -d distfiles                                                                                        

List installed packages

qlist -IRv                                                                                                 

List installed packages more clean

qlist -I           

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

euse -i X                                                                                                  

Obtain a description of the png USE flag:

euse -i | grep png                                                                                         

Show what packages have the mysql USE flag:

equery hasuse mysql                                                                                        

Show what packages are currently built with the mysql USE flag:

eix --installed-with-use mysql                                                                             

Show what USE flags are available for a specific package:

equery uses <package-name>                                                                                 

View the last 10 emerges (installs):

genlop -l | tail -n 10                                                                                     

View how long emerging LibreOffice took:

genlop -t libreoffice                                                                                      

Estimate how long emerge -uND –with-bdeps=y @world will take:

emerge -pU @world | genlop --pretend                                                                       

Watch the latest merging ebuild during system upgrades:

watch genlop -unc             

List all existing overlays:

eselect repository list         

List all installed overlays:

eselect repository list -i                                                                                

Sync layman repos

layman -S            

List all existing overlays:

layman -L                                                                                                  

List all installed overlays:

layman -l                      

Show packages explicitly installed.

cat /var/lib/portage/world   

to show all the installed packages, including dependencies.

equery list *

Read news about Portage updates.

eselect news read                                                                                         

Search for a package to see what exists.

emerge -s package                              
emerge -S package                                                                                        

To see the effect of USE flags on the specified package (requires gentoolkit).

equery uses package

Pretend to install a package, in order to show a preview of the dependencies, etc. that will be installed in total.

emerge -p package

Like above, except it will ask to proceed after showing a preview of what will happen.

emerge -a package   

to install quietly, omitting all the technical compilation output.

emerge -q package                                                                                         

to update all packages explicitly installed, as well as their dependencies and their build dependencies, pretending at first.

```sh emerge -uD –with-bdeps=y @world -p

### like above, except changes to USE flags will also be considered in determining what needs to be re-built.
emerge -uDN --with-bdeps=y @world -p                                                                       #

to resolve changes to config files made by Portage updates.

etc-update                                                                                                

View Portage logs.

eread

Choose which version of C++ compiler to use.

gcc-config           

Rebuild the "toolchain" after changing which version of C++ compiler to use.

env-update && source /etc/profile && emerge binutils glibc -1q                                            
emerge -Ca package       

Remove a package.

emerge -ca (--depclean --ask)                           

Remove unneeded dependencies.

emerge @preserved-rebuild

Rebuild packages whose (dynamically linked) dependencies are no longer needed and have been removed (requires gentoolkit), pretending at first.

revdep-rebuild -p                                                                                          #

to delete leftover package installation/build files; destructive means to remove stuff except for packages explicitly installed, pretending at first.

eclean -d -p distfiles                                                                                     

Delete leftover package installation/build files, regardless of whether you might want them again.

rm /usr/portage/distfiles/*                                                                              

Choose a version of the kernel source.

eselect kernel                                                                                            

Configure kernel.

cd /usr/src/linux && make menuconfig                                                                      

Show which services are started in which runlevels, including those inactive.

rc-config list                                                                                            

Show which services are started in which runlevels, in a slightly different format.

rc-update                                                                                                 

Add a service, such as apache2, to a runlevel, such as default, so that it gets started when the computer boots up.

rc-update add service runlevel                                                                             

Show which services are currently running.

rc-status                          

Restart a service. Besides restart, you can also start, stop, etc.

/etc/init.d/service restart                                                                                

Find packages not installed by portage

find /usr/bin | xargs -I{} qfile -o {}                                                                    
root # quse -D terminal

app-editors/gedit-plugins[terminal] Embed a terminal in the bottom pane
app-editors/vim[terminal] Enable terminal emulation support
dev-qt/qt-creator[serialterminal] Build the serial terminal plugin
dev-util/anjuta[terminal] Enable terminal plugin based on x11-libs/vte
lxqt-base/lxqt-meta[terminal] Install x11-terms/qterminal package
mate-extra/caja-extensions[open-terminal] Add an extension to support an open terminal.

Warning

Remember that if you subsequently use the target machine directly at its keyboard, you'll be working outside of the chroot, and all your paths will be incorrect (e.g. the new system will still appear at /mnt/gentoo/). It's an easy mistake to make, hence the renaming of the prompts. Once the kernel is built and the machine rebooted, we'll be 'natively' inside the new system, at which point this path issue will disappear.

#!/bin/bash

mount --types proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
mount --bind /run /mnt/gentoo/run
mount --make-slave /mnt/gentoo/run 
    
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

23213213

Doing same things over and over and over again is boring, adding this part for myself so I can copy and paste when I installing Gentoo Doing this 1 time / month for different users/companies so if you reading this and installing gentoo. This is the last part beforing we we mounting the folders above and jumping in to our new enviroment/setup

cp /mnt/usb/install/portage/make.conf /mnt/gentoo/etc/portage/
mkdir -p -v /mnt/gentoo/etc/portage/repos.conf 
cp -v /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf

23213213

emerge sys-kernel/gentoo-sources sys-kernel/genkernel sys-boot/grub:2 app-portage/gentoolkit app-editors/vim sys-apps/ripgrep-all sys-process/parallel  sys-fs/cryptsetup wpa_supplicant net-analyzer/netcat  app-arch/atool app-arch/p7zip

Screenshot_20220512_122818

printf '### Gentoo Kernel\n%s\n\n### Genkernel for initramfs \n%s\n\n### Grub:2 as bootloader\n%s\n\n' \
       'sys-kernel/gentoo-sources symlink' \
       'sys-kernel/genkernel cryptsetup' \
       'sys-boot/grub:2 device-mapper' \
       'app-arch/p7zip rar' > /etc/portage/package.use/elitebook_useflags 
21321

eix-update
eix-sync -a
emerge --oneshot sys-apps/portage

3123213213


Last update: June 18, 2022
Created: June 18, 2022