Basic commands
Install & update
Install a package.
Update and upgrade. They must be done at the same time.
Uninstall
Uninstall a package.
--remove
-R
removes packages, keeps config files appending ".pacsave"--nosave
-n
deletes config files.--unneeded
-u
removes unneeded dependencies.--recursive
-s
remove all of the dependencies that are not required by other packages and they were not explicitly installed. Twice to include explicitly installed.
Search
Search for a package.
Query
List packages
List packages installed from repositories
List packages not installed from repositories
List orphaned packages
List explicitly installed packages
List all files installed by a package
Remove packages that are no longer installed from the cache as well as currently unused sync databases to free up disk space.
Clean
Clean all cached versions of installed and uninstalled packages up to the last 3 versions (pacman-contrib)
Clean up to one past version (pacman-contrib)
Clean all the uninstalled packages from cache (pacman-contrib)
Uninstall orphaned packages
Add a package as explictly installed so is not considered an orphan.
Query files
Search which packages installed a file
Search for a package that will install a program
Downgrade
Downgrade a package from the ones in the local cache.
Downgrade a package with downgrade
(AUR)
Other
Reinstall all packages
Receive keys. Keys can be found in the signature of a package, it redirects to a key server with the ID of the key.
/etc/pacman.conf
VerbosePkgLists
Before
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Packages (10) acpi_call-lts-1.1.0-90 dnssec-anchors-20190629-1 lib32-libdrm-2.4.99-1 libdrm-2.4.99-1 linux-lts-4.19.57-1
linux-lts-headers-4.19.57-1 mpc-0.32-1 mpd-0.21.11-1 tzdata-2019b-1 yubikey-personalization-1.20.0-1
Total Download Size: 84.96 MiB
Total Installed Size: 195.92 MiB
Net Upgrade Size: -0.07 MiB
:: Proceed with installation? [Y/n] ^C
Interrupt signal received
After
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Package (10) Old Version New Version Net Change Download Size
community/acpi_call-lts 1.1.0-89 1.1.0-90 0.00 MiB 0.01 MiB
core/dnssec-anchors 20181003-1 20190629-1 0.00 MiB 0.00 MiB
multilib/lib32-libdrm 2.4.98-1 2.4.99-1 0.00 MiB 0.13 MiB
extra/libdrm 2.4.98-1 2.4.99-1 0.01 MiB 0.24 MiB
core/linux-lts 4.19.56-1 4.19.57-1 0.00 MiB 74.87 MiB
core/linux-lts-headers 4.19.56-1 4.19.57-1 0.00 MiB 8.45 MiB
extra/mpc 0.31-1 0.32-1 -0.03 MiB 0.17 MiB
extra/mpd 0.21.10-1 0.21.11-1 -0.04 MiB 0.70 MiB
core/tzdata 2019a-1 2019b-1 -0.01 MiB 0.33 MiB
community/yubikey-personalization 1.19.3-1 1.20.0-1 0.00 MiB 0.06 MiB
Total Download Size: 84.96 MiB
Total Installed Size: 195.92 MiB
Net Upgrade Size: -0.07 MiB
:: Proceed with installation? [Y/n]