Thursday, January 3, 2008

Find command

Basic uses of find

How to find a file?
$ find /export/home -name testfile

How to find a file and its details?
$ find /export/home -name testfile -exec ls -l {} \;

How to find a file which is not modified since past 60 days?
$ find /export/home -mtime +60 -exec ls -l {} \;

How to find a file which is not accessed since past 60 days?
$ find /export/home -atime +60 -exec ls -l {} \;


How to find a directory
$ find /var/adm -type d


Advance uses of Find command

How to find a file which contains "report" word in it?
$ find /export/home -type f -exec grep "report" '{}' /dev/null \;



No comments: