This guide shares some basic knowledge about Pacman for beginners and professional programmers alike. It covers all the domains that you might need while operating in Arch Linux with Pacman. These commands can help make the management of your Arch-based packages in Linux more efficient and convenient.
Requisite Pacman Commands
If you are operating Pacman on Arch Linux, then to boost the usage of this dynamic package manager, you must be aware of the following commands:
- Installing a package with Pacman
- Removing installed packages
- Upgrading a package
- Searching for a package
- Cleaning the package cache
- Installing a local package
- Troubleshooting
These commands encompass the usage of Pacman proficiently and are the prominent commands you might need to understand to tackle using Pacman.
Installing a Package with Pacman
It is a primary domain that you will opt for after selecting the Arch Linux package manager. To get software from the system repository or build a package, the first step is to install it using Pacman. The Pacman command for installing single or multiple packages is as follows:
The last set of dots represents continuity in the command. You will need to replace the package name in the above command to install it on your system. Sync the installed package before classifying it as a dependency or explicitly installed package through the -S and -U commands.
Removing Installed Packages
To remove an installed package in Arch Linux, you have three main options:
- Remove the package only
- Remove the package along with its dependencies
- Remove the dependencies only
To remove the package only, issue the following command:
-R signifies the removal command.
To remove the package along with its dependencies, issue the following command:
To remove dependencies from your server, issue the following command:
Upgrading a Package
In other Linux distributions, the apt command performs package updating. In Arch Linux, a single command in Pacman not only updates but also syncs and refreshes system packages. The following command upgrades configured packages only and does not update local packages available on the system:
Here, -y refreshes the system and -u is for package upgrading. The literal meaning of this command is to sync the package with the database of the main server, then refresh the package connected to the database. Lastly, this command updates the package if an update is available. Keep in mind that you must opt for full updates, as partially updated packages are not compatible with Arch Linux.
Search for a Package
Pacman is also efficient in searching the packages in your server database based on the name and description of the required package.
If you are looking for a package that already exists in your system, then apply the following code. You can add other strings in this code after string2 simultaneously.
-Q symbolizes the package search in the local database.
-F finds the remote packages in the database.
Cleaning the Package Cache
In Arch Linux, Pacman does not delete previously installed packages from its storage. So, you will need to input the following command to clear the cache of your database. This command deletes unsynchronized packages.
To clear all the files in the cache, input the following command:
Installing a Local Package
When using Pacman, you only need to install local and remote packages outside the jurisdiction of the server repository. The following code will install the local package after searching the remote depository.
$ pacman -U http://www.example.com/repo/example.pkg.tar.xz
The second code can install the remote packages that do not exist in the official depository.
Troubleshooting
You may confront any of the following three error types while working with Pacman in Arch Linux:
- Conflicting file error
- Invalid package
- Locking database
The conflicting file error occurs due to the presence of a conflicting file in the repository. You can either rename the file manually or force the overwrite function. The following command is used for the overwrite function:
The invalid package error surfaces due to the partial update of the package. It is better to look for the package description before installing it.
The locking database error occurs due to an interruption in altering the database.
Run the above command to detect the clash in the locking process. And then, you can return to locking the database.
Conclusion
Pacman is the package manager of Arch Linux that assists in the installation and management of packages and build systems. If you follow this guide, then it will be easy for you to operate Pacman with maximum efficiency in your Arch Linux system. This guide has covered most of the commands that you need to know when using Pacman.
from Linux Hint https://ift.tt/3nQIxtT
0 Comments