How to Find Large Files on Linux and Free Up Disk Space

A full disk can stop updates, crash databases and make a server unresponsive. The first step to fixing it is always the same: find out what is using the space. Fortunately, it is easy to find large files on Linux with a few excellent built-in tools.

In this guide you will learn how to find large files on Linux with df, du, find and ncdu, and then how to free up disk space safely without deleting anything important.

How to find large files on Linux with du and find commands

Step 1: Check How Full Your Disks Are

Before you find large files on Linux, start with an overview of every mounted disk:

df -h

The -h option shows sizes in human units such as G and M. Look at the Use% column. Anything above 90% needs attention, and the Mounted on column tells you where to look next, which is usually / or /home.

Step 2: Find the Biggest Folders

Next, see which folders are the largest, because big folders usually hide the files you want. This command lists the size of each folder at the top level, biggest first:

sudo du -h --max-depth=1 / 2>/dev/null | sort -rh | head -n 15
  • du -h measures disk usage in human-readable units.
  • --max-depth=1 shows only one level, so the output stays short.
  • 2>/dev/null hides “permission denied” messages.
  • sort -rh puts the biggest folders first, and head keeps the top results.

Then repeat the command on the biggest folder, for example /var, and keep going down until you find the culprit.

Step 3: Find Large Files on Linux with find

If you already know roughly where to look, you can list every file above a certain size. For example, to find large files on Linux bigger than 500 MB:

sudo find / -type f -size +500M -exec du -h {} + 2>/dev/null | sort -rh | head -n 20

Change / to a smaller folder, such as /home, to make the search faster. If you do not want to remember the syntax, our free Linux command generator builds this exact command for you, with any folder and size you choose.

Step 4: Find Large Files on Linux with ncdu

For a more visual way to find large files on Linux, install ncdu. It scans a folder and lets you browse the results with the arrow keys:

sudo apt install ncdu
sudo ncdu /

Folders are sorted by size, so the biggest ones are always at the top. In addition, you can press d to delete a file directly, although it is wise to double-check first.

Where the Space Usually Goes

In practice, when you find large files on Linux, they almost always come from the same few places. Therefore, check these first:

  • Log files in /var/log, especially the systemd journal.
  • Package caches from apt in /var/cache/apt.
  • Old kernels that are no longer used.
  • Docker images and volumes, if you use containers.
  • Downloads, backups and media in home folders.

How to Free Up Disk Space Safely

Once you find large files on Linux and know what is using the space, clean it up carefully. These commands are safe on Debian, Ubuntu and Raspberry Pi OS:

sudo apt clean                       # remove downloaded package files
sudo apt autoremove                  # remove unused packages and old kernels
sudo journalctl --vacuum-size=200M   # shrink the system journal

For your own files, move old backups and videos to an external drive instead of deleting them straight away. Above all, never delete files inside /usr, /bin or /lib by hand, because the system needs them to run.

Prevent the Problem from Coming Back

In the end, a little automation saves a lot of trouble. For example, you can schedule a weekly cleanup or a disk-space check with cron. Our guide to automating tasks with cron jobs shows how to set it up in a few minutes.

Similarly, if a cleanup script fails with “Permission denied”, read our guide to Linux file permissions. For every option of find, see the official GNU find manual.

FAQ: How to Find Large Files on Linux

What is the fastest way to find large files on Linux?

Run sudo du -h –max-depth=1 / | sort -rh | head to find the biggest folders, then use find with the -size option, or install ncdu for an interactive view.

Is it safe to delete files in /var/log?

It is better not to delete active logs by hand. Instead, use sudo journalctl –vacuum-size=200M for the journal and let logrotate manage the other log files.

Why is my disk still full after deleting files?

A running program may still hold the deleted file open. Restart the service that was writing to it, or reboot, and the space will be released.

Leave a Comment