Examples of find usage:
find /var/spool -mtime +60
Find every file under the directory /var/spool that was modified more than 60 days ago.
find /tmp -name core -type f -print | xargs /bin/rm -f
Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines, single or double quotes, or spaces.
find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing single or double quotes, spaces or newlines are correctly handled. The -name test comes before the -type test in order to avoid having to call stat(2) on every file.
References
- http://linux.about.com/od/commands/l/blcmdl1_find.htm
- http://www.linux.ie/newusers/beginners-linux-guide/find.php
- http://www.wagoneers.com/UNIX/FIND/find-usage.html
Examples of ‘find’ Command Usage