Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Free Disk Space Ubuntu Linux Mint: How to Check & Free Up

· 6 min read · Home Tech

In this article
  1. Why Disk Space Disappears on Ubuntu and Linux Mint
  2. How to Check Disk Usage in Ubuntu and Linux Mint
  3. Safe Ways to Free Disk Space
  4. Using BleachBit for a GUI Cleanup
  5. Finding Large Files and Folders
  6. Common Mistakes and Misconceptions
  7. Frequently Asked Questions

To free disk space on Ubuntu or Linux Mint, you need to identify what is consuming storage, remove unnecessary packages and cache files, and clean up old kernels and logs. This article explains the most effective and safe methods to reclaim space, from simple graphical tools to command-line utilities.

Why Disk Space Disappears on Ubuntu and Linux Mint

Linux systems accumulate files over time that you may not be aware of. The most common culprits are:

  • Package manager cache: APT (Advanced Package Tool) stores downloaded .deb files in /var/cache/apt/archives. These can grow to several gigabytes.
  • Old kernels: Every system update installs a new kernel, but old ones are kept so you can boot into them if there is a problem. They reside in /boot and take up about 200-400 MB each.
  • Log files: System logs in /var/log can grow large, especially if you have had disk or network errors.
  • Thumbnail cache: Your file manager stores thumbnails of images and videos, which can accumulate to hundreds of megabytes.
  • Trash and temporary files: Files you delete go to the Trash, and applications may leave temporary files in /tmp or ~/.cache.

How to Check Disk Usage in Ubuntu and Linux Mint

Before cleaning, you need to know what is taking up space. Both Ubuntu and Linux Mint offer graphical tools and command-line options.

Using the Disks Utility (GUI)

Open the Disks application (search for “Disks” in the menu). Select your main drive, and you will see a bar chart showing used and free space. This gives a quick overview but not per-folder details.

Using Disk Usage Analyzer (GUI)

Install and run Disk Usage Analyzer (package name: baobab). It scans your home folder or entire filesystem and shows a visual map of what is consuming space. This is the easiest way to spot large files or directories.

Using the Command Line

For a more precise view, open a terminal and run:

df -h

This shows the disk usage of all mounted filesystems. The -h flag makes it human-readable (e.g., 50G instead of 52428800).

To see the largest directories in your home folder, use:

du -sh ~/* | sort -h

The du command with -sh gives a summary for each item, and sort -h sorts them by size. Add | tail -n 20 to see only the top 20.

Safe Ways to Free Disk Space

Here are the most effective and safe methods, from least to most aggressive.

1. Clean the APT Cache

Run this command to remove downloaded package files that are no longer needed:

sudo apt clean

If you want to remove only obsolete packages (those that are no longer available in repositories), use:

sudo apt autoclean

2. Remove Unnecessary Packages

APT can automatically remove packages that were installed as dependencies but are no longer required:

sudo apt autoremove

This is safe and often frees several hundred megabytes. It will not remove packages you explicitly installed.

3. Remove Old Kernels

Old kernels can be removed with the same command:

sudo apt autoremove --purge

The --purge flag also removes configuration files. This will keep the current kernel and one previous one, which is enough for recovery.

4. Clean Log Files

Logs are rotated automatically, but you can clear old ones manually. To see how much space they use:

du -sh /var/log

To clear logs that are older than a certain date, use journalctl (if using systemd):

sudo journalctl --vacuum-time=7d

This deletes journal logs older than 7 days. For other logs, you can empty them with:

sudo truncate -s 0 /var/log/*.log

Be careful: this empties all log files. It is safe, but you lose the history.

5. Clear Thumbnail Cache

Thumbnails are stored in ~/.cache/thumbnails. You can delete them with:

rm -rf ~/.cache/thumbnails/*

They will be regenerated automatically as you browse folders.

6. Empty Trash and Temporary Files

Empty the Trash from the file manager, or use the command:

rm -rf ~/.local/share/Trash/*

For temporary files in /tmp, they are cleared on reboot, but you can delete them manually if needed.

Using BleachBit for a GUI Cleanup

If you prefer a graphical tool, BleachBit is a popular choice. It is available in the default repositories on both Ubuntu and Linux Mint. Install it with:

sudo apt install bleachbit

Run it as a normal user to clean your home folder caches, or with sudo to clean system-wide locations. Be cautious: BleachBit offers many options, and some (like “Free disk space”) can take a long time. Stick to the default checks unless you know what you are doing.

Finding Large Files and Folders

Sometimes the biggest space hogs are user files. Use the Disk Usage Analyzer to find them visually, or use the command line to list the largest files in your home directory:

find ~ -type f -size +100M -exec ls -lh {} \) | sort -k5 -h

This finds files larger than 100 MB and lists them with sizes. You can then decide whether to delete or move them.

Common Mistakes and Misconceptions

  • Deleting system files manually: Avoid removing files in /usr, /bin, or /lib unless you are sure. Use package managers instead.
  • Assuming “autoremove” removes everything: It only removes packages that are no longer needed as dependencies. It will not remove kernels that are still in use.
  • Clearing /var/cache without sudo: You need root privileges to modify system caches.
  • Not checking the Trash: Files you delete from the file manager go to the Trash, which is not automatically emptied.

Frequently Asked Questions

How much disk space should I keep free on Ubuntu?

It is generally recommended to keep at least 10-15% of your disk free. This allows the system to write temporary files, swap, and update packages without running out of space. If you have a 256 GB drive, that is about 25-38 GB.

Is it safe to delete files in /var/cache/apt/archives?

Yes, it is safe. These are downloaded package files that are only used during installation. Once installed, they are not needed. You can delete them with sudo apt clean.

Why does my disk space keep shrinking even after cleaning?

This is often due to logs, browser caches, and application data. Check your browser’s cache and clear it, and look for applications that store data in your home folder (like Steam, Docker, or virtual machines). Also, check if you have any large files in your home directory that you may have forgotten.

Can I use GParted to resize partitions to free space?

GParted is a partition editor that can resize, move, or create partitions. However, it is not for cleaning files. If you have unallocated space on your disk, you can use GParted to expand your root partition, but this is an advanced operation and should be done with a backup.

What is the fastest way to free up 1 GB of space?

Run sudo apt autoremove --purge and sudo apt clean. These two commands often free up over a gigabyte on systems that have been updated regularly. If that is not enough, check your home folder for large files with the Disk Usage Analyzer.