You are not logged in.
Pages: 1
Topic closed
Is there a way to remove only those packages from the pacman cache which are not installed in the system? That is, supposing I install gnome-desktop and later choose to remove it, the package will still remain in /var/cache/pacman/pkg. Is there a way to delete all such packages from the cache?
Offline
I recently wrote the following script to do the same thing. It only list the package to remove. You'll need to remove them manually or modify the script.
#!/bin/bash
for i in $(ls -1 /var/cache/pacman/pkg);do j=${i%-*};pacman -Q ${j%-*}|grep found;done
Offline
Thanks for the script, it help me free some 100 odd MB on y disk
Offline
Eventhough that this is a quite old post, I want to refer people to the very useful tool paccache which removes all older versions up to the most recent (default: 3) packages.
Summarizing: (I have not tested it myself)
To remove all cached versions of uninstalled packages, re-run paccache with:
# paccache -ruk0
Another reason is that the script from Snowman is not working (at least not on my machine). I had to change his code to do the following:
for i in $(ls /var/cache/pacman/pkg/*);do j=${i:22}; k=${j%-*}; l=${k%-*}; m=${l%-*}; pacman -Q $m | grep found ;done
Explaining the code: The variable j removes the path, the variables k, l, and m remove the ending after the hyphens. So we are left with only the package name when checking the installed version with pacman -Q.
Offline
Please don't necrobump: https://wiki.archlinux.org/index.php/Co … bumping.22
paccache is alos well documented in the wiki.
Closing
Offline
Pages: 1
Topic closed