Default command line way to install,remove,list packages

Some pacman options worth remembering

Options What it does
-Syu perform a full update (you should use this when updating).
-Syyu force download of package database and then update. This is typically only necessary after changing your mirror list.
-Syuu will perform a full update, allowing downgrade of packages (use only when the update announcement tells you to, or when you’re trying to fix some problem and know what you’re doing). There is also -Syyuu
-Syuw download the packages to make them ready to update, but do not perform the update. Useful when you’re having a bad internet connection, or want to do download the packages before updating in the TTY. After, use -Su to apply the updates.
-Sy or -Syy This only refreshes the local package database, without downloading and installing the updates, and it’s generally a bad idea to use -Sy or -Syy alone, without u. That can cause you quite a bit of trouble with partial upgrades. Another way the database can get refreshed without updating is when you answer n after running pacman -Syu. This is equally bad. For checking whether there are any updates available, use checkupdates command.
-S package_name install the package from the repos. It’s a good idea to do an update before installing new packages.
-U path/to/package install the package from a file.
-R package_name uninstall the package, but leave dependencies.
-Rns package_name uninstall the package, and its dependencies. This is what I typically use for uninstalling programs.
-Rcns package_name uninstall the package and remove dependencies and remove all packages that depend on that package, and most of the config files (might remove more than you want to, use with caution).
-Sc clear the pacman cache for packages that are no longer installed.
-Scc clear the pacman cache (use only if you’re desperate for disk space, because you won’t be able to downgrade packages).
-Ss package_name search the repos for the package (won’t make any changes to your computer)
-Q list all installed packages.
-Qe list only the packages you explicitly installed.
-Q package_name check whether this package is installed. If you don’t know the exact name of the package, a good tip is `pacman -Q
-Qi package_name print some info about the installed package.
-Qm list foreign packages (those installed from files, including those from the AUR).
-Qn list packages installed from the repos.
-Si package_name print some info about the package in the repos.
-Ql package_name list all the files owned by the package
-Fx path/to/file discover which package owns the file
-Qdtq list orphaned packages (you can remove them using -R, but keep in mind, just because a package is orphaned, doesn’t mean it is not useful: remove only those you do not need).

I think those are pretty much all of the everyday useful options. There are many more options, but an average user will probably not need them often enough that they are worth remembering. When needed, you can just read the manual: man pacman.

37 Likes