Clean Up Unnecessary and Junk Files on Ubuntu

In this guide, you will learn to Clean Up Unnecessary and Junk Files on Ubuntu using the terminal. After some time, you may find out that you are running out of space on your Ubuntu server. So to solve this problem, you should clear your Unnecessary and Junk files. Now you can proceed to the following steps to clean up your Ubuntu server and get more space from the terminal.

Clean Up Unnecessary and Junk Files on Ubuntu?

To complete this guide, you must have access to your Ubuntu servers such as Ubuntu 22.04 and Ubuntu 20.04 as a root or non-root user with sudo privileges and follow the steps below.

Step 1 – Remove all Unnecessary Apps from Ubuntu

The first step is to delete or remove your unwanted applications, folders, and files from your Ubuntu system. Then, proceed to the next step.

Step 2 – Remove Junk Files on Ubuntu

When you remove your unwanted applications, some junk files and data aren’t removed from your server. So you can easily remove these files by using the Ubuntu inbuilt cleaner. To do this, run the command below in your Ubuntu terminal:

apt-get autoremove

Step 3 – Clean up the Thumbnail Cache on Ubuntu

The thumbnail cache stores images that are scaled to a size that was previously requested by a client. thumbnails are stored in a hidden directory in your user account at the location ~/.cache/thumbnails.

Before deleting the thumbnails cache, you can check the size of them with the command below:

du -sh ~/.cache/thumbnails

Then, you can easily clean up your thumbnails cache on Ubuntu with the command below:

rm -rf ~/.cache/thumbnails/*

Step 4 – How To Clean Ubuntu System from the Terminal?

At this point, you can regularly clean up your Ubuntu server. APT Cache keeps all the files that you have downloaded, installed, or uninstalled on your Ubuntu system. It keeps them in the /var/cache/apt/archives directory.

You can check your APT cache size by using the following command:

du -sh /var/cache/apt

Then, you can easily clean up your Ubuntu system cache by using the command below:

apt-get clean

In order to keep your system clean, you should clear your apt cache regularly.


At this point, you have learned to Clean Up Unnecessary and Junk Files on Ubuntu. If you are running out of space, you can easily use these methods to free up your space.

Hope you enjoy it. You may be interested in these articles on the Orcacore website:

Netplan Gateway is Deprecated Use Default Routes on Ubuntu

Install CloudPanel on Ubuntu and Debian

Check Connected WiFi Password on Ubuntu Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!