Skip to content

Instantly share code, notes, and snippets.

@memoryleak
Created February 19, 2015 14:21
Show Gist options
  • Save memoryleak/4a82dd8ef26d465907c3 to your computer and use it in GitHub Desktop.
Save memoryleak/4a82dd8ef26d465907c3 to your computer and use it in GitHub Desktop.
#!/bin/bash
BREAK="===============================================================";echo -ne "\n $BREAK \n \t Disk Usage for $(pwd) $(date +'%F') \n $BREAK \n\n";df -h $(pwd); echo -e '\n\n Volume Group Usage: \n'; vgs $(df -h $(pwd) | grep dev | awk '{print $1}'| cut -d\- -f1| cut -d\/ -f4); echo -e '\n'; echo -e "Largest Folders:\n"; du -xSk $(pwd) | sort -rn | head -30|awk '{printf "%d MB\t%s\n",($1/1024),$NF}' && echo -e "\n\n"; echo -e "Largest Files:\n"; find $(pwd) -mount -type f -ls|sort -rnk7 |head -30|awk '{printf "%d MB\t%s\n",($7/1024)/1024,$NF}';echo -e "\n\n Open Deleted Files:\n" ;lsof | grep $(pwd) | grep deleted| awk '{ if($7 > 1048576) print $7/1048576, "MB ",$9,$1 }' | sort -n -u | tail; echo -e "\n $BREAK"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment