Home Arch Linux Pacman Commands Cheat Sheet for Arch Linux

Pacman Commands Cheat Sheet for Arch Linux

One uniqueness or key identifier of different Linux distributions is in the package manager they use to update, install, configure, and uninstall various targeted software packages. In Arch Linux, the package manager is called Pacman.

This tutorial seeks to walk you through some commonly used and unique Pacman commands that will make your Arch Linux interaction and experience easier and much more memorable.

It is highly advisable to be a root user or have Sudoer user privileges on your Arch Linux system to fully benefit from what the Pacman command has to offer.

Updating and Upgrading Arch Linux

If you only want to update the software database of your Arch Linux system, go with the following command:

$ sudo pacman -Syy
Update Arch Linux
Update Arch Linux

To update and upgrade your Arch Linux system, go with the following command:

$ sudo pacman -Syu
Upgrade Arch Linux
Upgrade Arch Linux

Install Package(s) in Arch Linux

If you have a specific package called an apache web server in mind that you wish to install, it is advisable to first search for the availability of the package. This step is useful because some Linux OS distributions identify common packages differently.

$ sudo pacman -S apache
Search for Package in Arch Linux
Search for Package in Arch Linux

To install an identified package, adhere to the following command:

$ sudo pacman -Ss apache

Supposing you have a local package or one that you have downloaded from a website and wish to install it, you need to adhere to the following command.

$ sudo pacman -U /path/to/your/installable/package

For all repo-based packages re-installation (during emergencies), implement the following command.

$ sudo pacman -Qnq | pacman -S -

Remove Package(s) in Arch Linux

To remove or uninstall a specific Arch Linux installed package, adhere to the following command.

$ sudo pacman -R name_of_package

To remove or uninstall an Arch Linux package together with its dependencies not tied to other active packages, reference the following command syntax:

$ sudo pacman -Rs name_of_package

To uninstall a specific Arch Linux package, remove its global configuration, and avoid its orphaned dependencies, use the following command syntax.

 
$ sudo pacman -Rns name_of_package

Query Package(s) in Arch Linux

You might wish to retrieve some information about an installed package. The command syntax to use is as follows:

$ pacman -Qi name_of_package

For the apache package we installed earlier, we can get the following info about it:

$ sudo pacman -Qi apache

We can also query about an installable package and its associated dependencies via the command syntax:

$ sudo pacman -Sii name_of_package

To list installed packages, execute the command:

$ sudo pacman -Qn
List Installed Packages in Arch Linux
List Installed Packages in Arch Linux

Arch Linux Pacman Cheat Sheet

Following are the list of commonly used commands for the Pacman package manager in Arch Linux.

Command Description
sudo pacman -Syy Update package list
sudo pacman -Syu Update and upgrade all
sudo pacman -S pkgname Install specific package
sudo pacman -Ss keyword Find available packages
sudo pacman -Qs keyword Find available local packages
sudo pacman -Ql pkgname List all files from a package
Sudo pacman -Rsc pkgname Uninstall a package
sudo pacman -Qii pkgname List information on package

With the Pacman command cheat sheet, you should be comfortable enough to take your Arch Linux OS experience to the next level.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

4 thoughts on “Pacman Commands Cheat Sheet for Arch Linux”

  1. The command sudo pacman -Rsc translates as follows

    • -R => Remove
    • -s => recursive
    • -c => cascade (remove all target packages as well as packages that depend on them).

    So, pacman -Rsc is asking to purging an install. -Rs might be safer unless you know you won’t inadvertently delete something you need to keep.

    Reply
  2. Nice article, just a couple of things; sudo isn’t needed when querying the database, but only to install and/or remove pkgs. Also, the correct syntax to install is *sudo pacman -S*, one -S- not 2.

    Another thing, you made a typo here:

    *For the leafpad package we installed earlier, we can get the following info about it:

    $ sudo pacman -Qi apache*
    

    You mentioned leafpad, but in the example used *apache*, and again, no need for sudo.

    Reply
      • You’ve mixed up your examples for querying package and installing a package. You have -Ss in your install example, which is the query package command and you have -S in your query example, which is the install package command.

        Reply

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.