Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
find(1)			    General Commands Manual		       find(1)

NAME
       find - find files

SYNOPSIS
       pathname_list [expression]

DESCRIPTION
       The  command recursively	descends the directory hierarchy for each path
       name in pathname_list (that is, one or more path	names)	seeking	 files
       that  match  a Boolean expression written in the	primaries given	below.
       By default, does	not follow symbolic links.

       The Boolean expression is  evaluated  using  short-circuit  evaluation.
       This  means that	whenever the result of a Boolean operation (AND	or OR)
       is known	from evaluating	the left-hand argument,	the  right-hand	 argu-
       ment is not evaluated.

       In the descriptions of the primaries, the argument n represents a deci-
       mal integer; means more than n, means less than n, and n	means  exactly
       n.

       The following primaries are recognized:

       A position-independent term which causes	descent	of the directory
				hierarchy  to be done so that all entries in a
				directory are acted on	before	the  directory
				itself.	  This can be useful when is used with
				cpio(1)	to transfer files that	are  contained
				in  directories	 without write permission.  It
				is also	useful when using cpio(1) and the mod-
				ification  dates  of  directories must be pre-
				served.	 Always	true.

       A position-independent term which causes
				to follow symbolic links.  When	following sym-
				bolic  links,  keeps  track of the directories
				visited	so that	it can detect infinite	loops;
				for example, such a loop would occur if	a sym-
				bolic link pointed to an  ancestor.  This  ex-
				pression  should  not be used with the expres-
				sion. Always true.

       A position-independent term which causes
				to stop	descending any	directory  whose  file
				system is not of the type specified by FStype,
				where FStype is	one  of	 or  representing  the
				CDFS, HFS, JFS (VXFS) or NFS file system type,
				respectively.

				In this	 context,  mount  points  inherit  the
				FStype	of their parent	directory.  This means
				that when has been specified and encounters an
				NFS mount point	that is	mounted	on an HFS file
				system,	the mount point	will  be  visited  but
				entries	 below	that mount point will not.  It
				is important to	note that when has been	speci-
				fied,  any  HFS	 file systems that are beneath
				the mount point	of an NFS file system are  not
				traversed.  Always true.

       True if the file	physically resides on the local
				system.	  This does not	restrict the search to
				only files which physically reside on the  lo-
				cal system, it merely matches such files.  See

       A position-independent term that	causes
				to avoid crossing any file system mount	points
				that exist below starting points enumerated in
				pathname_list.	The mount point	itself is vis-
				ited, but entries below	the  mount  point  are
				not.  Always true.

       Identical to		This primary is	provided for backward compati-
				bility only.  is preferred over

       True if pattern		file matches the last component	of the current
				file  name.   Pattern  is matched according to
				Pattern	Matching Notation for filename	expan-
				sion.	Pattern	should be escaped (using back-
				slash) or quoted  when	is  invoked  from  the
				shell, to prevent the shell from expanding any
				metacharacters.	 Pattern may  contain  supple-
				mentary	code set characters.

       Same as			except the full	path (as would be output by is
				used instead of	just the base name.  Note that
				characters  are	not treated as a special case.
				For example, matches

       In this primary,	the argument
				mode is	used to	represent file mode bits.  The
				argument  is  identical	 in format to the mode
				operand	as described in	chmod(1), with the ex-
				ception	 that  the first character must	not be
				the operator.  When using the symbolic form of
				mode, the starting template is assumed to have
				all file mode bits cleared.

				If the leading minus is	omitted, this  primary
				is  true when the file permission bits exactly
				match the value	of mode.  Bits associated with
				the  symbolic  attributes  (set-user-ID,  set-
				group-ID) and (sticky bit)  are	 ignored  when
				the minus is omitted.

				If  mode  is preceded by a minus, this primary
				is true	if all of the bits  that  are  set  in
				mode are also set in the file permission bits.
				In this	case, the  bits	 associated  with  the
				symbolic attributes and	are significant.

       True if the file	system to which	the file belongs is of type
				FStype,	 where FStype is one of	or correspond-
				ing to the CDFS, HFS, NFS, or JFS (VXFS)  file
				system type, respectively.

       True if the type	of the file is
				c, where c is one of:
				     Regular file
				     Directory
				     Block special file
				     Character special file
				     FIFO (named pipe)
				     Symbolic link
				     Socket
				     Network special file
				     Mount point

       True if the file	has	n links.

       True if the file	belongs	to the user
				uname.	 If  uname is numeric and does not ap-
				pear as	a login	name in	the file, it is	 taken
				as  a  user ID.	 The uname operand can be pre-
				ceded by a or to modify	the comparison of  the
				primaries. If the argument n represents	a dec-
				imal integer; means more than  n,  means  less
				than n,	and n means exactly n.

       True if the file	belongs	to the group
				gname.	 If  gname is numeric and does not ap-
				pear in	the file, it is	taken as a  group  ID.
				The  gname  operand can	be preceded by a or to
				modify the comparison of the primaries.	If the
				argument n represents a	decimal	integer; means
				more than n, means less	than n,	 and  n	 means
				exactly	n.

       True if the file	belongs	to a user ID
				that  is  not listed in	the password database.
				See passwd(4).

       True if the file	belongs	to a group ID
				that is	not listed in the group	database.  See
				group(4).

       True if the file	is	n  blocks long (512 bytes per block).  If n is
				followed by a the size is in bytes.

       True if the file	access time subtracted from the	initialized time is
				n-1 to n multiples of 24 h. The	initialization
				time shall be a	time between the invocation of
				the utility and	the first access by that invo-
				cation of the utility to any file specified by
				its operands.  The access time of  directories
				in pathname_list is changed by itself.

       True  if	 the file modification time subtracted from the	initialization
       time is
				n-1 to n multiples of 24 h. The	initialization
				time shall be a	time between the invocation of
				the utility and	the first access by that invo-
				cation of the utility to any file specified in
				its operands.

       True if the time	of last	change of file status  information  subtracted
       from
				the  initialization time is n-1	to n multiples
				of 24 h. The initialization time  shall	 be  a
				time between the invocation of the utility and
				the first access by  that  invocation  of  the
				utility	to any file specified by its operands.

       True if the current file	has been modified more recently	than the argu-
       ment
				file.

       True if the indicated time value
				(tv1) of the current file is  newer  than  the
				indicated  time	value (tv2) of file.  The time
				values tv1 and tv2 are each selected from  the
				set of characters:

				     The time the file was last	accessed
				     The  time	the inode of the file was last
				     modified
				     The time the file was last	modified

				If the tv2 character is	omitted,  it  defaults
				to Note	that the option	is equivalent to

				Syntax examples;

       True if the file	serial number (inode number) is
				n.   Note  that	file serial numbers are	unique
				only within a given file  system.   Therefore,
				matching  file serial numbers does not guaran-
				tee that the referenced	files are the same un-
				less  you restrict the search to a single file
				system.

       True if the file	is the same physical file as the file specified	by
				path (i.e., linked to path).  This primary  is
				similar	 to  but correctly detects when	a file
				is hard-linked to  path,  even	when  multiple
				file systems are searched.

       Causes the current path name to be printed.
				Always true.

       True if the executed	cmd  returns a zero value as exit status.  The
				end of cmd must	be punctuated by  a  semicolon
				or a plus sign (semicolon and plus are special
				to the shell and must be escaped). When	a plus
				sign  is  used,	 cmd aggregates	a set of path-
				names and executes on the set. The reason  for
				preferring  to	a semicolon is vastly improved
				performance.  Any command argument is replaced
				by  the	 current  path	name.  cmd may contain
				supplementary code set characters.

       Same as			except that  the  generated  command  line  is
				printed	with a question	mark first, and	is ex-
				ecuted only if the user	responds by typing The
				form of	the affirmative	response is locale de-
				pendent: y in the C locale, see	LANG on	 envi-
				ron(5).	  cmd  may  contain supplementary code
				set characters.

       Write the current file on
				device in cpio(4) format (5120-byte  records).
				The use	of implies Always true.

       Same as			but  adds the option to	The use	of implies Al-
				ways true.

       If the current entry is a directory, cause
				to skip	that directory.	 This can be useful to
				avoid walking certain directories, or to avoid
				recursive loops	when using Note, however, that
				is  useless if the option has also been	given.
				See the	description of and the section,	below,
				for more information.  Always true.

       This is a positive-logic	version	of
				A  is  performed after every directory,	unless
				is successfully	evaluated for that  directory.
				As  an	example,  the following	three commands
				are equivalent:

				Note, however, that is useless if  the	option
				has also been given.  Always true.

       True if the parenthesized expression is true.
				The spaces are required.  Parentheses are spe-
				cial to	the shell and must be escaped,	as  in
				and

       Primaries can be	combined by using the following	operators (in order of
       decreasing precedence):

       Logical NOT operator.	     True if expression	is not true.

       Logical AND operator.	     True if both of the expressions are true.

       Logical OR operator.	     True if either or both of the expressions
				     are true.

       If  expression  is  omitted, or if none of or is	specified, is assumed.
       The and primaries each evaluate their respective	arguments once.

   HFS Access Control Lists
       The primary enables the user to search for HFS access control list  en-
       tries.  It  is true if the file's access	control	list matches an	access
       control list pattern or contains	optional access	control	 list  entries
       (see acl(5)).  It has three forms:

       Match all files whose access control list includes all
				(zero  or  more)  pattern entries specified by
				the aclpatt pattern.

       Match a file only if its	access control list
				includes all (zero or  more)  pattern  entries
				specified  by  the  aclpatt pattern, and every
				entry in its access control list is matched by
				at  least  one	pattern	entry specified	in the
				aclpatt	pattern.

       Match all		files containing optional access control  list
				entries.

       The  aclpatt  string can	be given as an operator	or short form pattern;
       see acl(5).

       By default, is true for files whose access control  lists  include  all
       the  (zero  or more) access control list	patterns in aclpatt.  A	file's
       access control list can also contain unmatched entries.

       If aclpatt begins with the remainder of the string must match  all  en-
       tries in	a file's access	control	list.

       The  aclpatt string (by default,	or the part following can be either an
       access control list or an access	control	list pattern.  However,	if  it
       is an access control list, aclpatt must include at least	the three base
       entries ((user.%, mode),	(%.group, mode), and (%.%, mode)).

       As a special case, if aclpatt is	the word the primary is	true for files
       with access control list	entries.

   JFS Access Control Lists
       The  primary enables the	user to	search for JFS access control list en-
       tries. It is true if the	file's access control list matches  an	access
       control	list  pattern or contains optional access control list entries
       (see aclv(5)).  It has three forms:

       Match all files whose access control list includes all
				(zero or more) pattern	entries	 specified  by
				the aclpatt pattern.

       Match a file only if its	access control list
				includes  all  (zero  or more) pattern entries
				specified by the aclpatt  pattern,  and	 every
				entry in its access control list is matched by
				at least one pattern entry  specified  in  the
				aclpatt	pattern.

       Match all		files  containing optional access control list
				entries.

       By default, is true for files whose access control  lists  include  all
       the  (zero  or more) access control list	patterns in aclpatt.  A	file's
       access control list can also contain unmatched entries.

       If aclpatt begins with the remainder of the string must match  all  en-
       tries in	a file's access	control	list.

       An  aclpatt  consists  of  a type field,	an ID field, and a mode	field,
       separated by colons.  Multiple comma-separated aclpatts may  be	speci-
       fied.

       The  type field is one of or optionally preceded	by and can be abbrevi-
       ated to and respectively.  A type field of matches  any	of  the	 above
       types.

       The  ID	field is either	a numeric user or group	ID, a user or group ID
       string from or respectively, or which matches any ID.

       The mode	field consists of a string of  three  characters.   The	 first
       character  is  either indicating	that read permission is	granted; indi-
       cating that read	permission is denied; or which matches either state of
       read  permission.  The second character is either or similarly indicat-
       ing the state of	write permission; and the third	character is either or
       indicating the state of execute permission.

       As a special case, if aclpatt is	the word the primary is	true for files
       with optional access control list entries.

EXTERNAL INFLUENCES
   Environment Variables
       If an internationalization variable is not specified or is null,	it de-
       faults to the value of

       If is not specified or is null, it defaults to (see lang(5)).

       If  is  set  to a nonempty string value,	it overrides the values	of all
       the other internationalization variables.

       If any internationalization variable contains an	invalid	 setting,  all
       internationalization variables default to (see environ(5)).

       determines  the interpretation of text as single	and/or multibyte char-
       acters, the classification of characters	as printable, and the  charac-
       ters matched by character class expressions in regular expressions.

       determines the locale that should be used to affect the format and con-
       tents of	diagnostic messages written to standard	error and  informative
       messages	written	to standard output.

       determines the location of message catalogues for the processing	of

   International Code Set Support
       Single- and multibyte character code sets are supported.

EXAMPLES
       Search  the  two	 directories  and  for files containing	the string and
       print the names of the files:

       Remove all files	named or that have not been accessed for a week:

	      Note that	the spaces delimiting the escaped parentheses are  re-
	      quired.

       Print  the  names of all	files on this machine.	Avoid walking directo-
       ries while still	printing the mount points:

       Match only local	files, and do not examine the contents of  any	direc-
       tory found to be	remotely mounted:

       This only works correctly if there are no local file systems mounted on
       top of remote directories. This example will print all local  files  on
       the system larger than 50 blocks, without wasting time accessing	remote
       files.

       To get the same effect, but to check for	files in  local	 file  systems
       mounted on remote directories, use:

       Copy the	entire file system to a	disk mounted on	avoiding the recursive
       copy problem.  Both commands are	equivalent (note the use of instead of

       Copy the	root disk to a disk mounted on skipping	all mounted file  sys-
       tems  below Note	that does not cause to be skipped, even	though it is a
       mount point.  This is because is	the starting point  and	 only  affects
       entries starting	points.

       Change  permissions on all regular files	in a directory subtree to mode
       444, and	permissions on all directories to 555:

	      Note that	output from was	piped to xargs(1) instead of using the
	      primary.	This is	because	when a large number of files or	direc-
	      tories is	to be processed	 by  a	single	command,  the  primary
	      spawns  a	 separate  process for each file or directory, whereas
	      xargs collects file names	or directory names into	multiple argu-
	      ments  to	 a  single chmod command, resulting in fewer processes
	      and greater system efficiency. The delimiter for the primary can
	      be used to achieve the same efficiency.

   Access Control List Examples
       Find all	files not owned	by user	that have access control lists with at
       least one entry associated with and one entry for no specific  user  in
       group with the read bit on and the write	bit off:

       Find  all files that have a read	bit set	in any access control list en-
       try:

       Find all	files that have	the write bit unset and	execute	bit set	in ev-
       ery access control list entry:

       Find all	files that have	optional access	control	list entries:

DEPENDENCIES
   NFS
       The primary is always false for NFS files.

WARNINGS
       Because	of  interoperability  goals,  does not support archiving files
       larger than 2GB or files	that have user/group IDs  larger  than	60,000
       (60K).  Files with user/group IDs greater than 60K are archived and re-
       stored under the	user/group ID of the current process.

AUTHOR
       was developed by	AT&T and HP.

FILES
       Group names
       Mount points
       User names

SEE ALSO
       chacl(1),  chmod(1),  cpio(1),  setacl(1),  sh(1),  test(1),  xargs(1),
       mknod(2),   stat(2),   cpio(4),	fs(4),	group(4),  passwd(4),  acl(5),
       aclv(5),	environ(5), lang(5), regexp(5).

STANDARDS CONFORMANCE
								       find(1)

NAME | SYNOPSIS | DESCRIPTION | EXTERNAL INFLUENCES | EXAMPLES | DEPENDENCIES | WARNINGS | AUTHOR | FILES | SEE ALSO | STANDARDS CONFORMANCE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=find&sektion=1&manpath=HP-UX+11.22>

home | help