Wednesday, January 18, 2017

Find top 10 directroy by size in linux

Find top 10 directroy by size in linux



Simply run below command to display the results

du -hs * | sort -rh | head -10


In few systems the "h" extenion is not working. They can use below command instead

du -s * | sort -rn | awk '{print int($1 / 1024) "M\t"$2}' | head -10

If data is in GBs then there is a little modification in command

du -s * | sort -rn | awk '{print int($1/1024/1024 ) "G\t"$2}' | head -10

No comments:

Post a Comment