What is Pacman Package Manager

Linux TLDR
Last Updated:
Reading time: 3 minutes

You are Arch based users, so I expect that you already know about the Pacman package manager; if not, it’s just a built-in command line tool to manage your system packages just like Apt and DNF for Debian and RedHat.

Tutorial Details

DescriptionPackage Manager Utility
Difficulty LevelLow
Root or Sudo PrivilegesYes
OS CompatibilityArch, Manjaro, EndeavourOS, etc.
PrerequisitesPacman
Internet RequiredYes

Update Package Database

The Arch system stores a local database that records package release information that can be updated to the current release information by using the following command:

$ sudo pacman -Sy

Upgrade System Installed Packages

Upgrade system installed packages to their latest release from the record available on your local database.

$ sudo pacman -Syu

Update and Upgrade All Packages

Updates and upgrades can be done at the same time by using the following command:

$ sudo pacman -Syyu

Searching Packages

Search for the package available for your Linux system by specifying the package name.

$ pacman -Ss [PACKAGE-NAME]

Searching for Local Packages

You can easily search for locally installed packages by specifying their names in the following command:

$ pacman -Qs [PACKAGE-NAME]

Remote Search Packages

Search the package remotely by using the -F flags as shown.

$ pacman -F [PACKAGE-NAME]

Package Dependencies Tree

View the complete package dependency list by using the following command:

$ pactree [PACKAGE-NAME]

List of Installed Packages

Get the complete list of installed packages by using the following command:

$ pacman -Q

Package Information

Get the descriptive package information by specifying its name in the following command:

$ pacman -Qi [PACKAGE-NAME]

Installing Packages

Install a package available for your system that has a record in your local database by using the following command:

$ sudo pacman -S [PACKAGE-NAME]

Multiple packages can be installed by specifying each one with a space.

$ sudo pacman -S [PACKAGE-ONE] [PACKAGE-TWO]

Install Packages from the Alternative Repository

If your required version is not available in the current repository, then specify the repository that holds your interested package version by using the following command:

$ sudo pacman -S extra/[PACKAGE-NAME]

Install Packages with the Command Pattern

If you want to install the packages that share a common pattern, then specify each under the curly bracket, separated with a comma, as shown.

$ sudo pacman -S python-{pip,pytest,tkinter}

Download Packages

You can download packages in β€œ.tar.xz.zst” compressed file format to install them on system without internet access.

$ sudo pacman -Sw [PACKAGE-NAME]

Install Local Downloaded Packages

If you downloaded a compressed file in the”.tar.xz.zst” format, you must specify its full path to install it.

$ sudo pacman -U /path/to/package.tar.xz.zst

Install Packages from a Remote Location

If you find a package available remotely, you can easily install it by specifying the HTTP path of the package.

$ pacman -U http://www.example.com/repo/package.pkg.tar.zst

Removing Packages

Execute the following command to remove a package from your system.

$ sudo pacman -R [PACKAGE-NAME]

Removing Packages with Dependencies

Most packages require dependencies to work properly, but removing them using the β€œ-R” flag does not remove the dependencies. To completely remove them, use the following command:

$ sudo pacman -Rs package

Removing Unused Dependencies

You usually remove the packages, forgetting to remove their dependencies, which do not cause any trouble except that they consume storage resources, so remove them using the following command:

$ pacman -Qdtq | pacman -Rs -

Removing Cache

Cache is stored to improve the process of installing packages; however, outdated version of package information in cache may install the old version of the package.

To remove all cached files except the three most recent packages, use the following command:

$ paccache -r

To remove the complete cache, use the following command:

$ pacman -Scc

And here we are done. If you have questions, feel free to tell us in the comment section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.