Find Summary


This chapter contained many examples of common find operations. There are many addtional find operators that were not covered. The following is a summary of some of the more commonly used operators of find . There is also a manual page in Appendix A describing find in more detail. Depending on the UNIX variant you are using, the -print option may or may not be needed.

find - graphics/finda_icon.gif Search for files.

Commonly used operators or options:

 

-atime n

   

Find files that were accessed n days ago. +n finds files accessed greater than n days ago and -n will find files accessed less than n days ago.

 

- ctime n

   

Find files in which the inode was modified n days ago. +n finds files in which the inode was modified greater than n days ago and -n will find files in which the inode modified less than n days ago.

 

- exec command

   

Execute command.

 

- group name

   

Find files belonging to the given group name where name can also be the group ID number.

 

-mount

   

Do not descend directories on other file systems (not available on all UNIX variants.)

 

-mtime n

   

Find files that were modified n days ago. +n finds files modified greater than n days ago and -n will find files modified less than n days ago.

 

- newer file

   

File was modified more recently than file .

 

-name pattern

   

Look for file name of pattern .

 

-ok command

   

Check to see that it is okay to execute command before doing so. This is similar to -exec except that you are prompted for permission.

 

-perm mode

   

Find files with the specified access mode . You would supply the access mode in octal.

 

-print

   

Print the current file name to standard output.

 

-type t

   

File has a type of t, such as d for directory and f for file.

 

-size n

   

Find files with a size of n blocks. A block is usually 512 bytes. Using +n will find files greater than n blocks, nc will find files n characters in size and +nc will find files greater than n characters in size.

 

- user uname

   

File is owned by uname.

 

Multiple Criteria:

   

-a to and two operators (operator1 -a operator2)

-o to or two operators (operator1 -o operator2)

! to specify that the operator not be matched (!operator)

\( expression )\ to specify that this expression be evaluated before others to specify preference.



HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net