Skip to content

Instantly share code, notes, and snippets.

@pepijnblom
Created October 13, 2017 15:50
Show Gist options
  • Save pepijnblom/98df27f894c373d3436b0ac7277f4daa to your computer and use it in GitHub Desktop.
Save pepijnblom/98df27f894c373d3436b0ac7277f4daa to your computer and use it in GitHub Desktop.
Largest file/dir bash
FS='/';NUMRESULTS=20;resize;clear;date;df -h $FS; echo "Largest Directories:"; du -x $FS 2>/dev/null| sort -rnk1| head -n $NUMRESULTS| awk '{printf "%d MB %s\n", $1/1024,$2}';echo "Largest Files:"; nice -n 19 find $FS -mount -type f -ls 2>/dev/null| sort -rnk7| head -n $NUMRESULTS|awk '{printf "%d MB\t%s\n", ($7/1024)/1024,$NF}'|grep -v ^0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment