pacman

pacman

The package manager for Arch Linux, and the best package manager, in my opinion. Once I started using Pacman, I couldn’t go back to anything else. It’s just that fast. Well, Nala makes APT more usable and clean, but APT package installation is still slow.

Well, I said good things about it, but the flags are, man, I wouldn’t recommend it to anyone. It’s pretty bad. The only reason I use it is it because my younger self thought it was cool and so, I kind of learnt it.

In case you find pacman syntax hard, you can try a wrapper script I made for pacman named pac: https://github.com/theophinetheodore/pac

-Syu: Update the repos & upgrade the system

➜ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
:: Starting full system upgrade...
 there is nothing to do

In this case, all the packages are up-to-date.

-S: Install a package

➜ sudo pacman -S jq
resolving dependencies...
looking for conflicting packages...

Package (2)      New Version  Net Change  Download Size

extra/oniguruma  6.9.10-1       0.88 MiB       0.22 MiB
extra/jq         1.8.1-1        0.45 MiB               

Total Download Size:   0.22 MiB
Total Installed Size:  1.33 MiB

:: Proceed with installation? [Y/n] 

-Rs: Remove a package & its dependencies

➜ sudo pacman -Rs nodejs # begone javascript!

-Ss: Search for packages

➜ pacman -Ss ffmpeg
extra/ffmpeg 2:8.0.1-2 [installed]
    Complete solution to record, convert and stream audio and video
extra/ffmpeg4.4 4.4.6-3
    Complete solution to record, convert and stream audio and video
...

-Si: Display information of a package

➜ pacman -Si fzf
Repository      : extra
Name            : fzf
Version         : 0.67.0-1
Description     : Command-line fuzzy finder
Architecture    : x86_64
URL             : https://github.com/junegunn/fzf
Licenses        : MIT
Groups          : None
Provides        : None
Depends On      : bash
Optional Deps   : fish: fish keybindings
                  tmux: fzf-tmux script for launching fzf in a tmux pane
                  vim: plugin
                  zsh: zsh keybindings
Conflicts With  : None
Replaces        : None
Download Size   : 1602.26 KiB
Installed Size  : 4679.73 KiB
...

Prevent packages from being upgraded

You could either temporarily ignore packages by doing this:

sudo pacman -Syu --ignore=linux-zen,linux-firmware

Or by adding them to IgnorePkg in /etc/pacman.conf:

IgnorePkg = linux-zen linux-firmware

Orphaned packages

Checking for orphaned packages:

pacman -Qdttq

If any are found, you could run this command to remove those packages:

sudo pacman -Rns `pacman -Qdttq`
# OR
pacman -Qdttq | doas pacman -Rns -

Checking pacman cache size

du -sh /var/cache/pacman/pkg

-Scc: Clear pacman cache

Caution

Please proceed with caution. There might be instances where keeping your cache could be of help, if your Arch installation is broken, and you need to downgrade. I, on the other hand, like to live dangerously.

sudo pacman -Scc

Extras #1: yay

yay is a pacman-like package manager for the AUR. Installation instructions can be found in the GitHub readme itself. If you use EndeavourOS or if you have Chaotic-AUR repo enabled, you can install yay directly from pacman.

Extras #2: pacgraph

Pacgraph is a tool that draws a graph of installed packages. It supports Arch, Debian, Redhat and Gentoo.

When pacgraph is executed, it produces an SVG named pacgraph.svg which looks something like this:

image

pacgraph also provides a text-only version when executed with the -c flag:

➜ pacgraph -c

Extras #3: downgrade

As the name suggests, downgrade lets you downgrade packages from your cache or from the ALA (Arch Linux Archives).

Example:

sudo downgrade fzf