1. Home
  2. Linux
We are reader supported and may earn a commission when you buy through links on our site. Learn more

How to clear program cache files on Linux

If you’re noticing your Linux PC’s home folder is running out of space, your cache files may need to be cleared. But how do you clear cache files on Linux?

Cache file location

A lot of cache files are stored in the .cache folder in the home directory. Each user on a Linux OS has a .cache folder, and over time it can build up and take up space. In this guide, we’ll show you how to clear this folder. However, before we can go over how to clear the .cache folder, we need to install Disk Usage Analyzer.

Install Disk Usage Analyzer

Disk Usage Analyzer is a useful tool that Linux users can use to quickly get a graphical overview of how big folders are on the system. We can use this app to determine how large the .cache folder is, which will aid in clearing cache files from the system.

To install the Disk Usage Analyzer tool on Linux, you will need to install the Baobab package. Open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, follow the command-line installation instructions outlined below to get Disk Usage Analyzer working.

Ubuntu

To install Disk Usage Analyzer on Linux, use the following Apt command in a terminal window.

sudo apt install baobab

Debian

On Debian Linux, you’ll be able to get Disk Usage Analyzer up and running with the following Apt-get command in a terminal.

sudo apt-get install baobab

Arch Linux

Those on Arch Linux (as well as Manjaro) will be able to install the Disk Usage Analyzer application quite easily with the following Pacman command below.

sudo pacman -S baobab

Fedora

Are you on Fedora Linux? You may already have Disk Usage Analyzer installed. If not, you’ll be able to get it working with the Dnf command below.

sudo dnf install baobab

OpenSUSE

Those using OpenSUSE Linux will be able to install the Disk Usage Analyzer program using the following Zypper command below.

sudo zypper install baobab

View Cache folder size

Now that the Disk Usage Analyzer program is installed on Linux, we can use it to see how big your .cache folder is, to determine if the entire folder must be deleted, or if we just need to remove individual folders.

Open up Disk Usage Analyzer on the desktop by searching for it in the app menu. Alternatively, open up the quick-launcher with Alt + F2 on the keyboard and enter the baobab command to start it up. Then, follow the step-by-step instructions below.

Step 1: In Disk Usage Analyzer, locate the “Home folder” icon. In Disk Usage Analyzer, it’s located under “This Computer.” As you click on it, the Disk Usage Analyzer app will start to scan your home directory for files and folders. Be patient and allow it to scan.

Step 2: After Disk Usage Analyzer is done scanning your Linux PC for files, you will see a ring graph on the right and a folder tree structure on the left. Look in the folder tree structure for .cache, and click on it.

Step 3: Once you click on the .cache folder, you will see the exact size of it in the ring graphic on the right. You’ll also be able to know the size of the .cache folder.

To see the size of the individual folders inside of the .cache folder, click on the arrow next to .cache in the tree structure on the left. It will sort folders based on size.

Clear cache files and folders

Clearing your cache folder can be done directly in the Disk Usage Analyzer. To clear out your cache, follow the step-by-step instructions below.

Step 1: Click on “Home” in Disk Usage Analyzer, then click on.cache, after the Disk Usage Analyzer app finishes scanning.

Step 2: Click on the arrow next to the .cache folder to view all of the sub-folders inside. Disk Usage Analyzer will sort all of the sub-folders by how large they are.

Step 3: Find sub-folders in the .cache directory inside of Disk Usage Analyzer you’d like to delete. Then, right-click on them and click on the “Move to trash” option to send them to the trash.

Alternatively, right-click on the .cache folder itself with the mouse and select “Move to trash” to completely delete all cache files on your Linux PC. Do not worry! Deleting this folder is totally safe, and programs will re-create it when they need to.

Step 4: Open up your Linux file manager. Then, with the file manager open on the desktop, click on the “Trash” to access your PC’s deleted files.

Step 5: Empty the “Trash” to remove all of the cache files you deleted with Disk Usage Analyzer previously and erase them permanently. Or, select “restore” to un-delete the cache.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.