Yes, I am feeling rather newb-ish, but I’d rather ask first instead of blindly running a command and possibly borking my system. I just want to know if these are safe, won’t accidentally remove anything important, and how frequently should they be used.
I found these on the Pacman Rosetta web page and dug deeper in the terminal: man pacman.
man pacman:
SYNC OPTIONS (APPLY TO -S)
-c, --clean
Remove packages that are no longer installed from the cache as well as currently unused
sync databases to free up disk space. When pacman downloads packages, it saves them in a
cache directory. In addition, databases are saved for every sync DB you download from and
are not deleted even if they are removed from the configuration file pacman.conf(5). Use
one --clean switch to only remove packages that are no longer installed; use two to remove
all files from the cache. In both cases, you will have a yes or no option to remove
packages and/or unused downloaded databases.
I did a test run:
[keith@end ~]$ sudo pacman -Sc
[sudo] password for keith:
Packages to keep:
All locally installed packages
Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove all other packages from cache? [Y/n] n
Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] n
[keith@end ~]$ sudo pacman -Scc
Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove ALL files from cache? [y/N] n
Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] n
[keith@end ~]$
The third one down with the capital N is a good warning not to run this one. Correct?
Thanks in advance for any help, advice, and feedback.
A usually recommended way to handle pacman cache is to keep at least the previous version of each one.
Example, keep a previous version and update your system; Imagine you rebooted and noticed some of your loved packages stopped working.
One thing you could do is downgrade, meaning, installing the previous version from your cache without the need to redownload it to make your program resume working.
A not so agressive approach is to use paccache, for example paccache -rk1 this will keep the current version + 1 previous in your cache.
I don’t consider using pacman -Scc a risk, but i don’t think is necessary.
i keep my cache to a minimum, got a paccache-hook from aur, only keep the two last versions, so always able to downgrade to a point dont need to go far back after all…
I use one previous version just in case something goes wrong so I can roll back. if you go in /var/cacche/pacman/pkg you will see a lot of packages. There’s no need for most of them. You can have one or 2 previous versions that you know work just in case and remove the rest.
I gladly let @fernandomaroto get the credit
He answered first so it only seems fair. The most important thing is that you got the help you needed though
Only to add, and not to prune by pruning directly with -rk0, -rk1, -rk2, … the command can be used -d in order to see the amount or volume of cache, then it would be:
sudo paccache -d
[sudo] password for judd:
==> no candidate packages found for pruning →(in my case)
My self i use the aur version because im lazy also there are some additional configs in /etc/ currently using 2 hooks also for arch news, but is a good learn full video !