Linux Quick Finds

Finding Large Directories

look for large files with this command:

find . -type f -size +100000k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’

This looks for files over 100MB, but other than datafiles there were very few files found. I knew I needed to look for large directories. Directories that had a large amount of small files. This command worked nicely:

du -h / | grep ^[1-9][0-9][0-9.]*G | sort -rn

From there I was able to find the directories that I needed to clear out.

Find and zip files newer than X minutes

find . -mmin -1620 -type f -name \*_lm[d,s]\*trc -print -exec zip /tmp/`hostname` {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *