Created
June 15, 2017 20:35
-
-
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
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
#!/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