Sunday, November 9, 2014

Command to print the largest files/folders in Unix

Command to print the largest files/folders in Unix:

du -a / | sort -n -r | head -n 15

du - Prints the disk Usage
     -a : write counts for all files, not just directories
     /   : Search recursively from this directory

sort - sorts the output
     -n : Numeric sort
     -r  : Ignore case

head : Prints the top 10 lines
     -n : Prints the first 'x'lines that you say. Here x=15

| - pipe. Output re-director