- Pacman Command in Arch Linux
- Intro
- Installing Packages using the Pacman
- Removing packages using the Pacman
- Upgrading packages
- Searching for a Package
- Cleaning the Package Cache
- Installing local packages
- Troubleshooting
- Garuda
- Reference
- Pacman Commands Cheat Sheet for Arch Linux
- Updating and Upgrading Arch Linux
- Install Package(s) in Arch Linux
- Remove Package(s) in Arch Linux
- Query Package(s) in Arch Linux
- Arch Linux Pacman Cheat Sheet
Pacman Command in Arch Linux
I’ve recently started using a Arch Linux distribution Garuda Linux and the package management tool is pacman this article summarizes the most common actions with based on the following article from GeeksforGeeks.
Intro
Pacman is a package manager for the arch Linux and arch-based Linux distributions. If you have used Debian-based OS like ubuntu, then the Pacman is similar to the apt command of Debian-based operating systems. Pacman contains the compressed files as a package format and maintains a text-based package database. Pacman keeps the system up to date by synchronizing package lists with the master server. Pacman can install the packages from the official repositories or your own build packages.
Installing Packages using the Pacman
When we install any new operating system on our machine, the first task we do is to install the software packages on the system. Now, to install the packages on Arch Linux, use the command Pacman with -S option and mention the package name. The -S option tells the Pacman to synchronize and to continue. Here is one example
We can mention the many package names after the -S option, separated by space.
sudo pacman -S package1 package2 package3
Then Pacman will show the download and install size of the package and ask for to proceed, then simply press the Y key. Pacman categorizes the installed packages into two categories.
- Implicitly Installed: The package that was installed using the -S or -U option.
- Dependencies: The package is installed because it is required by another package.
Removing packages using the Pacman
When we don’t need the package anymore, then we should remove the package from the system. To remove the package with all its dependencies which are not required by other packages, use the following command:
To remove the package without removing its dependency use the following command:
To remove the dependencies which are not required anymore, use the following command:
Upgrading packages
In arch Linux, we can upgrade the full system by only one command using the Pacman. Use the following command to update the system:
Let’s understand the meaning, S tell the pacman to synchronize the local database with the main database. u tells the pacman to upgrade the packages and y update the local catch on the system. Basically, this command synchronizes the local pacman database with the main repository database and then updates the system.
Searching for a Package
Now let’s see how we can search the package into the database of pacman. To search query in the name and description of the package in the database use the following command:
To search into already installed packages on the system, use the following command:
To search the query into the local database use the following command:
Cleaning the Package Cache
When pacman downloads the packages it stores the packages into the /var/cache/pacman/pkg/ and while uninstalling the package pacman does not delete these files. Pacman uses these files to downgrade the package or install the package. But it can take a lot of space to store these packages. So to delete the stored packages, use the following command:
To remove all stored packages and cache, use the following command:
Installing local packages
By using pacman we can install packages other than the main repository of Arch Linux. Use the following command to install the packages
sudo pacman -U path_to_file.pkg.tar.xz
sudo pacman -U http://www.example.com/repo/example.pkg.tar.xz
Troubleshooting
Sometimes installing the packages with pacman we face some errors. Following are the mainly occurred errors with pacman:
- Conflicting file error: This error occurs due to some conflict packages present in the repository. To solve this error we can manually rename the file or force the overwrite function. We can use the following command to overwrite the function:
- pacman -S —overwrite glob package
Garuda
Garuda also brings a useful command update that abstracts all this interactions to keep your rolling system updated, still very important to understand the command line utilities to manage the packages and check the official man page for further details as this is always evolving.
Reference
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:
To update and upgrade your Arch Linux system, go with the following command:
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.
To install an identified package, adhere to the following command:
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:
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:
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.