How To Find 10 Largest Files & Directories On Linux File System

Find the largest top 10 files and directories on Linux Ubuntu. How to find large files in Linux in / file system. On Linux, find largest file in directory using terminal command.

du Command is a great tool to find out the disk usage or files and directories on Linux Ubuntu Systems. Du command summarize disk usage of each FILE, recursively for directories.

cli-01

Find Largest Files/Directories In Linux Ubuntu

To display the largest top ten files or directories:

$ du -hsx * | sort -rh | head -10

To display the largest directories in the current working directory:

$ du -a /home | sort -n -r | head -n 10

To display the largest folders or files including the subdirectories:

du -Sh | sort -rh | head -10

cli-02

Explanation of Commands and Options

du : Estimate file space usages.
-hsx : (-h) Human Readable Format, (-s) Summaries Output, (-x) One File Format, skip directories on other file format.
sort : Sort text file lines.
-rh : (-r) Reverse the result of comparison, (-h) for compare human readable format.
head : output first n lines of file.
a : Displays all files and folders.
-n : Compare according to string numerical value.
-r : Reverse the result of comparisons.
-n : Print the first ‘n’ lines.

How To Find 10 Largest Files & Directories On Linux File System originally posted on Source Digit – Latest Technology, Gadgets & Gizmos.