This post is for beginners that want to get started with pacman.
It’s only a summary.

You can find a complete guide for pacman in the wiki [de].

Install, uninstall and search for packages

Install or update packages:

sudo pacman -S [package1] [package2]

Uninstall packages:

sudo pacman -Rns [package1] [package2]

One or more packages are uninstalled with all dependencies (if those are no longer used by other programs).

Search for packages

pacman -Ss [package]

Searches for installable packages. It’s enough to provide pieces of the package’s name.

Search for already installed packages:

pacman -Qs [package]

This is perfect to check if you’ve already installed a package.

To get a complete list of all explicit installed packages use pacman -Qet and with all dependencies use pacman -Qqe.
This could be useful if you e.g. want to install most of the packages on another system.

Update your system

Upgrade your entire system.

sudo pacman -Syu

Do this daily to weekly, to stay up to date.

Delete the local database and download it again:

sudo pacman -Syy

You shouldn’t need to run this often, if you stay updated.
If pacman can’t find a package you want to install, run this.

Run the following every week or so

Delete unsued and obsolete packages from /var/cache/pacman/pkg where updates are downloaded to:

sudo pacman -Sc

This will free some space on /var.

Optimize pacman’s database to work faster:

sudo pacman-optimize

This will enable pacman to faster resolve dependencies of packages.

Delete all orphaned packages:

sudo pacman -Rsn `pacman -Qdtq`

A package is orphaned if no other package requires it and it wasn’t explicitly installed.

Be careful with this, it could delete packages that you want to keep. Double check!

Please comment below if you find any errors, typos or wrong tricks.