pacman cheat sheet
This article has last been updated at .
This cheat sheet is focused on the pacman command, the package manager for systems like Arch Linux.
Basic usage
Pacman uses mostly command options and their action might not always be clear, especially when using the shortened aliases. So here is a basic list with the options in long and short format, followed by the intended action.
| Command | Short version | Intended action | 
|---|---|---|
| --query --deps --unrequired | -Qdt | Find all packages that are installed as dependency but no longer required | 
| --remove PACKAGE | -R | Remove specified package | 
| --remove --recursive PACKAGE | -Rs | Remove package and dependencies, except those linked to other packages or manually installed | 
| --sync PACKAGE | -S | Install a package | 
| --sync --search REGEX | -Ss | Search for a package | 
| --sync --refresh | -Sy | Refresh the package database information | 
Search a package
If you know the name or a part of the name, then we can combine --sync with --search to search with a regular expression.
# pacman -Ss lynis
extra/lynis 3.1.2-1
    Security and system auditing tool to harden Unix/Linux systems
Example using a regular expression.
pacman -Ss "lyn*"
Installation, update, upgrade, and removal of packages
Install new package
Install a single package.
pacman -S lynis
Update the database information
pacman -Sy
Requires root permissions
Upgrading packages
To update and upgrade the full system.
pacman -Syu
Remove a package
Remove a single package
pacman -R lynis
Remove a package including its dependencies, except those dependencies that are linked to another installed package or were manually installed by the user.
pacman -Rs lynis
Remove a package and also its dependencies.
pacman -Rsc lynis
File information
Synchronize the package database and search for files with a particular name.
# pacman -Fy lynis
:: Synchronizing package databases...
 core       1110,9 KiB  7,38 MiB/s 00:00 [-----------------------] 100%
 extra        44,3 MiB  84,1 MiB/s 00:01 [-----------------------] 100%
 multilib    223,7 KiB  1912 KiB/s 00:00 [-----------------------] 100%
extra/lynis 3.1.2-1
    usr/bin/lynis
    usr/share/bash-completion/completions/lynis
To search with a regular expression, provide also the --regex option.
sudo pacman -Fxy lyni
:: Synchronizing package databases...
 endeavouros is up to date
 core is up to date
 extra is up to date
 multilib is up to date
extra/lynis 3.1.2-1
    usr/bin/lynis
    usr/lib/systemd/system/lynis.service
    usr/lib/systemd/system/lynis.timer
    usr/share/bash-completion/completions/lynis
    usr/share/man/man8/lynis.8.gz
extra/tela-circle-icon-theme-black 2024_11_15-2
    usr/share/icons/Tela-circle-black/scalable/apps/dev.lynith.Speedtest.svg
extra/tela-circle-icon-theme-blue 2024_11_15-2
    usr/share/icons/Tela-circle-blue/scalable/apps/dev.lynith.Speedtest.svg
extra/tela-circle-icon-theme-brown 2024_11_15-2
    usr/share/icons/Tela-circle-brown/scalable/apps/dev.lynith.Speedtest.svg
extra/tela-circle-icon-theme-dracula 2024_11_15-2
    usr/share/icons/Tela-circle-dracula/scalable/apps/dev.lynith.Speedtest.svg
Maintenance
Packages that are no longer required
Search for any dependencies that are no longer required.
pacman -Qdt
