Last active
August 29, 2015 14:24
-
-
Save kauhat/9b6896356c64b5e2e74b to your computer and use it in GitHub Desktop.
Find large "error_log" files
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/sh | |
workdirname="error-logs"; | |
mkdir -p ${workdirname}; | |
workdir=$(cd $workdirname; pwd); | |
echo "Finding all error_log files" | |
find /home -maxdepth 16 -name "error_log" -exec echo -n -e {}"\0" \; \ | |
| du -hc --files0-from=- \ | |
> ${workdir}/.unsorted.txt; | |
echo "Sorting by size" | |
cat ${workdir}/.unsorted.txt | sort -h \ | |
> ${workdir}/processed.txt; | |
echo "Written output to \"${workdir}/processed.txt\"."; | |
#Clean up | |
rm ${workdir}/.unsorted.txt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment