All articles
165 articles · updated weekly See our Tools
All articles
Tutorials

How to Find Large Files on Linux (find, du and ncdu)

List the biggest files on Linux with find, du + sort and ncdu: ready-to-run commands to track down the logs, dumps and forgotten backups filling your disk.

How to Find Large Files on Linux (find, du and ncdu)
COVER · Tutorials

If you landed here wanting the list of the biggest files on the machine, this is the line. It walks the root filesystem, picks everything above 100 MB, prints a readable size and returns the 20 largest, biggest first:

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

I run some variation of this every time a server starts complaining about space, and the culprit almost always shows up in the first five lines: a forgotten database dump in /root, a backup .tar.gz someone left there "just for today" back in 2024, an application log nobody rotated. The rest of this post explains every piece of the command, the variations worth memorizing and the gotchas that make find and du disagree about the size of the same file.

One important split before we start: this guide is about listing the large files. If your problem is a disk that filled up and you do not even know which partition is full yet, or df says 100% and the sum of the files does not add up, start with the diagnostic method in how to investigate low disk space on Linux and come back here once you know where to dig.

The command, piece by piece

Every option in that line is there for a reason, and understanding them keeps you from copying the wrong version off some forum:

  • sudo — without it, find cannot enter other users' directories and you only see part of the disk.
  • find / — starts at the root. Swap it for /var, /home or /srv once you know the suspicious area; it gets much faster.
  • -xdev — does not cross into other mounted filesystems. This is the detail almost every tutorial forgets.
  • -type f — regular files only, no directories or links.
  • -size +100M — larger than 100 MiB. It accepts k, M and G.
  • -exec du -h {} + — hands the matches to du in batches (the + groups many per call, much faster than \;).
  • 2>/dev/null — discards the "Permission denied" noise.
  • sort -rh | head -20 — sorts by human size (-h understands that 1.2G > 900M), largest first, and keeps the top 20.

-xdev deserves its own paragraph. Without it, find / walks into /proc, /sys, data volumes mounted on /data and even NFS shares. Testing the command without -xdev in Debian 12 and Rocky Linux 9 containers, the "large files" list included a resource4 under /sys/devices/... — a virtual kernel file that takes up zero bytes of disk. On a real server it is worse: find descends into a multi-terabyte NFS share and you wait minutes for an answer that mixes different disks. If the full partition is /, search only /. If it is /data, run find /data -xdev ....

find with -printf: the file's size, not the space it takes

GNU find (the default on Debian, Ubuntu, RHEL, Rocky, Alma and Fedora) has -printf, which prints the size in bytes without calling du for every file:

sudo find / -xdev -type f -size +100M -printf '%s\t%p\n' 2>/dev/null \
  | sort -nr | head -20 | numfmt --to=iec --field=1

%s is the size in bytes, sort -nr sorts numerically and numfmt (from coreutils) turns the first column into K/M/G. The catch is that these two versions do not measure the same thing, and I have seen it confuse experienced people.

du measures blocks allocated on disk. find's -size and %s look at the file's apparent size. For most files they match, but not for sparse files — VM images, preallocated database files, a badly created swap image. In the test, a file created with truncate -s 10G matched -size +1G, ls -lh showed 10G, the -printf version showed 10G too, but the du -h version showed 0. Both are right: the file claims to be 10 GB and occupies nothing. If the question is "what is eating my disk", trust du. If it is "which file has the largest declared size", use -printf.

Units are another common confusion. find's M is a mebibyte (1,048,576 bytes) and G is a gibibyte, while hosting panels and monitoring dashboards often show MB and GB in base 1000. A "500 GB" disk in the panel shows up as 466G in df -h. When you need to reconcile one side with the other, running the values through the unit converter keeps you from thinking 34 GB "vanished".

And a -size gotcha that bites a lot of people: it rounds up in the unit you ask for. -size -1M does not mean "smaller than 1 MB"; it means "rounded up, less than 1 MiB", and the only size that rounds up to zero mebibytes is zero. In the test, find /srv -size -1M returned only the empty file, ignoring a one-line text file. For upper bounds, use bytes, which do not round (-size -1048576c = smaller than 1 MiB). For "larger than", the rounding does not get in the way.

Filter by folder and by age

In practice I rarely want the list for the whole disk. I want the files that are large and old, which are the ones you can delete without fear:

# Larger than 100 MB, not modified in more than 30 days
sudo find / -xdev -type f -size +100M -mtime +30 -exec du -h {} + 2>/dev/null | sort -rh

# Only inside /var, larger than 50 MB
sudo find /var -xdev -type f -size +50M -exec du -h {} + 2>/dev/null | sort -rh | head -20

-mtime +30 matches files last modified more than 30 days ago. A log that is still being written never shows up there; a backup from 2024 always does. That combination separates junk from live data better than any manual look.

du + sort: when the problem is a folder, not a file

Sometimes there is no giant file: there are a hundred thousand 2 MB files in a cache directory. find -size +100M finds nothing and the disk is still full. That is where du works better, summing per directory:

