The use of repositories in Gnu / Linux is something very useful, so useful that smartphones have benefited from this operation and other proprietary operating systems such as Microsoft are trying to implement it. However, when it was implemented in Gnu / Linux, the Internet connection was slow and not only exist as many versions as there are currently.
This makes that in a short time, any Gnu / Linux distribution, gets filled with packages and files that are outdated and not used by the operating system. The situation is sometimes extreme and some installations can fill the hard drive with cached or unused packages.
That is why maintenance tools are becoming more and more common, but it is also true that Gnu / Linux distributions themselves contemplate these maintenance tasks. Today we are going to teach you how to clear the cache on distributions that use Pacman.
The Pacman tool is typical of Arch Linux, but it is also present in distributions that are based on Arch Linux such as Manjaro. In a rolling release distribution like Arch Linux, cleaning up useless packages is very important. For this we will use two commands named Paccache and Pacman -Sc. These tools have their benefits and their negative points, something that we will see next.
In the terminal it is executed as follows:
sudo paccache -r
This causes Arch Linux to flush all its packages except the last three versions. Something useful in case the latest version brings problems or if we want to reinstall the package. We must point out that normally the cleaning of these packages tends to assume cleaning installed, downloaded and uninstalled packages. It must be taken into account in case we want to install the package that we have removed later. In this case, as we have said, the last three versions will remain.
This Pacman command is quite useful but does not leave any copy or any package of the program. It does a thorough cleaning and that is the risk involved in using this tool. The execution of this command is as follows:
sudo pacman -Sc
This tool will not clean what we have installed in the distribution, so will leave our distribution optimized and with the strictly necessary space to install new programs or packages.
This does not mean that we use some tools born to clean our distribution, but if we do not want to use these tools or simply you just want to clear the cache of our Arch Linux, these Pacman commands are appropriate Do not you think?