Running low on disk space? Knowing how to find the largest files on a Linux system is a handy trick for freeing space fast. In this post we’ll use three tools—find, du, and ls—to track down the biggest files, with real command examples and sample output.
Table of Contents
Quick reference
Any of these one-liners will surface the largest file (or directory):
find /path/to/directory -type f -exec du -hs {} \; | sort -rh | head -n 1
du -sh * | sort -rh | head -1
ls -lSh /bin | grep -v '^total' | head -1
find ./ -type f -exec du -sh {} \; | sort -h | tail -1
du -ah /home | sort -h -r | head -n 1
find "$directory" -type f -exec ls -s {} \; | sort -n | tail -n 1
1. Find the largest files with the find command
This is the most flexible approach—it recurses into subdirectories and works from any starting path:
find /path/to/directory -type f -exec du -hs {} \; | sort -rh | head -n 1
It lists every file under the directory, prints each size in human-readable form, sorts by size, and shows the single largest.
The find command is a command-line utility for walking a file hierarchy. It can locate files and directories and act on them—searching by file, folder, name, modification date, owner, and permissions. With -exec, other Linux commands can run on each match.
How the command breaks down
| Part | Description |
|---|---|
find /path/to/directory -type f | List all files under the directory and its subdirectories |
-exec du -hs {} \; | Display each file’s size in human-readable format |
sort -rh | Reverse-sort based on human-readable numbers |
head -n 1 | Display the single largest file |
Examples
Search the entire system (can be slow on servers with many files):
find / -type f -exec du -hs {} \; | sort -rh | head -n 1
Search a specific directory:
find /home/user/documents -type f -exec du -hs {} \; | sort -rh | head -n 1
Sample output:
2.5G /home/user/documents/large_file.txt
Here large_file.txt is the biggest file under that directory, at 2.5 GB.
Largest file under the current directory (including subdirectories):
See also: Mastering the Linux Command Line — Your Complete Free Training Guide
find ./ -type f -exec du -sh {} \; | sort -rh | head -n 1
Largest directory under the current directory:
find ./ -maxdepth 1 -mindepth 1 -type d -exec du -hs {} \; | sort -rh | head -n 1
Sample output:
1.8G ./videos
2. Find the largest files with the du command
du estimates the space used by files and directories. Pipe it through sort to order by size, then head to show the top result:
du -sh * | sort -rh | head -1
Run this in a terminal and it lists the largest file or directory in the current directory.
How the command breaks down
| Part | Description |
|---|---|
du -sh * | Display file and directory sizes in human-readable format |
sort -rh | Reverse-sort based on human-readable numbers |
head -1 | Display the largest entry |
Example
Find the largest entry under /etc:
cd /etc/
du -sh * | sort -rh | head -1
or, equivalently, using depth-limited du:
du -h -d 1 /etc/ | sort -rh | head -1
Sample output:
28M /etc/lvm
du -sh * vs find ./ -type f
Both find the largest item, but they build the file list differently:
du -sh * | sort -rh | head -1— measures each file and directory in the current directory (*), so results include whole subdirectory totals.find ./ -type f -exec du -sh {} \; | sort -rh | head -n 1— measures only regular files (-type f) in the current directory and its subdirectories.
Choose the first when you want to see which directory is heaviest; choose the second when you specifically want the largest individual file.
3. Find the largest files with the ls command
The ls command lists directory contents. By default it sorts alphabetically, but -S sorts by size (largest first), and -h makes sizes human-readable. Reviewing the biggest files is a quick way to spot bloated logs, corrupted files, or unexpected sizes when troubleshooting a directory.
ls -lSh /bin | head -n 5
Sample output:
total 12M
-rwxr-xr-x 1 root root 1.9M Mar 10 2025 bash
-rwxr-xr-x 1 root root 1.2M Mar 10 2025 gdbus
-rwxr-xr-x 1 root root 987K Mar 10 2025 perl
-rwxr-xr-x 1 root root 812K Mar 10 2025 zsh
Note that the first line is the total, not a file. To print only the single largest file, skip that line:
ls -lSh /bin | grep -v '^total' | head -1
Sample output:
-rwxr-xr-x 1 root root 1.9M Mar 10 2025 bash
To sort in the opposite direction (smallest first), add -r:
ls -lShr /bin | head
Summary
| Command | What it does |
|---|---|
find / -type f -exec du -hs {} \; | sort -rh | head -n 1 | Finds all regular files from /, computes each size, and shows the single largest file system-wide |
ls -lSh /path | grep -v '^total' | head -1 | Lists a directory in long format sorted by size and shows the largest file or directory |
du -sh * | sort -rh | head -1 | Sizes everything in the current directory and shows the largest file or directory |
Pick find for recursive, system-wide hunts, du for per-directory totals, and ls for a fast look inside a single directory.



[…] 3 Ways to find largest files in Linux […]
Cool. This is exactly what I need. Thanks.