Jump to Navigation

204 - Top 5 large files in a directory

If you want to figure out large files in a specific directory.

# du -s /var/log/* | sort -nr | head -5

There are a lot of files in a current directory and want to figure out.

# du -s ./* | sort -nr | head -5


  • du

 This command is used to summarize disk usage of each file in a file system, recursively for directories.

  • sort

 This command is used to sort lines of text.

 -r option sorts in reverse order, so what would normally be at the bottom of the output is now at the top.
 For a numeric sort, the largest numbers are at the top.

 -n option sorts in numeric mode, as opposed to the default lexicographic sort.



Main menu 2

Story | by Dr. Radut