Hi,

find -- Search for files in a directory hierarchy

Summary:

Find is useful to search for files meeting specified criteria in the
specified directory hierarchy. Tip: remember the '-print0 | | xargs -0r'
meme: it is usefull.

Example:

$ find -- List all files in current and its sub Dir.

$ find / -name resolv.conf -- Find the file with the name resolv.conf

$ find /etc -name '*conf*' -- Find all files ending in .conf in the /etc Dir.

$ find ~/ -size 1000c -- Find files that have a size equal to 1KB.

$ find ~/ -size +1500c -- Find files that have a size > 1KB.

$ find ~/ -size -1500c -- Find files that have a size < 1KB.

$ find ~/ -empty -- Find empty files and directories.

$ find ~/ -amin -5 -- Find files accessed in last 5 minutes.

$ find ~/ -atime -1 -- Find files accessed in last 24 hours.

$ find ~/ -mmin -5 -- Find files modified in last 5 minutes.

$ find ~/ -mtime -2 -- Find files modified in last 48 hours.

$ find ~/ -size +1kc -and -mtime 2 -- Find files (Size >1K & modified 
                                      time is 2 Days)

$ find ~/ -nouser -- Find files owned by an invalid user.

$ find ~/ -user user1 --  Find files owned by user1.

$ find ~/ -maxdepth 2 -name 'fi*' -- Search for files starting with 
          'fi' and don't go more 2 level down in the Dir structure.

$ find ~/ -name '*.conf' -ls -- Find the all .conf files and print the 
                                output in ls -l format.

$ find ~/ -name '*.txt' -exec cat {} \; -- Find all text files and cat
                                           the files.

Better (handles any number of files, and files with blanks in the name):
$ find ~/ -name '*.txt' -print0 | xargs -0r cat



$ find ~/ -name '*.txt' -printf %h\\n -- Find all text file and print
                                            the path of the each file.



Read: man find

        manoj
-- 
"If the King's English was good enough for Jesus, it's good enough for
me!" "Ma" Ferguson, Governor of Texas (circa 1920)
Manoj Srivastava <[EMAIL PROTECTED]> <http://www.debian.org/~srivasta/>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NLUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nlug-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to