Skip to content

Instantly share code, notes, and snippets.

@nbrew
Created August 3, 2015 17:22
Show Gist options
  • Save nbrew/05faa5529a07cdea6238 to your computer and use it in GitHub Desktop.
Save nbrew/05faa5529a07cdea6238 to your computer and use it in GitHub Desktop.
Print disk usage of each directory from the command line.
#!/bin/bash
#
# USAGE: print_disk_usage.sh [/path]
# # print from /
# print_disk_usage.sh
#
# # start in /usr/local
# print_disk_usage.sh /usr/local
#
DIR=${1}
if [ -z "$DIR" ]; then
DIR=/
fi
cd "${DIR}"
echo "Start: `date`"
echo '--------------------------------------'
du -sh *
echo '--------------------------------------'
echo "End: `date`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment