Three Powerful Linux Commands to Quickly Locate the Largest Files
Learn three practical Linux command-line techniques—using ls, find, and du—to quickly identify the largest files or directories on your system, complete with example commands for listing top files, filtering by size ranges, and displaying human‑readable disk usage.
Method 1: Using ls
The simplest way is to rely on ls, which can output file size information directly.
ls -lSh /bin | head -5Method 2: Using find
findis a recursive search command, making it natural for locating large files.
Example: find the single largest file on the root filesystem:
sudo find / -type f -printf "%s\t%p
" | sort -n | tail -1Find the top 10 largest files in your home directory:
find $HOME -type f -printf '%s %p
' | sort -nr | head -10Show all files larger than 100 MiB (note the difference between MiB and MB): find / -size +100M -ls Find files whose size is between 100 MiB and 200 MiB: find / -size +100M -size -200M -ls List the five largest files in a specific directory:
find $DIRECTORY -type f -exec ls -s {} \; | sort -n | tail -n 5Additional tip: find can also locate recent files (e.g., modified within the last n days using -ctime -n ) or files owned by a particular user (e.g., -user mrlinus ).
Method 3: Using du
The du command reports disk usage and can be used to find large files and directories.
Example: list the top 20 largest files under /home: sudo du -a /home | sort -n -r | head -n 20 List the ten largest directories in the current folder: sudo du -a | sort -n -r | head -n 10 Show human‑readable sizes (KB, MB, GB) while sorting: du -hs * | sort -rh | head -n 10 Find the ten largest directories or files (including subfolders): du -Sh | sort -rh | head -n 10 Filter for items whose size is in the GB range using grep: du -h -a /dir | grep "[0-9]-[9]G\b" These three approaches provide quick ways to locate large files and directories on a Linux system.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
