Packages
Pacman and yay package management on Arch.
Install
Single package:
sudo pacman -S <pkg>Multiple packages:
sudo pacman -S firefox chromium vlcSkip already up-to-date:
sudo pacman -S --needed <pkg>No confirmation:
sudo pacman -S --noconfirm <pkg>From a local
.pkg.tar.zst:sudo pacman -U /path/to/package.pkg.tar.zstFrom a specific repo:
sudo pacman -S extra/<pkg>
Remove
Package + deps + config (cleanest):
sudo pacman -Rns <pkg>Package + deps (keep config):
sudo pacman -Rs <pkg>Only the package:
sudo pacman -R <pkg>Orphans (installed as deps, no longer needed):
sudo pacman -Rns $(pacman -Qdtq)List orphans without removing:
pacman -Qdt
Update
Full system upgrade:
sudo pacman -SyuForce database refresh + upgrade:
sudo pacman -SyyuDownload only, don’t install:
sudo pacman -Syuw
Warning: Never run
pacman -Sy <pkg>(partial upgrade). Always full-Syu.
Search & query
Search remote repos:
pacman -Ss <keyword>Info on remote package:
pacman -Si <pkg>Search installed:
pacman -Qs <keyword>Info on installed package:
pacman -Qi <pkg>List files in installed package:
pacman -Ql <pkg>Which package owns file:
pacman -Qo /usr/bin/vimFind file in remote pkg (requires
pkgfile):pkgfile <filename>
List installed
For a full, committed snapshot of this machine, see the package inventory kept in the dotfiles — regenerate it any time with
pkglist(see tools/pkglist).
Explicitly installed:
pacman -QeExplicit, excluding base/base-devel:
pacman -QetForeign (AUR / manual):
pacman -QmNative (official repos):
pacman -QnRecent installs (needs
expac):expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -20Check broken deps:
sudo pacman -Dk
Cache
Cache size:
du -sh /var/cache/pacman/pkg/Clean cache, keep 3 latest (needs
pacman-contrib):sudo paccache -rKeep only latest:
sudo paccache -rk1Remove cache for uninstalled pkgs:
sudo paccache -ruk0Remove all cache:
sudo pacman -SccDowngrade from cache:
sudo pacman -U /var/cache/pacman/pkg/<pkg>-<oldver>.pkg.tar.zstEnable weekly cleanup timer:
sudo systemctl enable --now paccache.timer
Mirrors
Edit mirror list:
sudo $EDITOR /etc/pacman.d/mirrorlistBest 10 HTTPS mirrors with reflector:
sudo reflector --country France,Germany --age 12 --protocol https \ --sort rate --latest 10 --save /etc/pacman.d/mirrorlistAuto mirror updates:
sudo systemctl enable --now reflector.timer
Configuration
Main file:
/etc/pacman.confCommon tweaks:
Color ILoveCandy ParallelDownloads = 5 [multilib] Include = /etc/pacman.d/mirrorlistIgnore package on upgrade (in
pacman.conf):IgnorePkg = linux linux-headers
yay (AUR)
Bootstrap (first time):
sudo pacman -S --needed git base-devel git clone https://aur.archlinux.org/yay.git cd yay && makepkg -siSearch AUR + repos:
yay <keyword>Install from AUR:
yay -S <pkg>Update everything (repos + AUR):
yay -SyuAUR-only update:
yay -SuaRemove leftover build deps:
yay -YcEdit PKGBUILD before build:
yay -S --editmenu <pkg>Skip check phase:
yay -S <pkg> --mflags=--nocheck
Manual AUR install
- Clone, review, build:
git clone https://aur.archlinux.org/<pkg>.git cd <pkg> less PKGBUILD makepkg -si
Troubleshooting
Lock left over (only when no pacman running):
sudo rm /var/lib/pacman/db.lckRe-sync corrupted DB:
sudo pacman -SyyFix PGP signature errors:
sudo pacman -S archlinux-keyring sudo pacman-key --init sudo pacman-key --populate archlinuxReinstall all native packages:
sudo pacman -S $(pacman -Qnq)Verify package files:
pacman -QkkForce overwrite conflicts:
sudo pacman -S --overwrite '*' <pkg>Recent upgrades from log:
grep -i upgraded /var/log/pacman.log | tail -20
Useful aliases
alias pacup='sudo pacman -Syu'
alias pacin='sudo pacman -S'
alias pacrm='sudo pacman -Rns'
alias pacss='pacman -Ss'
alias pacqs='pacman -Qs'
alias pacown='pacman -Qo'
alias pacorph='sudo pacman -Rns $(pacman -Qdtq)'
alias paclog='grep -i "installed\|upgraded\|removed" /var/log/pacman.log | tail -30'
Useful installed packages (reference)
| Tool | Package |
|---|---|
| File listing | eza |
| Fuzzy finder | fzf |
| Smart cd | zoxide |
| File manager | yazi |
| Git TUI | lazygit |
| PDF viewer | zathura + zathura-pdf-mupdf |
| Document compiler | typst |
| Screenshot | grimshot (sway-contrib) |
| Notifications | mako |
| Bar | waybar |
| Launcher | fuzzel |
| Brightness | brightnessctl |
| Bluetooth | blueman |
| Bat (cat with colors) | bat |
| System monitor | btop |
| Image viewer | imv |
| Vi zsh plugin | zsh-vi-mode (AUR) |
| Syntax highlight zsh | zsh-syntax-highlighting |