Every Arch Linux user lives in the terminal, and pacman is the command you type most. This cheat sheet covers every pacman operation you will need, from basic installs and updates to cache management, file queries, and AUR packages with yay. Every command below was tested on a live Arch Linux system running Pacman 7.1.0 and kernel 6.19.
Bookmark this page. It works as a quick reference when you forget a flag, and as a learning resource when you want to understand what each option actually does. For the full Arch Linux setup from scratch, see our Arch Linux installation guide with archinstall.
Verified working: March 2026 on Arch Linux (kernel 6.19.8, Pacman 7.1.0, yay 12.5.7)
Update the System
Arch is a rolling release. Running a full system upgrade regularly is the single most important maintenance task.
Synchronize package databases and upgrade all packages:
sudo pacman -Syu
If the system is already current, pacman reports there is nothing to do:
:: Synchronizing package databases...
core downloading...
extra downloading...
:: Starting full system upgrade...
there is nothing to do
Force a database refresh even if recently synced (useful after switching mirrors):
sudo pacman -Syyu
Check which packages have updates available without installing them:
pacman -Qu
Install Packages
Install a package from the official repositories:
sudo pacman -S htop
Pacman resolves dependencies automatically:
:: Processing package changes...
installing htop...
Optional dependencies for htop
lm_sensors: show cpu temperatures
lsof: show files opened by a process
strace: attach to a running process
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
Install multiple packages in one command:
sudo pacman -S vim nginx git curl wget
Install from a specific repository (when a package exists in multiple repos):
sudo pacman -S extra/nginx
Download a package without installing it (saves to /var/cache/pacman/pkg/):
sudo pacman -Sw vim
Install a local .pkg.tar.zst package file (Arch packages use zstd compression since 2020):
sudo pacman -U /path/to/package.pkg.tar.zst
Install a package directly from a URL:
sudo pacman -U https://archive.archlinux.org/packages/h/htop/htop-3.4.1-1-x86_64.pkg.tar.zst
Remove Packages
Remove a package but keep its config files and dependencies:
sudo pacman -R htop
Remove a package along with its unused dependencies:
sudo pacman -Rs htop
Remove a package, its dependencies, and its config files (the most thorough removal):
sudo pacman -Rns htop
This is the recommended way to cleanly remove software. The -n flag prevents pacman from saving backup copies of config files, and -s removes dependencies that nothing else needs.
Remove orphaned packages (installed as dependencies but no longer required by anything):
sudo pacman -Rns $(pacman -Qtdq)
If there are no orphans, pacman -Qtdq returns nothing and the command is safe to run.
Search and Query Packages
Search for a package in the official repositories:
pacman -Ss nginx
Results show the repository, package name, version, and description:
extra/nginx 1.28.3-1
Lightweight HTTP server and IMAP/POP3 proxy server
extra/nginx-mainline 1.29.7-1
Lightweight HTTP server and IMAP/POP3 proxy server, mainline release
View detailed info about a package in the repos (before installing):
pacman -Si nginx
This shows the repository, version, dependencies, download size, installed size, and packager:
Repository : extra
Name : nginx
Version : 1.28.3-1
Description : Lightweight HTTP server and IMAP/POP3 proxy server
Architecture : x86_64
Depends On : glibc pcre2 zlib openssl mailcap libxcrypt
Download Size : 603.28 KiB
Installed Size : 1604.81 KiB
Search installed packages on the local system:
pacman -Qs htop
View detailed info about an installed package:
pacman -Qi htop
List all files installed by a package:
pacman -Ql htop
The output lists every file the package installed:
htop /usr/bin/htop
htop /usr/share/applications/htop.desktop
htop /usr/share/icons/hicolor/scalable/apps/htop.svg
htop /usr/share/man/man1/htop.1.gz
htop /usr/share/pixmaps/htop.png
Find which package owns a specific file:
pacman -Qo /usr/bin/htop
Pacman identifies the owning package and version:
/usr/bin/htop is owned by htop 3.4.1-1
Search for a file across all repository packages (even uninstalled ones). Sync the file database first:
sudo pacman -Fy
pacman -F nginx
The file database shows which packages provide files matching the search term:
extra/nginx 1.28.3-1
usr/bin/nginx
extra/nginx-mainline 1.29.7-1
usr/bin/nginx
List Packages
List all installed packages:
pacman -Q
List only explicitly installed packages (not pulled in as dependencies):
pacman -Qe
List packages installed from the AUR or manually (foreign packages not in official repos):
pacman -Qm
List packages installed from official repos only (native):
pacman -Qn
List orphaned packages (dependencies no longer needed):
pacman -Qtd
Manage the Package Cache
Pacman stores every downloaded package in /var/cache/pacman/pkg/. Over time this grows to several gigabytes. Check current cache size:
du -sh /var/cache/pacman/pkg/
Remove cached packages that are no longer installed (keeps the latest version of installed packages):
sudo pacman -Sc
Remove all cached packages (frees the most space but prevents downgrading without re-downloading):
sudo pacman -Scc
For more granular control, install paccache from the pacman-contrib package. Keep only the 3 most recent versions of each package:
sudo pacman -S pacman-contrib
sudo paccache -r
Keep only 1 version:
sudo paccache -rk1
AUR Packages with yay
The Arch User Repository (AUR) contains community-maintained packages not available in the official repos. yay is the most popular AUR helper (12.5.7 as of March 2026). It wraps pacman and adds AUR support, so yay commands feel familiar if you know pacman.
Install yay from the AUR (bootstrap with makepkg since yay itself is an AUR package):
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
After installation, yay works as a drop-in replacement for pacman with AUR support added:
Update all packages including AUR:
yay -Syu
Search the AUR:
yay -Ss google-chrome
Results include both official repo and AUR packages, with vote count and popularity:
aur/google-chrome-canary 147.0.7700.0-1 (+7 0.68)
The popular web browser by Google (Canary Channel)
aur/chromedriver 146.0.7680.165-1 (+51 0.04)
Standalone server that implements the W3C WebDriver standard
Install an AUR package:
yay -S google-chrome
Remove an AUR package (same flags as pacman):
yay -Rns google-chrome
List installed AUR packages:
yay -Qm
On a fresh system with only yay installed from AUR:
yay-bin 12.5.7-1
Show system and package statistics:
yay -Ps
The output gives a useful overview of your system’s package state:
==> Yay version v12.5.7
===========================================
==> Total installed packages: 211
==> Foreign installed packages: 2
==> Explicitly installed packages: 16
==> Total Size occupied by packages: 1.2 GiB
==> Size of pacman cache: 285.2 MiB
===========================================
Pacman Quick Reference Table
All essential pacman commands at a glance:
| Command | What It Does |
|---|---|
pacman -Syu | Sync databases and upgrade all packages |
pacman -S pkg | Install a package from repos |
pacman -Ss term | Search repos for a package |
pacman -Si pkg | Show repo package details |
pacman -R pkg | Remove a package (keep configs) |
pacman -Rns pkg | Remove package, configs, and unused deps |
pacman -Q | List all installed packages |
pacman -Qe | List explicitly installed packages |
pacman -Qm | List foreign/AUR packages |
pacman -Qtd | List orphaned packages |
pacman -Qi pkg | Show installed package details |
pacman -Ql pkg | List files owned by a package |
pacman -Qo /path | Find which package owns a file |
pacman -F file | Search all repos for a file |
pacman -Sw pkg | Download without installing |
pacman -U file.pkg.tar.zst | Install a local package file |
pacman -Sc | Clean old package cache |
pacman -Scc | Clean all package cache |
pacman -Qu | List packages with available updates |
Yay Quick Reference Table
Yay mirrors pacman’s flags and adds AUR support:
| Command | What It Does |
|---|---|
yay -Syu | Update all packages (repos + AUR) |
yay -S pkg | Install from repos or AUR |
yay -Ss term | Search repos and AUR |
yay -Rns pkg | Remove package cleanly |
yay -Qm | List installed AUR packages |
yay -Ps | Print system/package statistics |
yay -Sc | Clean yay and pacman cache |
yay -Sua | Update AUR packages only |
Useful Shell Aliases
Add these to ~/.bashrc or ~/.zshrc to save keystrokes. The aliases use yay since it handles both repo and AUR packages:
# System update (repos + AUR)
alias update='yay -Syu'
# Install
alias install='yay -S'
# Remove cleanly
alias remove='yay -Rns'
# Search
alias search='yay -Ss'
# Package info
alias info='yay -Si'
# List explicitly installed
alias installed='pacman -Qe'
# List orphans
alias orphans='pacman -Qtd'
# Clean cache
alias cleanup='yay -Sc && yay -Rns $(pacman -Qtdq) 2>/dev/null'
After adding them, reload your shell: source ~/.bashrc.
Pacman Configuration
The main pacman config file is /etc/pacman.conf. A few useful settings to enable:
sudo vi /etc/pacman.conf
Uncomment or add these lines in the [options] section:
# Enable colored output
Color
# Show package sizes during install
VerbosePkgLists
# Enable parallel downloads (significantly faster updates)
ParallelDownloads = 5
# Show a Pac-Man animation during downloads (cosmetic)
ILoveCandy
The ParallelDownloads setting makes a noticeable difference on system updates. Set it to 5-10 depending on your bandwidth. The default Arch repos configured in /etc/pacman.conf are [core] and [extra]. The Arch Wiki pacman page has the full reference for all configuration options.