Skip to content


find quicky

The few find templates I find useful in a day to day job.

The ones below were of great help when I had to clean Esafe that had more
than 100,000 files in the spool ! So usual shell wild-card expansion didn’t work
(try to do ls in a folder with 130000 files ;) So I removed files
by date – files created last 24 hours per remove.

find . -mtime 0 -exec rm -f {} \;
find . -mtime 0 # find files created/modified within the past 24 hours
find . -mtime -1 # find files created/modified within the past 0 - 24 hours
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
find . -mmin +3 -mmin -10 # find files modifed between 4 and 9 minutes

Default is  logical AND between clauses
NB the -regexp switch to the find looks for a complete match !
Finding by permission pattern and then removing:
- FInd files that have at LEAST following permissions set
find . -type f -perm -0750 -exec rm -f {} \;
Find files with ANy of the permissions set:
find . -type f -perm +0750 -exec rm -f {} \;
and finally find files with pattern EXACTLY matching :
find . -type f -perm 0750 -exec rm -f {} \;
Find by UID filetype and size:
find . -type f -uid 0 -size +2k -exec ls -l {} \;
modifiers to size switch: b w k c

Posted in Linux.

Tagged with .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Cb says

    Very useful thanks ;)



Some HTML is OK

or, reply to this post via trackback.