bash-tutorial/tutorial/pacman.org

1.4 KiB

Checking and cleaning packages and package cache in Parabola GNUlinux

Check the number of packages in cache

Based on this link and on Arch linux Wiki

Open a terminal and run the code

  sudo ls /var/cache/pacman/pkg/ | wc -l
6000
  du -sh /var/cache/pacman/pkg/
7,3G var/cache/pacman/pkg

Remove packages in cache, keeping one version (last)

  paccache -rk1
==> finished 1146 packages removed (disk space saved: 4.04 GiB)

Remove all of uninstalled packages in cache

  paccache -ruk0

…90.88 Mib

Run this to see issues in the system

  journalctl -p 3 -xb

Removing unused packages by name

Let's say you want to delete the following packages:

  • zim
  • mpv
  • smplayer
  pacman -Rs zim mpv smplayer

List all installed packages

List and redirect the output to the file "pkglist.txt"

  pacman -Qqe > pkglist.txt

List all packages with size

  LC_ALL=C pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h