Who this post is for

  • Users who are new to pacman
  • Someone who wants to see what other pacman users regularly use

What this post isn't

  • Principle of pacman design
  • Detail explanation of the commands
  • Replacement of the documentation (duh!)

Everything in this post can of course be found easily using pacman --help. But that's a documentation. It has a lot more than you'd ever need. This post will help you filter out the few good stuff (read: regularly used) from the vast documentation.

Here's a list of commands I personally use. I never had the need to use anything more than what's listed here.

The Basics

  1. Upgrade local packages
sudo pacman -Syu

This command is probably the most used pacman command by quite some distance. It does 2 things

  • downloads a fresh package list.
  • upgrades all the installed pacakges that are out of date.

Pacman keeps a local copy of the package list in the system, so it doesn't have to download the list every time you run a command. The -y flag forces pacman to download a fresh copy of the package list from the repositories.

  1. Install packages
sudo pacman -S <package-name>
  1. Search for packages
sudo pacman -Ss <package-name>
  1. Remove packages
sudo pacman -Rns <package-name>
  1. Clean cache
sudo pacman -Sc

Still basics but rarely used

These are a list of commands that you probably wouldn't use on a daily basis.

  1. List all packages that are no longer required
pacman -Qdt
  1. Remove all packages that are no longer required
sudo pacman -Rns $(pacman -Qdtq)
  1. Info of a package
pacman -Qi <package-name>

I use this command to look for a few things

  • packages that require this package
  • packages this package require
  • whether it was installed explicitly
❯ pacman -Qi seahorse
...
Depends On      : gtk3  gcr  ...
Required By     : None
Install Reason  : Explicitly installed
  1. List all the packages installed in your system
pacman -Q

# To get the count
pacman -Q | wc -l
  1. List packages that were explicitly installed
pacman -Qe

Packages come with dependencies. This is will only list those packages that you explicitly installed.

  1. List all the packages installed from aur

Not possible. But you can get a close to accurate result with

pacman -Qm

Thanks