./large-files.sh 10
Last active
January 6, 2019 20:28
-
-
Save dmhendricks/83815167dcfb8128088aac0d4f54643c to your computer and use it in GitHub Desktop.
BASH Scripts
This file contains 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/bash | |
usage() { | |
cat <<EOM | |
Usage: $(basename $0) [int] | |
Parameter: | |
- int: Number of top results to return | |
Examples: | |
./$(basename $0) 10 | |
EOM | |
exit 0 | |
} | |
[ -z $1 ] && { usage; } | |
#find . -type f -print0 | xargs -0 ls -la | awk '{print int($5/1000) " KB\t" $9}' | sort -n -r -k1 | head -$1 | |
find . -type f -ls | sort -k 7 -r -n | head -$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment