← 返回命令列表

Linux command

paccache 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Remove all but the 3 most recent package versions from the cache

sudo paccache -r

Set the number of package versions to keep

sudo paccache -rk [num_versions]

Perform a dry run and show candidate packages for deletion

paccache -d

Remove all cached versions of uninstalled packages

sudo paccache -ruk0

Move candidate packages to a directory instead of deleting

sudo paccache -m [path/to/directory]

Dry run with verbose output

paccache -dv

说明

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.

参数

-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.

FAQ

What is the paccache command used for?

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.

How do I run a basic paccache example?

Run `sudo paccache -r` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -r, --remove do in paccache?

Remove candidate packages from the cache