Arch Linux: Package Manager

 15th October 2022 at 6:50pm

pacman

Reference

Remove all the cached packages that are not currently installed:

pacman -Sc

Remove all the cache:

pacman -Scc

Clean the cache automatically after pacman transactions:

# /etc/pacman.d/hooks/remove_cache_packages.hook
[Trigger]
Operation = Remove
Operation = Install
Operation = Upgrade
Type = Package
Target = *

[Action]
Description = Keep the last cache and the currently installed.
When = PostTransaction
Exec = /usr/bin/paccache -rvk2

Pacman/Tips and Tricks 里面提供了一系列日常维护的命令:

  • 清理孤儿包:pacman -Qtdq | pacman -Rns -
  • 找到更多可能清理的包:pacman -Qqd | pacman -Rsu --print -

yay

yay 表示 yet another yaourt,是个用 go 写的程序。

Install

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg
sudo pacman -U yay-*.tar.xz

Usage

Examples here.

Present package-installation selection menu:

yay <Search Term>

Upgrade All AUR Packages:

yay -Syu --aur --noconfirm --sudoloop

Print system statistics:

yay -Ps

Clean unneeded dependencies:

yay -Yc