Skip to content

Instantly share code, notes, and snippets.

@meoso
Created June 15, 2017 20:35
Show Gist options
  • Save meoso/1fb35e89597731da59b434391d963230 to your computer and use it in GitHub Desktop.
Save meoso/1fb35e89597731da59b434391d963230 to your computer and use it in GitHub Desktop.
AwesomeView.sh - Largest Folders and Files - Found this script online somewhere and modified it slightly
#!/bin/sh
if [ "$1" = "" ] ; then
folder=$(pwd)
else
folder=$1
fi
echo ""
date
df -h "$folder"
echo "Largest Directories:"
du -hcx -BM --max-depth=9 "$folder" 2>/dev/null | grep "[0-9]M" | sort -grk 1 | head -20
echo "Largest Files:"
nice -n 19 find "$folder" -mount -type f -print0 2>/dev/null | xargs -0 du -h -BM | sort -rnk1 | head -n20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment