Files Larger Than a Given Size
sudo find / -xdev -type f -size +500M -exec ls -lh {} +
This lists every regular file over 500 MiB on the root file system, with its size, owner, and date. Change the limit with k, M, or G: -size +2G finds files over 2 GiB. To search one folder only, put it in place of /. The find command itself is covered in the find command.
The Largest Files, Sorted
sudo find / -xdev -type f -size +100M -exec du -h {} + | sort -h | tail -20
du prints the size of each file found, sort -h orders human-readable sizes such as 900M and 2.1G correctly, and tail keeps the 20 largest. Sorting options are explained in the sort command.
Which Folders Take the Space
sudo du -xh --max-depth=1 / 2>/dev/null | sort -h
Each line is a folder directly below / with its total size, largest last. Move into the biggest one and repeat:
sudo du -xh --max-depth=1 /var 2>/dev/null | sort -h
2>/dev/null hides messages about files that vanish while du runs. A few rounds usually lead to one folder of logs, backups, or images.
Inside One Folder
ls -lhS /var/log | head -15
-S sorts by size, largest first, and -h prints readable sizes. More options are in the ls command.
Why -x and -xdev Matter
Without them, du and find also walk into every other file system mounted below the starting point:
- Other disks: a mounted backup disk or network share is counted as if it were on the root disk, and the search can take hours.
- Virtual file systems:
/procand/syshold no real data, and/proc/kcorereports a huge size that is not on any disk. - The real question: when one file system is full, only files on that file system matter. Start the search at its mount point, such as
/mnt/data, to check a second disk.
Interactive View with ncdu
| System | Install |
|---|---|
| Debian, Ubuntu | sudo apt install ncdu |
| AlmaLinux, Rocky Linux | sudo dnf install ncdu (EPEL) |
sudo ncdu -x /
ncdu scans once, then shows folders sorted by size. Use the arrow keys and Enter to move through them, and q to quit. It can also delete with d after asking for confirmation; a deleted file is gone, so use that key with care.
Files That Grew Recently
sudo find /var -xdev -type f -mmin -60 -size +50M
This lists files over 50 MiB changed in the last hour, which often points straight at a runaway log or a dump in progress.
Before You Delete Anything
- Know what it is: a large file under
/var/libis usually a database or Docker data; do not remove it by hand. - Check that nothing holds it open:
sudo lsof /path/to/file. Deleting an open log does not return the space. - Keep a copy of anything you may need, on other storage.
When the disk is already full and the space does not come back, follow no space left on device.