Thursday, May 17, 2012

find command

find . -type f -mtime +30 -name test\* -exec rm {} \;

-iname ( insecitive name pattern) -exec will treat line by line return from find.

$ find / -name 'program.c' 2>/dev/null
$ find / -name 'program.c' 2>errors.txt

$ find /home/david -name 'index*'
$ find /home/david -iname 'index*'

$ find -name met*
$ find /mp3collection -name '*.mp3' -size -5000k
$ find / -size +10000k

$ find /home/david -amin -10 -name '*.c'
$ find /home/david -atime -2 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'
$ find /home/david -mtime -2 -name '*.c'

$ find / -mount -name 'win*'
$ find /mp3-collection -name 'Metallica*' -and -size +10000k
$ find /mp3-collection -size +10000k ! -name "Metallica*"
$ find /mp3-collection -name 'Metallica*' -or -size +10000k

$ find / - name 'Metallica*' -exec ls -l {\}\ \;

referenc:
http://linux.about.com/od/commands/l/blcmdl1_find.htm
http://www.codecoffee.com/tipsforlinux/articles/21.html

No comments:

Post a Comment