How to fix "paccache command not found" error in Arch Linux

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to fix the error "paccache command not found" in Arch Linux.

Why does this error happen?

This error happen when you are trying to run paccache command to clean the cache packages in Arch Linux, without having paccache installed in your system.

Fix paccache command not found error easily

You can fix this error easily via three simple steps. To do so, simply follow the steps below.

Step 1 - Update your system

Before fixing this error, make sure that your Arch Linux system is updated. To update pacman database and your system, you can easily do so via the -Syu option.

sudo pacman -Syu

Step 2 - Install pacman-contrib

paccache script is part of pacman-contrib package, which means in order to be able to use the paccache script, you must install pacman-contrib package first.

pacman-contrib can be easily installed in Arch Linux.

To do so, simply run the command below.

sudo pacman -S pacman-contrib

Step 3 - Verify that error is fixed

pacman-contrib is now installed in your system, and you should be able to use paccache script.

To verify that the error "paccache command not found" is fixed, simply run the paccache command in your terminal.

For example, we encountered this error when we were trying to clean the cache packages from /var/cache/pacman/pkg/ via the paccache -R command.

So to verify that this error is fixed, we can simply run the command below to clean the cache packages.

paccache -R

By default pacache -r will delete all cached packages except the last three versions.

As you can see, the error "paccache command not found" is fixed, as the command above was successful.

To get the full list of commands that you can use with paccache, simply run.

paccache -h

Output

paccache v1.9.1

Flexible pacman cache cleaning utility.

Usage: paccache <operation> [options] [target ...]

Operations:
  -d, --dryrun      perform a dry run, only finding candidate packages
  -m, --move <dir>  move candidate packages to "dir"
  -r, --remove      remove candidate packages

Options:
  -a, --arch <arch>       scan for "arch" (default: all architectures)
  -c, --cachedir <dir>    scan "dir" for packages. can be used more than once
                          (default: read from /etc/pacman.conf)
  -f, --force             apply force to mv(1) and rm(1) operations
  -i, --ignore <pkgs>     ignore "pkgs", comma-separated. Alternatively, specify
                          "-" to read package names from stdin, newline-
                          delimited
  -k, --keep <num>        keep "num" of each package in the cache (default: 3)
      --min-atime <time>
      --min-mtime <time>  keep packages with an atime/mtime that is not older
                          than the time given, even if this means keeping more
                          than specified through the '--keep' option. Accepts
                          arguments according to 'info "Date input formats"',
                          e.g. '30 days ago'
      --nocolor           do not colorize output
  -z, --null              use null delimiters for candidate names (only with -v
                          and -vv)
  -q, --quiet             minimize output
  -u, --uninstalled       target uninstalled packages
  -v, --verbose           increase verbosity. specify up to 3 times
  -h, --help              display this help message and exit
  -V, --version           display version information and exit

Conclusion

In this tutorial, you learned how to fix the error "paccache command not found" in Arch Linux.

By now you should be able to run paccache to clean cache packages in your Arch Linux machine.