elliot.science

 elliot.science

My Linux cheat sheet

2024-01-13
/linux#gentoo

Preface

This is going to be generally for use on Gentoo Linux, but is able to be used on different distributions, when not specific

General Linux

Transferring drive

Moving to a new system is straightforward with rsync. Ensure partitions are created beforehand. I recommend the Gentoo Handbook

Transfer command (this excludes runtime directories):

rsync -aAXv /source/directory /destination/directory

breakdown:

After clone

You will have to do a few thing to get the system working, which is normal during Arch and Gentoo installs.

To get the system to boot you will want to get your /etc/fstab correct, this file contains the mount points of the partitions you created earlier. To get the drive names and partitions do fdisk -l, you want to use these retrospectively to to your fstab. I also recommend using noatime on drives to get a bit more speed out of them. Mine are below.

/dev/nvme0n1p1          /boot           vfat            noauto,noatime  1 2
/dev/nvme0n1p3          /               ext4            noatime         0 1
/dev/nvme0n1p2          none            swap            sw              0 0

Once you have done this you should just need your bootloader setup. I personally would delete the old grub from the /boot directory and then run when using UEFI

UEFI

mount /boot
grub-install --target=x86_64-efi --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg

LEGACY BIOS

grub-install /dev/sda(whatever partition boot is)
grub-mkconfig -o /boot/grub/grub.cfg

Gentoo specific

Managing emerge

To check where most current installed packages are from:

emerge -pve world | perl -ne 'print "$1\n" if m!\] (.*?)/!' | sort | uniq -c | sort -rn | head -n 30

76 dev-libs
73 virtual
    71 dev-python
    51 media-libs
    48 x11-libs
    47 dev-perl
    42 sys-apps
    39 app-text
    34 dev-ruby
    31 dev-util
    29 sys-devel
    29 acct-group
    20 dev-qt
    19 sys-libs
    18 dev-lang
    17 app-arch
    16 net-libs
    14 app-eselect
    13 x11-apps
    12 app-crypt
    10 x11-misc
    10 media-fonts
    10 app-alternatives
     9 net-misc
     9 acct-user
     8 app-misc
     7 media-video
     7 app-admin
     6 media-gfx
     6 games-util