How to clean pacman downloaded package cache 2

In this post we are going to clean up download cache folder on Arch Linux that pacman as it package manager. If you recently install any software from the pacman,the package will be downloaded to the cache folder first and then install it to the system. Every package you are installing will be stored in that folder, so If you need to uninstall the package, you don’t need to download the package again.

But for whatever reason, If the package has an upgrade and you install it, the old package will still intact on the pacman download cache folder. If this continue your system will be full by junk files that created by pacman. As you can see below, there is an example of the cache folder of my Arch System locate on /var/cache/pacman/pkg

How to clean pacman downloaded package cache
Cache Stored on the System
How to clean pacman downloaded package cache 1
Directory Size

As you can see there are plenty of junk files and the download cache use almost 1GB disk space alone. Now the problem is how to clean up these files ? so we can get back our disk space back ? Follow the instruction below.

Clean up pacman download cache

If you read the man page on the SYNC OPTIONS section, you should have known how to clean those files up. It tell us to use -c or –clean options to clean it.

       -c, --clean
Remove packages that are no longer installed from the cache as well as currently unused sync databases to free up disk space.

Now what to do is just open your terminal and type this command:

$ sudo pacman -Sc


$ sudo pacman --sync --clean
How to clean pacman downloaded package cache 2
How to clean pacman downloaded package cache 2

You can see on the screenshot above, the cache folder has been remove unused package and give us some space, but what if we want to remove all of the cache completely ? so we can get full off free space ?. You can do that by manually delete all the files stored in that directory.

$ sudo rm -rf /var/cache/pacman/pkg/*
How to clean pacman downloaded package cache 3
Remove all downloaded packages

The files are gone and you get your full free space.

That’s all for my short post about clean your pacman download cache folder on Arch Linux, hope this post help you to clean your system. Thanks for your visit ! and don’t forget to share this easy tricks to your friends

Leave a Reply

Your email address will not be published. Required fields are marked *