Last active
September 28, 2015 11:14
-
-
Save davidhq/cc60d9f1ce90a2156787 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YELLOW='\033[0;33m' | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
BLUE='\033[0;34m' | |
NC='\033[0m' # No Color | |
alias root="sudo -i" | |
# utility function | |
function current_usage { | |
printf "${YELLOW}`du -sh | awk '{ print $1 }'`${NC}\n" | |
} | |
function freespace { | |
printf "Free:\t ${GREEN}`df -h / | tail +2 | awk '{ print $4 }'`${NC}\n" | |
} | |
function space { | |
if [ ! "`pwd`" == $HOME ] && [ ! "`pwd`" == '/' ]; then | |
printf "Current: " | |
current_usage | |
fi | |
freespace | |
} | |
# utility function | |
function usage_for { | |
printf "${1} " | |
cd "$1" | |
current_usage | |
} | |
# run "root" (sudo -i) | |
function space2 { | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root (sudo -i / root)" | |
return | |
fi | |
local dir=`pwd` | |
usage_for /var/folders | |
usage_for /private/var/folders | |
usage_for /private/var/tmp | |
usage_for /private/var/vm | |
usage_for /Library/Caches | |
usage_for /Users/david/Library/Caches | |
usage_for /Users/david/Library/Ethereum | |
usage_for /Users/david/.ethash | |
usage_for /Users/david/tmp | |
usage_for /tmp | |
usage_for /.Spotlight-V100 | |
usage_for /.DocumentRevisions-V100 | |
usage_for /.fseventsd | |
printf "${BLUE}---------------${NC}\n" | |
usage_for /Users/david/Movies | |
usage_for /Users/david/Music | |
usage_for /Users/david/Music/iTunes/iTunes\ Music | |
usage_for /Users/david/Downloads/Torrents | |
usage_for /Users/david/Temp | |
cd $dir | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment