Useful Linux Commands to sort, list and find in directories

Useful Linux Commands to sort, list and find in directories

A list of some useful Linux commands to sort, list and find in directories.

Top 5 largest directories in a folder

$ du -a | sort -n -r | head -n 5

Display the Top 100 newly modified directories

$ ls -lt | head -n 10

Total size of each directory

//To print on screen 
$ du -sh *
//To output to a file
$ du -sh *  > filesizes.txt

Categories: Posts