Skip to content

Instantly share code, notes, and snippets.

@spicyjack
Last active December 20, 2015 13:49
Show Gist options
  • Save spicyjack/6141613 to your computer and use it in GitHub Desktop.
Save spicyjack/6141613 to your computer and use it in GitHub Desktop.
Shell function to find the "pigs", or large directories underneath the current directory, or a directory of your choice
function pigfind {
if [ "x$1" != "x" ]; then
FIND_PATH="$1"
else
FIND_PATH="."
fi
find $FIND_PATH -maxdepth 1 -type d -exec du -sh '{}' \; 2>/dev/null \
| sort -h
} # get the sizes of the subdirectories of $PWD, sort from smallest to largest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment