Loading blogs…
Arch Linux4 min read
Every pacman command you'll actually use, plus installing from the AUR safely with paru or yay, fixing keyring errors and rolling back packages.
Full-stack engineer, New Delhi
pacman looks cryptic because every operation is a single capital letter. Once you know the letters, it's one of the fastest package managers around. Here's everything I use, grouped by what you're trying to do.
Lowercase letters after them are options: y refresh databases, u upgrade, s search or recursive, i info.
| Task | Command |
|---|---|
| Update everything | sudo pacman -Syu |
| Install a package | sudo pacman -S firefox |
| Search the repos | pacman -Ss image editor |
| Package details | pacman -Si ripgrep |
| Remove + unneeded deps | sudo pacman -Rns package |
| List installed | pacman -Q |
| Only what you installed | pacman -Qe |
| Which package owns a file | pacman -Qo /usr/bin/ls |
| Find the package with a file | pacman -F libssl.so (run sudo pacman -Fy once) |
Never run pacman -Sy package on its own. Refreshing the database without upgrading, then installing one package, can pull in a library newer than the rest of your system and break things. Always install with a full upgrade:
sudo pacman -Syu package-nameOrphans are dependencies nothing needs any more.
pacman -Qdtq # list them
sudo pacman -Rns $(pacman -Qdtq) # remove thempacman keeps every package version it downloads in /var/cache/pacman/pkg. That's great for rollbacks, bad for disk space. paccache (from pacman-contrib) keeps the last few versions:
sudo pacman -S pacman-contrib
sudo paccache -rk2 # keep the 2 most recent versions
sudo systemctl enable --now paccache.timer # do it weekly, automaticallyEdit /etc/pacman.conf and uncomment or add, under [options]:
Color
ParallelDownloads = 5
VerbosePkgLists(Add ILoveCandy too if you want Pac-Man in your progress bars.)
If an update breaks something, reinstall the previous version from the cache:
ls /var/cache/pacman/pkg | grep mesa
sudo pacman -U /var/cache/pacman/pkg/mesa-24.x.x-1-x86_64.pkg.tar.zstThen check the Arch news and forums — someone usually has the fix within hours.
This almost always means your keyring is out of date, usually after a long break from updating:
sudo pacman -Sy archlinux-keyring
sudo pacman -SuThe Arch User Repository has community build scripts (PKGBUILDs) for almost everything not in the official repos — VS Code, Spotify, Chrome, niche tools. It's powerful, but anyone can upload to it, so read what you install.
git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin
less PKGBUILD # read it: where does it download from? what does it run?
makepkg -siparu and yay wrap pacman and the AUR into one command:
paru -S visual-studio-code-bin # install from the AUR
paru # upgrade repos + AUR together
paru -Sua # upgrade only AUR packagesBoth show you the PKGBUILD diff before building — actually read it, especially for packages with few votes or a recent change of maintainer.
paru can show it for you)-bin AUR packages only from maintainers you trustIf you want an undo button for the whole system, not just single packages, set up Btrfs snapshots.
Arch Linux
Make Arch Linux dependable: Btrfs snapshots with Snapper and snap-pac, safe update habits, an LTS kernel fallback and arch-chroot recovery.
Linux Desktop
An honest comparison of Hyprland, Sway and i3 — what tiling window managers are, who each suits, and a starter config to get going.
Arch Linux
Install Arch Linux on a UEFI machine step by step — partitioning, pacstrap, bootloader, networking and your first user — with every command explained.