7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (2024)

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (1)

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

In this article, I’ll show you some of the easiest tricks to clean up your Ubuntu system and get more space. I’ll also share some advanced tricks so that you’ll have choices.

But before that, let’s see how to find the free space remaining on Ubuntu.

Check free space on Ubuntu

It’s always a good idea to check the free disk space in Linux first. This is rather easy on Ubuntu. Just use the Disk Usage Analyzer tool. Search it in the menu and run the tool. You should see the disk space used and the free space remaining here:

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (2)

Once you know the state of free space on your disk, it’s time to clean up your system and make some more free space here.

How to free up disk space in Ubuntu and Linux Mint

There are several ways you clean up disk space in Ubuntu and other Ubuntu-based system. I have discussed several command-line tricks here followed by some GUI options.

While I have mentioned several ways here, if you are a beginner, avoid the ones marked as ‘expert’. Not that you cannot use them, but it’s better to avoid them if you don’t know what you are doing.

I am using Ubuntu while writing this tutorial but you can use the same steps for Ubuntu versions, Linux Mint, elementary OS, and other Ubuntu-based Linux distributions.

If you prefer videos, I have made a video to show you how to clean Ubuntu.

1. Get rid of packages that are no longer required [Recommended]

If you read the apt-get commands guide, you might have come across the apt-get command option ‘autoremove’.

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

It also removes old Linux kernels that were installed automatically in the system upgrade.

It’s a no-brainer command that you can run from time to time to make some free space on your Ubuntu system:

sudo apt-get autoremove

As you can see, this command is going to free up 300 Mb of free space in my system.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (5)

2. Uninstall unnecessary applications [Recommended]

We all have a few games and/or applications that we hardly use. Don’t trust me? Go and find all the installed software on your Ubuntu system.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (6)

Chances are that you have a number of apps installed that you seldom use. Maybe you installed them on the back of an awesome review, out of nosiness, or to handle a particular task.

If you need space more getting rid of the unused or lesser used applications is always a good idea.

You can remove a program in Ubuntu from the software centre or use the command below with the particular app names:

sudo apt-get remove package-name1 package-name2

3. Clean up APT cache in Ubuntu

Ubuntu uses APT (Advanced Package Tool) for installing, removing and managing software on the system, and in doing so it keeps a cache of previously downloaded and installed packages even after they’ve been uninstalled.

The APT package management system keeps a cache of DEB packages in /var/cache/apt/archives. Over time, this cache can grow quite large and hold a lot of packages you don’t need.

You can see the size of this cache with the du command below:

sudo du -sh /var/cache/apt 

As you can see, I have over 500 Mb of cache storage. When you are almost out of space, this 500 Mb can make a lot of difference.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (7)

Now, you have two ways to clean the APT cache.

Either remove only the outdated packages, like those superseded by a recent update, making them completely unnecessary.

sudo apt-get autoclean

Or delete apt cache in its entirety (frees more disk space):

sudo apt-get clean

4. Clear systemd journal logs [Intermediate knowledge]

Every Linux distribution has a logging mechanism that helps you investigate what’s going on in your system. You’ll have kernel logging data, system log messages, standard output and errors for various services in Ubuntu.

The problem is that over time, these logs take a considerable amount of disk space. You can check the log size with this command:

journalctl --disk-usage

Now, there are ways to clean systemd journal logs. The easiest for you is to clear the logs that are older than certain days.

sudo journalctl --vacuum-time=3d

Here’s an example:

abhishek@itsfoss:~$ journalctl --disk-usageArchived and active journals take up 1.8G in the file system.abhishek@itsfoss:~$ sudo journalctl --vacuum-time=3dVacuuming done, freed 1.7G of archived journals from /var/log/journal/1b9ab93094fa2984beba73fd3c48a39c

5. Remove older versions of Snap applications [Intermediate knowledge]

You probably already know that Snap packages are bigger in size. On top of that, Snap stores at least two older versions of the application (in case, you want to go back to the older version). This eats up a huge chunk of space. In my case, it was over 5 GB.

du -h /var/lib/snapd/snaps4.0K /var/lib/snapd/snaps/partial5.6G /var/lib/snapd/snaps

Alan Pope, part of Snapcraft team at Canonical, has created a small script that you can use and run to clean all the older versions of your snap apps.

What you have to do here is to create a new shell script and use the following lines in your script:

#!/bin/bash# Removes old revisions of snaps# CLOSE ALL SNAPS BEFORE RUNNING THISset -eusnap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" done

Give it execute permission, run the shell script with sudo and see the magic. The script removed the older Snap packages and freed over half of the 5 GB space used by Snap.

