A Guide to Using the Pacman Package Manager

Install and Manage Packages on Arch Linux and Manjaro

Pac-Man Championship Edition DX
Bandai Namco

In previous articles, we have shown you how to install applications on Debian based Linux distributions using apt-get and we have also shown you how to install applications on Red Hat based Linux distributions using yum.

In this guide, we will show you how to install packages using the command line within Arch-based Linux distributions such as Manjaro.

Which Applications Are Installed on Your Computer

You can view a list of all the packages installed on your system using the following command:

pacman -Q

This will return a list of all the applications on your computer and their version numbers.

Pacman list installed packages

Viewing the Change Log for an Installed Application

You can retrieve more information about a package or indeed packages by supplying various query options as follows:

pacman -Qc firefox

View Packages Installed As Dependencies for Other Packages

The previous command will show you the changelog for Firefox if it exists. If it doesn't exist a message will be displayed telling you that no changelog is available.

pacman -Qd

The above command shows you all the files that are installed as dependencies to other packages.

Pacman list installed dependency packages

This will show you all the orphaned dependencies installed on your computer.

pacman -Qdt

View Explicitly Installed Packages

If you want to see all of the explicitly installed packages use the following command:

pacman -Qe

An explicit package is one that you actually chose to install as opposed to a package that was installed as a dependency to other packages.

Pacman list explicitly installed packages

You can see which explicit packages have no dependencies by using the following command:

pacman -Qet

View All the Packages in a Group

To see which groups installed packages belong to you can use the following command:

pacman -Si <package name> | grep -i groups

This will list all of the groups that a package belongs to.

If you want to see all the packages in a particular group you can specify the group name:

pacman -Sg xfce4

Return Information About Installed Packages

If you want to know the name, description and all other manner of details about a package use the following command:

pacman -Qi firefox
Pacman output package information

The output includes:

  • name
  • version
  • description
  • architecture
  • URL to package's website
  • License
  • Groups
  • Provides
  • Depends On
  • Optional Deps
  • Required By
  • Optional For
  • Conflicts With
  • Replaces
  • Installed Size
  • Name Of Packager
  • Build Date
  • Install Date
  • Install Reason
  • Install Script
  • Validated

Find All Files Owned by a Package

You can find all the files that are installed by a specific package using the following command:

pacman -Ql firefox

This returns the package name and the path to files that it owns. You can specify multiple packages after the -l.

Pacman list package files

If you want to check which files a package you haven't installed yet would install and where, run the following:

pacman -Fl firefox

Then, if you want to check the location of the binary executable file owned by a package, use the '-Qo flag.

pacman -Qo firefox
Pacman list files owned by package

Find Packages Not Found in the Sync Databases (i.e. Installed Manually)

You can find manually installed packages using the following command:

pacman -Qm

Packages installed using yaourt such as Google Chrome will be listed using this command.

Find Packages Only Available in the Sync Databases

This is the inverse to the previous command and only shows packages installed via the sync databases.

pacman -Qn

Find Out of Date Packages

To find packages that need to be updated, use the following command:

pacman -Qu

This will return a list of packages, their version numbers, and the latest version numbers.

How to Install a Package Using Pacman

To install a package, use the following command:

sudo pacman -S <package name>

You may need to use the sudo command to elevate your permissions for this command to run. Alternatively, switch to a user with elevated permissions using the su command.

Pacman install package

When a package is available in multiple repositories you can choose which repository to use by specifying it in the command as follows:

Installing a package with Pacman will automatically download and install any dependencies.

You can also install a group of packages such as a desktop environment like XFCE.

When you specify a group name the output will be along the lines of:

pacman -S xfce4

Repository extra

1) exo 2) garcon 3) gtk-xfce-engine

You can choose to install all the packages in the group by pressing return. Alternatively, you can install individual packages by providing a comma-separated list of numbers (i.e. 1,2,3,4,5). If you want to install all the packages between 1 and 10 you can also use a hyphen (i.e. 1-10).

How to Upgrade Out of Date Packages

To upgrade all of the out-of-date packages use the following command:

pacman -Syu
Pacman update system

Sometimes you want to upgrade the packages but for one particular package, you want it to stay at an older version (because you know the newer version has removed a feature or is broken). So, if Firefox was causing the problem, you could use the following command for this:

pacman -Syu --ignore=firefox

Show a List of Available Packages

You can view a list of the available packages in the sync database with the following command:

pacman -Sl

That will display an absolutely monstrous list, so it's better used with 'grep' to search.

pacman -Sl | grep -i wine

Display Information About a Package in the Sync Database

You can find detailed information about a package in the sync database using the following command:

pacman -Si

Search for a Package in the Sync Database

If you just want to search for a package in the sync database use the following command:

pacman -Ss wine

The results will be a list of all available packages matching the search criteria.

Pacman search available packages

Refresh the Sync Database

You can make sure the sync database is up to date using the following command:

pacman -Sy

This should be used prior to running the upgrade command. It is also useful to run this if you haven't done it in a while so that when you search you are getting the latest results.