Arch Linux is a popular Linux distribution that is revered for its simplicity and continuous version. It removes a lot of apps that come with other distributions and you are free to install the apps you want and need. However, you will need to be comfortable with its package manager – Pacman.
The Pacman Package Manager provides users with an easy way to manage packages. Packages can be managed from official repositories or a user’s own builds with Pacman. Follow this guide to master Pacman for Arch Linux.
To update the system and all installed software, use the command:
To force a full refresh of the package database and update the system:
Search for packages
If you want to install a package but can’t remember the package name, you can search by keyword directly from the terminal.
For example, if you want to install gimp, you can search to see what the available packages are called.
To find installed packages:
Package / software installation
You can use the command below to install one or more packages:
However, it is better to update the system before installing packages. Use the following command to update and install the software:
Installing packages from third-party sources
You don’t always install packages from remote repositories. To install packages from a local directory, use the following:
If you want to install a package from an unofficial repository, you can use the following command:
List of installed packages
If you just want to see all the packages installed on your system, use the command:
There are times when you want to download a package but not install it. Use this command:
Uninstall the package / software
Removing packages goes hand in hand with installing packages. To remove a package and leave its dependencies behind, use the following command:
If you want to remove a package and its dependencies that are not used by other packages, run this command:
To find orphaned files:
You can combine it with the following command to remove unused packages / orphans and their configuration files:
Remove everything except the base system
It’s kind of a way to start from scratch. If it is necessary to “reset” your system, the next two steps will make it easy for you to do so.
First, we need to make all installed packages a “dependency”:
Next, we need to change the reason for installing essential packages (base system) to “also explicitly”, so that they are not treated as orphans and are removed:
Finally, we will delete all the “orphan” files:
Clear package cache
Pacman does not automatically remove old or uninstalled versions of packages. This allows for easy downgrades and easy reinstallation from the cache folder. However, as the cache grows inside it can get out of hand. We have a dedicated post on how to clear Pacman’s cache, but here’s the gist:
This command clears all cached versions of installed and uninstalled packages except the three most recent.
To simply clear the cached packages that are not currently installed, run the following:
If you want to completely clear your cache, run the command below. This will leave your cache folder completely empty.
Please note that this is by no means an exhaustive list. The possibilities are endless with Pacman, and you will need to spend some time familiarizing yourself with other commands not mentioned here. however, Arch Linux documentation is excellent and is a good point of reference. That being said, we’ve given you a solid foundation here. Learn these commands and you will be thoroughly proficient with Arch Linux.
Is this article useful?