du -h /var/lib/snapd/snaps4.0K /var/lib/snapd/snaps/partial2.5G /var/lib/snapd/snaps

6. Clean the thumbnail cache [Intermediate knowledge]

Ubuntu automatically creates a thumbnail, for viewing in the file manager. It stores those thumbnails in a hidden directory in your user account at the location ~/.cache/thumbnails.

Over time, the number of thumbnails would increase dramatically. Moreover, the thumbnail cache will eventually contain many superfluous thumbnails of pictures that don’t exist anymore.

You can check the size of the thumbnail cache with the command below:

du -sh ~/.cache/thumbnails

For my system, the thumbnail cache is over 300 Mb in size.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (8)

So it’s a good practice to clear the thumbnail cache every few months or so. The quickest way is to use the terminal (please copy-paste the commands to avoid mistakes):

rm -rf ~/.cache/thumbnails/*

7. Find and remove duplicate files

Sometimes you may have duplicate files in different places in your system. Getting rid of the duplicates will certainly free up some space and clean your Ubuntu system.

You can use a GUI tool like FSlint or a command line tool like FDUPES for this task. I recommend reading this article to see how to use these tools to remove duplicate files.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (9)
7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (10)

Bonus Tip: Using GUI tools to free space in Ubuntu

We saw a number of command-line options to make space in the Linux system but I understand if you don’t want to use the commands.

Remembering all the commands or using them all one by one may not be convenient for you. And this is why we have a number of GUI tools that will help you do that in a few clicks with an easy-to-use interface.

Stacer is one such tool that you could use. You can read this article to know how to use Stacer in Ubuntu.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (11)

You can check out more tools to clean up Ubuntu and make some free space easily.

Wrapping up

So, you saw a number of ways to clean up the Ubuntu system. Personally, I use apt-get autoremove more often than any other commands here. Regularly using this command keeps the system free from unnecessary files.

I hope this article helped you to make free space in Ubuntu, Linux Mint, and other such distributions. Do let me know if this worked for you or if you have some other tips to share.

7 Simple Ways to Free Up Space on Ubuntu and Linux Mint (2024)

FAQs

How do I clear unnecessary storage in Ubuntu? ›

Steps to Clean Up Your Ubuntu System.
  1. Remove all the Unwanted Applications, Files and Folders. Using your default Ubuntu Software manager, remove the unwanted applications that you don't use.
  2. Remove unwanted Packages and Dependencies. ...
  3. Need to Clean the Thumbnail Cache. ...
  4. Regularly clean the APT cache.
Jan 1, 2024

How to clear space in Linux Mint? ›

An easy way is to open the Update Manager, then the View Menu, then Linux Kernels. This lists all the kernels that are available to you and shows which ones of those are installed. You can also remove / install kernels from there.

How do I free up hard drive space on Ubuntu? ›

The commands in this article are commands I have found useful to figure out what's taking up space on Linux servers and how to reclaim it.
  1. Inspect Disk Usage. ...
  2. Get rid of packages that are no longer required. ...
  3. Clear the apt cache. ...
  4. Clear Systemd journals. ...
  5. Remove older versions of snaps. ...
  6. Run Bash script to remove unused snaps.
Dec 12, 2023

How do I zero free space in Ubuntu? ›

Open a terminal and run sudo apt install nautilus-wipe to install the program: Y to continue the installation, and once the prompt has returned in your terminal, run nautilus -q to start the nautilus service. Now you can open any file in the file explorer, right click, and select Wipe available disk space .

How do I clean up unused files in Ubuntu? ›

How To Clean Up Ubuntu
  1. Remove Unnecessary Packages and Dependencies. apt-get autoremove.
  2. Clean Apt Cache. Check the amount of apt-cache on your system du -sh /var/cache/apt. ...
  3. Uninstall Pakcages You Never Use. Remove specific packages apt-get remove package-1 package-2. ...
  4. Remove Old Kernels.

How to clear memory in Linux Ubuntu? ›

How to Clear Ram Cache in Linux?
  1. First choice you have is to Clear PageCache only – # sync; echo 1 > /proc/sys/vm/drop_caches.
  2. The second option you have is to Clear dentries and inodes – # sync; echo 2 > /proc/sys/vm/drop_caches.
  3. The third and the last choice you get is to Clear pagecache, dentries, and inodes –
Apr 26, 2022

How do I free up unused space in Linux? ›

2. Cleaning Up the System Manually
  1. 2.1. Check for Largest Directories and Files With du. ...
  2. 2.2. Find out the Disk Usage With ncdu. ...
  3. 2.3. Remove Cached Files. ...
  4. 2.4. Remove Old Logs. ...
  5. 2.5. Remove Temporary Files. ...
  6. 2.6. Remove Unused Dependencies.
Mar 18, 2024

How to debloat Linux Mint? ›

How to free up disk space in Ubuntu and Linux Mint
  1. Get rid of packages that are no longer required [Recommended] ...
  2. Uninstall unnecessary applications [Recommended] ...
  3. Clean up APT cache in Ubuntu. ...
  4. Clear systemd journal logs [Intermediate knowledge] ...
  5. Remove older versions of Snap applications [Intermediate knowledge]

How to clear everything in Linux? ›

What are some common ways to clear the terminal screen in Linux? You can clear the terminal screen in Linux using the clear command, pressing Ctrl + L, or using printf to send the clear screen escape sequence.

How to clear cache and temp files in Ubuntu? ›

To clear the temporary files in Ubuntu, locate the “/tmp” folder and remove its files using the “find” and the “delete” commands. To entirely remove the “/tmp” directory, you can use the “rm” command. Alternatively, you can set up an automatic deletion of temporary files and folders from the settings.

How to clean Snap in Ubuntu? ›

Cleanup Snaps
  1. sudo du -sh /var/lib/snapd. To see all these snaos enter:
  2. snap list --all. You can see the installed snaps and those that are disabled. ...
  3. nano clean-snap.sh. and entre this in the scropt:
  4. # Removes old revisions of snaps.
  5. set -eu.
  6. while read snapname revision; do.
  7. done. ...
  8. sudo bash clean-snap.sh.

How do I clean unused packages in Ubuntu? ›

The apt-get purge command can be used to remove packages in Ubuntu (unnecessary packages, including configuration files, listed directories, and files). It deletes the software entirely from the system.

How to free up space on Linux Mint? ›

How to Clean Linux Mint Safely
  1. Empty the trash bin.
  2. Clear the updates cache.
  3. Clear the thumbnail cache.
  4. The registry.
  5. Make Firefox cleanse itself automatically upon quitting.
  6. Dealing with Flatpaks and the Flatpak infrastructure.
  7. Tame your Timeshift. 7.1. The best way to set up Timeshift. ...
  8. Remove most Asian fonts. 8.1.

How do I shrink space in Ubuntu? ›

Resize a filesystem/partition

In the toolbar underneath the Volumes section, click the menu button. Then click Resize Filesystem… or Resize… if there is no filesystem. A dialog will open where the new size can be chosen. The filesystem will be mounted to calculate the minimum size by the amount of current content.

How do I clear cache and temp files in Ubuntu? ›

Automatically empty your trash and clear temporary files

Select Settings ▸ Privacy & Security from the results. This will open the Privacy & Security panel. Click on File History & Trash to open the panel. Switch on one or both of Automatically Delete Trash Content or Automatically Delete Temporary Files.

How to remove unnecessary packages from Ubuntu? ›

Method #1: Using the apt-get purge Command for Ubuntu Uninstalls. The apt-get purge command can be used to remove packages in Ubuntu (unnecessary packages, including configuration files, listed directories, and files). It deletes the software entirely from the system.

How to reduce memory usage in Ubuntu? ›

Tips to reduce RAM usage
  1. Use MATE Tweak to change the panel layout to Traditional from Familiar. Traditional uses the least RAM. ...
  2. Go to Control Center -> Startup Applications and uncheck Blueman Applet. ...
  3. Go to Software Boutique and delete Evolution. ...
  4. If you do 3 above you will still have evolution software running.
Sep 2, 2022

How do I clean my hard drive in Ubuntu? ›

How to free up disk space in Ubuntu and Linux Mint
  1. Get rid of packages that are no longer required [Recommended] ...
  2. Uninstall unnecessary applications [Recommended] ...
  3. Clean up APT cache in Ubuntu. ...
  4. Clear systemd journal logs [Intermediate knowledge] ...
  5. Remove older versions of Snap applications [Intermediate knowledge]

Top Articles
Latest Posts
Article information

Author: Pres. Lawanda Wiegand

Last Updated:

Views: 5887

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Pres. Lawanda Wiegand

Birthday: 1993-01-10

Address: Suite 391 6963 Ullrich Shore, Bellefort, WI 01350-7893

Phone: +6806610432415

Job: Dynamic Manufacturing Assistant

Hobby: amateur radio, Taekwondo, Wood carving, Parkour, Skateboarding, Running, Rafting

Introduction: My name is Pres. Lawanda Wiegand, I am a inquisitive, helpful, glamorous, cheerful, open, clever, innocent person who loves writing and wants to share my knowledge and understanding with you.