Last active
June 20, 2017 17:43
-
-
Save codrcodz/b642289539c28fd41ddc444db59f394e to your computer and use it in GitHub Desktop.
Shell script for generic Linux systems. Used to quickly find large files on the file system based on common large file extensions.
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
nlvl=-20; \ | |
printf "MB\tDirectory Name\n"; \ | |
nice -n ${nlvl} \ | |
find / \ | |
-type f \ | |
-regextype egrep \ | |
-regex ".*\.(gz$|iso$|sql$|bak$|zip$|log$|tar$|csv$|tgz$|mp4$|png$|xz$)" \ | |
-exec dirname '{}' \; \ | |
| sort -u \ | |
| while read dir; do \ | |
nice -n ${nlvl} du -m $dir; \ | |
done 2>&1 \ | |
| sort -nr \ | |
| head -n 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment