LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

paccache

cache cleaning utility for pacman, the Arch Linux package manager

TLDR

Remove all but the 3 most recent package versions from the cache
$ sudo paccache -r
copy
Set the number of package versions to keep
$ sudo paccache -rk [num_versions]
copy
Perform a dry run and show candidate packages for deletion
$ paccache -d
copy
Remove all cached versions of uninstalled packages
$ sudo paccache -ruk0
copy
Move candidate packages to a directory instead of deleting
$ sudo paccache -m [path/to/directory]
copy
Dry run with verbose output
$ paccache -dv
copy

SYNOPSIS

paccache [options] [targets...]

DESCRIPTION

paccache is a cache cleaning utility for pacman, the Arch Linux package manager. It removes old package versions from the pacman cache directory (/var/cache/pacman/pkg/) while preserving recent versions for potential rollbacks.By default, it keeps the 3 most recent versions of each package. This helps reclaim disk space while maintaining the ability to downgrade packages if needed. The tool can target all cached packages or only those no longer installed on the system.

PARAMETERS

-r, --remove

Remove candidate packages from the cache
-d, --dryrun
Perform a dry run, only listing candidates
-k, --keep num
Keep num versions of each package (default: 3)
-m, --move dir
Move candidates to dir instead of removing
-u, --uninstalled
Target uninstalled packages only
-c, --cachedir dir
Specify alternate cache directory
-a, --arch arch
Filter packages by architecture
-v, --verbose
Show removed or moved packages
-q, --quiet
Minimize output
-f, --force
Apply force to mv and rm operations.
-i pkgs, --ignore pkgs
Specify packages to ignore, comma-separated. Use "-" to read from stdin.
--nocolor
Remove color from the output.
--notime time
Keep packages with an atime/mtime not older than time, even if exceeding --keep.
-z, --null
Use null delimiters for output.
-h, --help
Display help message.

CAVEATS

Requires appropriate permissions to modify the pacman cache (typically root). After aggressive cleaning, downgrading packages may require re-downloading older versions. Consider keeping at least 1-2 versions for critical packages.

HISTORY

Part of pacman-contrib, a collection of scripts for pacman previously included in the main pacman package. Split into a separate package to keep the core pacman lean. Essential for Arch Linux system maintenance where the cache can grow substantially over time.

SEE ALSO

pacman(8), pactree(8), pacdiff(8)

Copied to clipboard
Kai