Find

From Wiki
Revision as of 18:28, 4 February 2011 by Scott (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To find files under /home whose names start with ".x":

find /home/ -name ".x*" -print

To find .xscreensaver files under /home and read their mode lines:

find /home -name ".xscreensaver" -exec grep mode {} \;

To find all files under the /bin tree and apply md5sum to them: find /bin -type f -exec md5sum {} \;

To find files that have been modified in the last 40 days:

find . -mtime -40 -print

To find files that have been modified more than 40 days ago:

find . -mtime +40 -print

To find files that have been modified in the last 40 days and then sort by date:

find . -mtime -40 -print | xargs ls -ldt

To remove P-files that are more than one day old:

find /usr/g/mrraw -name P\* ! -mtime 1 -exec rm -f {} \;

Find files owned by user 100 (useful after a user is deleted):

find -user 100 -print

Find root setuid/setgid binaries:

find / -xdev -type f -perm +ug=s