Skip to content
Start » Bash Shell » How to Free Up Hard Disk Space in Linux Ubuntu, Mint, Debian

How to Free Up Hard Disk Space in Linux Ubuntu, Mint, Debian

You are running out of space on your system Linux? Here are several ways to clean up your system to free up space on Ubuntu and other Debian-based Linux distributions like Mint.

Over time, any operating system's hard drive can become cluttered as programs are added and removed. If you have 1 TB (one terabyte) of storage capacity, you might not bother wiping Ubuntu to make disk space. But if your hard drive has limited space, like I have a 128GB SSD laptop, freeing up disk space becomes a necessity.

First, let's find out how to check remaining free space in Ubuntu.

Check Free Space on Linux Ubuntu and Mint

It's always a good idea to check free disk space on Linux first.

This is quite easy on Ubuntu and Mint. Just use the Disk Usage Analyzer tool – Disk Usage Analyzer. Search the menu and run the tool.

You should see the used disk space and remaining free space here:

Linux Analisador de Disco

Once you know the state of free space on your disk, it's time to clean up your system and create more free space for your Linux Mint or Ubuntu operating system.

How to free up space in Linux Ubuntu and Mint

There are several ways to clean up disk space on Ubuntu and other Debian based systems. Below I present some tips on how to do it using the bash command line and also some GUI options.

If you're a beginner, avoid those marked "advanced".

I'm using Linux Mint 20.03 as I write this tutorial, but you can use the same steps for older versions like Ubuntu 18.04 and other versions of Ubuntu, Linux Mint, and other Debian-based Linux distributions.

Delete of APT packages that are no longer needed [*Recommended]

If you read the apt-get command guide, you may have found the command option apt-get 'autoremove'.

This option removes libs and packages that were automatically installed to satisfy the dependencies of an installed package. If that original package is removed, these automatically installed packages will be useless on the system.

This command also removes old Linux kernels that were automatically installed on system update.

First, you can check the size being used by the APT cache using the command DU:

sudo du -sh /var/cache/apt 

After checking the size used, run the autoremove, it's a basic command that you can run every now and then to free up some space on your Ubuntu and Mint system:

sudo apt-get autoremove

You can also remove only outdated packages, such as those replaced by a recent update, making them completely unnecessary.

run the autoclean for that:

sudo apt-get autoclean

Or you can even remove the entire APT package cache, this option is the one that will free up the most disk space on your Linux operating system:

sudo apt-get clean

Uninstall applications that are no longer needed [*Recommended]

We all install games or applications to learn about, test, or use at a given moment, and that end up being no longer necessary with the passage of time.

To check installed applications, open the Application Manager and look for the “Show installed apps” menu option.

Mostrar aplicativos instalados

The manager will list all installed apps, you can click on the ones you no longer need and then remove them:

Remover aplicativo instalado

You can also remove the applications using the command line with the apt:

sudo apt-get remove package-name1 package-name-2

Automatically remove old kernels in Linux Mint

As of Linux Mint 19.2, you can set the operating system to automatically remove obsolete Linux kernel versions and dependencies.

The Update Manager application comes with the option disabled for this action.

Follow the steps to turn this option on:

  1. Click the Menu button on the panel to open the application menu.
  2. Go to System -> Update Manager
  3. On the manager screen, open the menu To edit and choose preferences
  4. On the preferences screen, click on the tab Automation
  5. On the automation tab, turn on the option Remove deprecated kernels and dependencies, enter your password when prompted

On a weekly basis or so, the update manager checks and removes obsolete kernels.

Final considerations

There are several options and strategies to maintain disk space and, consequently, the performance of the Linux Ubuntu and Mint operating system.

If you use any other in your routine, please share it with us in the comments of this article.

Reference articles

Leave a Reply

Your email address will not be published.

en_USEnglish
%d bloggers like this: