Pacman Overview
Overview
Pacman is a package manager developed specifically for use in Arch Linux. It is used to install, upgrade, configure and remove software (i.e. to manage software packages). Pacman is used through typing commands terminal; all the commands listed below to undertake various tasks assume that you have your terminal open.
Basic Pacman Commands
This section provides the most common Pacman commands used to manage your system. Learning these will also provide an excellent foundation to build upon, particularly by referring to the Intermediate Pacman Commands section, below.
Updating the System
To update your system, enter the following command in the terminal:
sudo pacman -Syu
Synchronising with the Manjaro Repositories
Your Manjaro system has a database of all the software packages (e.g. system updates and applications) that are available from the official repositories. This is used to help pacman locate and download these packages for installation. When updating your system, its database will automatically be refreshed as well. However, using this command is more thorough, as rather than just refreshing or updating the database, it will actually rebuild it completely. To synchronise your database with the Manjaro repositories, enter the following command in the terminal:
sudo pacman -Syy
To simultaneously synchronise with the repositories and update your system, enter the command:
sudo pacman -Syyu
Searching for Software
It is also possible to use pacman to search Manjaro's software repositories for any desired software, provided you know the name of what you want. The sudo prefix is not required for this. To search for a software package in the Official Manjaro repositories, the basic syntax is:
pacman -Ss [software package name]
For example, to search the repositories to see if a text editor called Leafpad is available, the following command would be entered:
pacman -Ss leafpad
In addition, it is also possible to search for packages that have already been installed on your system. For basic information, enter the following command:
pacman -Q [software package name]
Otherwise, to gain far more comprehensive about an installed package, enter the following command:
pacman -Qi [software package name]
It is also possible to gain even more information, including related backup files as well as the date that the package was last altered by entering the command:
pacman -Qii [software package name]
Finally, for a list of all installed packages on your system, enter the following command:
pacman -Ql
Installing Applications and Software Packages
To install a software package, the basic syntax is:
sudo pacman -S [software package name]
For example, to download and install leafpad, the following command would be entered:
sudo pacman -S leafpad
Removing Applications and Software Packages
To remove a software package, the basic syntax is:
sudo pacman -R [software package name]
For example, to remove the software application Leafpad, the following command would be entered:
sudo pacman -R leafpad
It is also possible to remove package and its dependencies, provided those dependencies are not being used by any other packages. Deleting dependencies exclusive to a certain package is wise, as once the main package is removed, they will become orphans, serving no other purpose than to clutter up your system. To do so, enter the following command:
sudo pacman -Rs [software package name]
However, Pacman usually also creates backup configuration files when deleting packages. As such, for a more thorough (and cleaner) removal (ie. the package, its dependencies, and any configuration files usually generated by pacman) enter the following command:
sudo pacman -Rns
Learning pacman's options
It is a very good idea to become familiar with the varied and powerful uses of pacman. A comprehensive list of options that can be used with pacman can be found by entering the following command:
man pacman
To exit out of the list, simply press q.
Intermediate Pacman Commands
Once the pacman basics have been mastered, a few extra tricks can be learned in order to undertake a wider variety of tasks.
Troubleshooting
A separate page for pacman troubleshooting is available here.