Difference between revisions of "cmd/find"
< cmd
Jump to navigation
Jump to search
(seed page) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
</hide> | </hide> | ||
==About== | ==About== | ||
− | {{ | + | The {{l/cmd|find}} [[cmd|command]] searches directory trees for files whose directory information meets particular criteria. |
+ | |||
+ | To search by content, use [[grep]]. | ||
==Examples== | ==Examples== | ||
− | Find a file or folder named "kate" somewhere | + | Find a file or folder named "kate" somewhere under the current folder: |
− | : < | + | : <syntaxhighlight inline lang=bash>find -name kate</syntaxhighlight> |
Find all files or folders with the extension ".txt": | Find all files or folders with the extension ".txt": | ||
− | : < | + | : <syntaxhighlight inline lang=bash>find -name *.txt</syntaxhighlight> |
− | = | + | |
− | + | View, in realtime, all additions to any file whose extension is ".log": | |
− | + | : <syntaxhighlight inline lang=bash>find . -name "*.log" | xargs tail -f</syntaxhighlight> | |
+ | (This is useful for monitoring web server (e.g. [[Apache web server|Apache]]) activity.) | ||
+ | |||
+ | Note that <code>-name</code> is case-sensitive; use <code>-iname</code> for case-agnostic. |
Latest revision as of 13:43, 17 February 2025
About
The find command searches directory trees for files whose directory information meets particular criteria.
To search by content, use grep.
Examples
Find a file or folder named "kate" somewhere under the current folder:
find -name kate
Find all files or folders with the extension ".txt":
find -name *.txt
View, in realtime, all additions to any file whose extension is ".log":
find . -name "*.log" | xargs tail -f
(This is useful for monitoring web server (e.g. Apache) activity.)
Note that -name
is case-sensitive; use -iname
for case-agnostic.