Using Pacman on Arch-Linux Distributions
Overview
Pacman is the package manager for Arch-Linux distributions.
- Its fast. Very fast.
- Its pretty (at least I think so).
- You can easily manage repositories, whether official or custom.
But, one thing it is not is intuitive. So, I made some notes for a reference while learning Garuda Linux.
Command Structure
|
|
Use pacman {-h --help}
with an operation for available options.
Cheat Sheet
Quick Cheat Sheet Snippets Reference.
Everyday Packagement
Search for a package:
pacman -Ss hugo
Install a package:
pacman -S hugo
Install or update a package:
pacman -Syu hugo
Remove a package:
pacman -Rsc hugo
Everyday Package Queries
Search installed packages for keywords:
pacman -Qs <query>
List information on a package:
pacman -Qii hugo
List all explicitly install packages:
pacman -Qe
List files associated with a file:
pacman -Ql hugo
Finding Dependencies
What does a package depend on?
pactree hugo
What packages depend on a package?
pacman -r hugo
Finding and Removing Orphaned Packages
List unneeded or orphaned packages:
pacman -Qdt
Remove unneeded or orphaned packages:
pacman -Rns $(pacman -Qdtq)
Pacman Performance
Some tips for increasing performance.
Update the Mirror List
Avoid slow downloads and time-out errors while installing and updating packages by updating the mirrorlist file. For this we can use:
Reflector does the heavy lifting for us. Lets use that.
Reflector is a python script that,
- checks and retrieves the most up-to-date mirror list for each country.
- can sort by speed and age.
- can update the mirror list file automatically:
/etc/pacman.d/mirrorlist
.
Set the mirror list according to your country.
List unneeded or orphaned packages:
reflector --list-countries
Sample Output:
|
|
sudo reflector --country 'NZ, AU' --sort rate --save /etc/pacman.d/mirrorlist
Updating the mirror list and sorting by download rate.
--country
New Zealand and Australia.--sort
Sorting by download rate.--save
Saving to/etc/pacman.d/mirrorlist
.
Parallel Downloads.
Garuda Linux has parallel downloads on by default (5). You can check the setting here: /etc/pacman.conf
sudo nano /etc/pacman.conf
Under [options]
, add or adjust the ParallelDownloads parameter.
- Recommend setting to
5
.
|
|
Summary
Pacman Power-Up!
|
|
Nice!