Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Find (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Predicates=== {{anchor|type filters}} Commonly-used primaries include: * <code>-name ''pattern''</code>: tests whether the file name matches the shell-glob pattern given. * <code>-type ''type''</code>: tests whether the file is a given type. [[Unix file types]] accepted include: ** <code>b</code>: [[Device file|block device (buffered)]]; ** <code>c</code>: [[Device file|character device (unbuffered)]]; ** <code>d</code>: ''[[Directory (computing)|directory]]''; ** <code>f</code>: ''[[regular file]]''; ** <code>l</code>: [[symbolic link]]; ** <code>p</code>: [[named pipe]]; ** <code>s</code>: [[Unix domain socket|socket]]; ** <code>D</code>: [[Doors (computing)|door]]. * <code>-print</code>: always returns true; prints the name of the current file plus a newline to the [[stdout]]. * <code>-print0</code>: always returns true; prints the name of the current file plus a null character to the [[stdout]]. Not required by POSIX. * <code>-exec ''program'' ''[arguments...]'' ;</code>: runs ''program'' with the given arguments, and returns true if its exit status was 0, false otherwise. If ''program'', or an argument is '''{}''', it will be replace by the current path (if ''program'' is '''{}''', <code>find</code> will try to run the current path as an executable). POSIX doesn't specify what should happen if multiple '''{}''' are specified. Most implementations will replace all '''{}''' with the current path, but that is not standard behavior. * <code>-exec ''program'' ''[arguments...]'' {} +</code>: always returns true; run ''program'' with the given arguments, followed by as many paths as possible (multiple commands will be run if the maximum command-line size is exceeded, like for [[xargs]]).<ref name=sus/> * <code>-ok ''program'' ''[arguments...]'' ;</code>: for every path, prompts the user for confirmation; if the user confirms (typically by entering ''y'' or ''yes''), it behaves like <code>-exec ''program [arguments...]'' ;</code>, otherwise the command is not run for the current path, and false is returned. * <code>-maxdepth</code>: Can be used to limit the directory depth to search through. For example, <code>-maxdepth 1</code> limits search to the current directory. If the expression uses none of <code>-print0</code>, <code>-print</code>, <code>-exec</code>, or <code>-ok</code>, find defaults to performing <code>-print</code> if the conditions test as true.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)