# Weight of each subfolder of /var, staying on the same filesystem
sudo du -xh --max-depth=1 /var 2>/dev/null | sort -rh | head

# Files and folders mixed, the 20 largest inside /var
sudo du -ahx /var 2>/dev/null | sort -rh | head -20

-x is the du equivalent of -xdev: it stays on the same filesystem. --max-depth=1 (or -d1) shows one level only, and you descend folder by folder until you find the fat one. -a includes individual files in the listing, which turns du into a "list the biggest files and folders" in one go — heavier, so point it at a folder rather than the root.

ls -lhS: the folder you already know

When you already know the problem lives in /var/log/nginx or in the uploads folder, you do not even need find:

ls -lhS /var/log/nginx | head -10

-S sorts by size, largest first, and -h makes it readable. It does not descend into subfolders and it shows the apparent size (same as -printf), but for a quick look it is the most direct thing there is.

ncdu, gdu and dust: the interactive way

If you can install packages, ncdu is the most comfortable way to find what weighs: it scans once and you navigate the tree with the arrow keys, sorted by size, and delete with the d key after confirming.

sudo apt install ncdu        # Debian/Ubuntu
sudo dnf install ncdu        # Fedora

# RHEL, Rocky Linux, AlmaLinux: ncdu comes from EPEL
sudo dnf install epel-release
sudo dnf install ncdu

sudo ncdu -x /               # -x: stay on this filesystem

On RHEL and its derivatives the package is not in the base repositories: in a Rocky Linux 9 container, dnf install ncdu failed with "Unable to find a match" and only worked after epel-release (on RHEL itself, the EPEL release package is installed from the URL in the EPEL documentation). On a machine where you cannot use the interface, ncdu -x -o scan.json / saves the scan to a file and ncdu -f scan.json opens it later, on another machine if needed.

Two newer alternatives play the same role: gdu, written in Go and parallel (much faster on SSDs), packaged in Debian, Ubuntu 24.04, Fedora and EPEL; and dust, which prints a tree with bars instead of opening an interface (on Debian 13 and Fedora the package is called du-dust). I checked availability for all of them in November 2026; repositories change, so if the package does not show up, check the project page.

On the desktop: Baobab and QDirStat

If the machine has a graphical interface, GNOME already ships Disk Usage Analyzer (package baobab), with the ring chart that shows folders by proportion. QDirStat is the more complete option, with a treemap colored by file type, and it runs on any desktop. For servers, stay in the terminal; on your laptop, a chart finds the forgotten 40 GB video faster than any find.

Found the file. Now what?

Before deleting, two precautions. First: if the file is a log that a process is writing right now, rm does not give the space back until the process closes the file — prefer sudo truncate -s 0 file.log, which empties the content without breaking the open descriptor. Second: if you deleted it and df did not change, the problem is no longer "find the big file" but a deleted-yet-open file, exhausted inodes, or journald and Docker growing on the side; the walkthrough for that is in the low disk space guide, and if the big file lives under /var/lib/docker, understanding the difference between named volumes and bind mounts in Docker volumes helps you know what you can delete without losing data. If pipes, sort and find do not feel natural yet, the essential Linux commands are a good base.

Frequently asked questions

How do I find files larger than 1 GB on Linux?

Use sudo find / -xdev -type f -size +1G 2>/dev/null. Change the value freely: +500M, +2G. To see sorted sizes, add -exec du -h {} + and pipe the output to sort -rh. Remember that find's G is a gibibyte (base 1024).

How do I list the 10 largest files in a folder?

For the folder alone, without subfolders, ls -lhS /path | head -11 (the first line is the total). Including subfolders, sudo find /path -xdev -type f -printf '%s\t%p\n' | sort -nr | head -10 | numfmt --to=iec --field=1. If you want folders and files mixed, sudo du -ahx /path | sort -rh | head -10.

Why does find show a 10 GB file that du says takes 0?

It is a sparse file. find -size and ls show the apparent size; du shows the blocks actually allocated. VM images and preallocated files often have "holes" that take no disk space. To measure the impact on free space, trust du.

Is it worth installing ncdu on a production server?

If policy allows, yes: it saves a lot of time and runs nothing beyond what du would. Where nothing can be installed, the find and du -xh --max-depth=1 commands in this post cover the same ground, just less comfortably. On RHEL and derivatives, remember it depends on EPEL.

Start with find, finish in ncdu

The line at the top solves most cases: find with -xdev, -size and du for sorting. When no single file is large, switch to du -xh --max-depth=1 and go down folder by folder; when you can install something, ncdu (or gdu) does that navigation for you. Be suspicious when find and du disagree: it is a sparse file. And if the space does not come back after deleting, the problem has changed nature — at that point the path is the full disk-full diagnosis, not another search by size.

RD
Author
Rafael Duarte
Backend developer with a background in fintech and B2B SaaS — worked on teams that scaled APIs from zero to millions of requests. Carries enough production scars to hold strong opinions on tools, patterns and architecture decisions. Not an academic: he read the UUID RFC when he had to choose between v4 and v7 for a write-heavy table.
View profile