Empty the pacman cache (Arch Linux and related distros)

Forums: 

Please don't think I'm rushing you to implement these. I just want to write them out on this message board before I forget about them. So no rush from me!

Here is a cleaner that would help greatly on Arch Linux (and Arch-based distros). It has freed up 1.7 GB for me one time, since my cache kept growing. It's a single command that must be run as root, just like the APT cleaner that BleachBit supports. It's not recommended to clean the pacman cache if you wish to downgrade packages, or re-install them, since then they must be re-downloaded again. But this is true for APT, YUM, Zypper, and all other package managers. So it's up to the user to decide if it's worth it.

The command is a single line:
pacman -Scc ---noconfirm

The "--noconfirm" option bypasses the "Are you sure?" checks.

I'm not sure how BleachBit would hide/display this cleaner though. It could possibly check to see if this directory exists: /var/cache/pacman/pkg/

Or maybe if this file exists: /usr/bin/pacman

I'm willing to test this out to make sure it's safe if you decide to add it in a beta release.

I want to also add, deleting everything under /var/cache/pacman/pkg/ won't always work, since users can manually specify their own custom pacman cache folder. Therefore, using the "pacman -Scc --noconfirm" command is the best approach.

I submitted a new cleaner here: https://bugs.launchpad.net/bleachbit/+bug/707822

It doesn't make use of commands, which the APT cleaner does (apt.autoremove).

It uses absolute paths right now. If there's a way to use variables or the commands directly, that would be better. (pacman -Scc --noconfirm)