Free Up Disk Space in Linux Mint

Commands to find what is taking up space and reclaim disk space in Linux Mint and Ubuntu.

Before you start:

  • Run the diagnostic commands first.
  • Cleanup operations may remove files or resources you still need.
  • Read each warning before running the command.

1. Check Available Space

df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  220G  185G   24G  89% /

2. Find the Largest Directories

Analyze the root filesystem without crossing into other mounted filesystems.

sudo du -xhd1 / 2>/dev/null | sort -hr | head -10
185G    /
92G     /home
48G     /var
19G     /usr
8.2G    /opt

Investigate directories with the highest usage:

sudo du -xhd1 /var 2>/dev/null | sort -hr | head -10

3. Clean the APT Cache

Check how much space downloaded packages occupy:

sudo du -sh /var/cache/apt/archives

The following command deletes cached .deb packages, not installed applications. Reinstalling packages may require downloading them again.

sudo apt clean

4. Remove Unused APT Dependencies

First, simulate the operation to review which packages would be removed:

sudo apt -s autoremove --purge

The following command uninstalls packages marked as unnecessary. Check the list, especially if you use development tools or manually installed packages.

sudo apt autoremove --purge

5. Reduce systemd Logs

Check the space used:

journalctl --disk-usage
Archived and active journals take up 1.5G in the file system.

The following command deletes archived logs older than seven days; you may need them to diagnose incidents. It does not delete active logs.

sudo journalctl --vacuum-time=7d

6. Clean Thumbnails

du -sh ~/.cache/thumbnails 2>/dev/null

The following command deletes only cached thumbnails, not the original photos. The file manager will regenerate them when needed.

find ~/.cache/thumbnails -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +

7. Empty the Trash

Review the files before deleting them:

gio trash --list

The following command empties the user's trash. The files can no longer be restored from it. Check the list above.

gio trash --empty

8. Review Application Caches

du -h --max-depth=1 ~/.cache 2>/dev/null | sort -hr | head -10

pip Cache

python3 -m pip cache info

The following command removes downloads cached by pip; it does not uninstall already installed packages.

python3 -m pip cache purge

npm Cache

npm cache ls | head -20

This command clears the npm cache, but subsequent installations may need to download packages again.

npm cache clean --force

Do not indiscriminately delete everything in ~/.cache; some applications store useful data there.

9. Remove Unused Flatpak Components

flatpak list --runtime

The following command removes runtimes and extensions that Flatpak considers unused. Review the list it displays before confirming.

flatpak uninstall --unused

10. Review and Clean Up Docker

Check how much space images, containers, volumes, and cache occupy:

docker system df -v

Review containers, including stopped ones:

docker ps -a

Clean the build cache

Warning: Removes unused build cache; subsequent docker build commands may take longer. It does not delete data volumes.

docker builder prune

Clean up unused Docker resources

Danger: docker system prune removes all stopped containers, unused networks, dangling images, and build cache. A stopped container may contain important data in its writable layer. Check docker ps -a and back up anything necessary before confirming. Without --volumes, the command does not delete volumes.

docker system prune

Danger: Do not run docker volume prune or docker system prune --volumes without reviewing the volumes. They may contain PostgreSQL, MariaDB, Redis, or other services' databases.

11. Find Large Files in Your Home Directory

Show the 20 files larger than 500 MiB, sorted by size:

find "$HOME" -type f -size +500M -printf '%s %p\n' 2>/dev/null | sort -nr | head -20 | numfmt --field=1 --to=iec
8.2G /home/user/Downloads/backup.sql
3.5G /home/user/Videos/video.mp4
1.8G /home/user/Downloads/imagen.iso

12. Verify the Recovered Space

df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  220G  169G   40G  81% /

References

Published: October 11, 2026