How To Free Up Disk Space on Ubuntu 16.04/18.04

How to free disk space in Ubuntu thanks to different options that will improve the optimal use of your computer.

It is a good practice to periodically free up disk space to eliminate all these files and thus maintain the best levels of performance and storage.

This tutorial in this opportunity will analyze some ways how we can carry out this task to optimize Ubuntu.

For this tutorial, we will use Ubuntu 16.04, but the procedure applies to the other versions.

Remove Unnecessary Packages

When we install programs or applications in Ubuntu, multiple add-ons are installed such as repositories, libraries, sources, etc., which consume a space in the system.

To eliminate these Ubuntu packages, we will execute the following command. We can see that after pressing Enter, the packages without the use of the system such as sources, libraries, and even old kernels will be displayed. There we just enter the letter Y to confirm the elimination of said packages.

sudo apt autoremove

Clear Thumbnail Cache in Ubuntu

Automatically Ubuntu creates and stores thumbnails in the path ~/.cache/thumbnails for their respective administration and opening.

The problem is when you store thumbnails indefinitely which occupy space in the system, and many of these thumbnails are already obsolete.

To see the current size of the thumbnail cache, we will execute the following command:

du -sh ~/.cache/thumbnails

There the current size of these thumbnails will be displayed. To eliminate them we will run the following command:

rm -rf ~/.cache/thumbnails/*

Clear APT Cache from Ubuntu

APT (Advanced Package Tool) is a utility used by Ubuntu for all the management of applications such as creating, editing or deleting programs and for this, it keeps a cache memory so that access is much more efficient, but even this Storage will be preserved when you remove applications.

The APT caching is found on the following route:


There we will see the current size of said cache:

To eliminate this cache, we can execute any of the following commands:

sudo apt-get autoclean (This option only removes obsolete packages)

sudo apt-get clean (This option completely clean the cache memory APT)

Remove Old Versions of Ubuntu Kernel

The kernel is one of the vital components in the boot of any Linux distro since the access commands are executed there but as the kernel is updated Ubuntu stores every version in the system and this can occupy a considerable space.

If we want to list the versions or images of the kernels in Ubuntu, we will execute the following command:

sudo dpkg --list 'linux-image*'

We can see the list of kernels that have been installed manually with their respective version:

To eliminate some kernel, we must use the following syntax. When executing this option, we must be careful since we can affect the performance of the operating system.

sudo apt-get remove linux-image-VERSION

Remove Orphaned Packages from Ubuntu

Orphaned packages are add-ons that have been installed to the base programs but that after deleting the application remain in the system.

To visualize Ubuntu orphaned packages, we can install the gtkorphan program by executing the following command:

sudo apt-get install gtkorphan

Once installed it will be run as a root user, sudo gtkorphan, and the next window will be displayed where we will see the orphaned packages currently in Ubuntu. There it is enough to activate the respective box and click on the OK option to remove it.

Uninstall Unused Applications

We often install applications or programs which we do not use later, and this is one of the leading causes of poorly managed space in Ubuntu.

To know what applications we have installed in Ubuntu we can execute the following command:

dpkg --get-selections

The syntax to uninstall any unused app will be the following:

sudo apt-get remove (package-name)

Free Up Disk Space with 3rd-Party Apps

There are several applications that give us the possibility of controlling the space of the system in a simple and fully centralized manner.

One of these tools is Stacer which in the following link we will find the way to download it: STACER

Stacer offers a user-friendly interface where we can eliminate all those applications that we do not use or free up space thanks to its tools.

With these tips, we will have much more optimal equipment at the level of space and performance in our Ubuntu Linux systems.

Similar Posts

Leave a Reply

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