From RootdevWiki

Jump to: navigation, search

Contents

Find Examples

Find by Size

Find all files over 50M

find ./* -size +50000k -exec ls -lh {} \;

Find and then perform inplace edit

find ./* -name '*.html' -exec perl -pi -e 's/this/that/' {} \; 

Find by Age

Remove bounced messages that are older than 7 days from Majordomo announce lists (running as a weekly cron on the listserver -- and yes, I know, upgrade to Mailman is on the cards)

find ~majordom/virtual_mail/*/majordomo/bounces -name \
*.bounce.* -mtime +7 -exec rm {} \;

This works too, but now you're just being silly:

find ~majordom/*/*/*/bounces -name *.bounce.* -mtime +7 -exec rm {} \;

See Bash for related bits