Arch Linux Pacman

Date: 2016-07-04
# missing keys while updating: update keyring package first
sudo pacman -S archlinux-keyring

# import keys (initial)
pacman-key --init
# update keys
pacman-key --populate archlinux

# remove a package completely
pacman -Rsn
# remove even more (dependencies)
pacman -Rscnd

# clear package cache (sometimes uses much disk space)
pacman -Scc

# update all repositories
pacman -Syy

# system upgrade
pacman -Suu

# on existing files in filesystem, add the force parameter
pacman --force

# remove unused packages !warning careful!
pacman -Rsn $(pacman -Qdtq)

# list of packages installed manually
pacman -Qqe
pacman -Qei | awk '/^Name/ { name=$3 } /^Groups/ { if ( $3 != "base" && $3 != "base-devel" ) { print name } }'

#backup + restore
pacman -Qqe > pkglist.txt
pacman -S - < pkglist.txt --needed

# reinstall all native packages
pacman -Qnq | pacman -S -

# optimize pacman database for speed
pacman -Sc && pacman-optimize

# Get fastest mirrors
curl -s "https://www.archlinux.org/mirrorlist/?country=NL&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > mirrors
sudo cp mirrors /etc/pacman.d/mirrorlist
# Or via GUI: https://www.archlinux.org/mirrorlist/
2650cookie-checkArch Linux Pacman