Difference between revisions of "cmd/find"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< cmd
Jump to navigation Jump to search
(brief explanation)
m (updated tag call)
Line 10: Line 10:
 
==Examples==
 
==Examples==
 
Find a file or folder named "kate" somewhere under the current folder:
 
Find a file or folder named "kate" somewhere under the current folder:
: <bash>find -name kate</bash>
+
: <syntaxhighlight lang=bash>find -name kate</syntaxhighlight>
  
 
Find all files or folders with the extension ".txt":
 
Find all files or folders with the extension ".txt":
: <bash>find -name *.txt</bash>
+
: <syntaxhighlight lang=bash>find -name *.txt</syntaxhighlight>
  
 
View, in realtime, all additions to any file whose extension is ".log":
 
View, in realtime, all additions to any file whose extension is ".log":
: <bash>find . -name "*.log" | xargs tail -f</bash>
+
: <syntaxhighlight lang=bash>find . -name "*.log" | xargs tail -f</syntaxhighlight>
 
(This is useful for monitoring web server (e.g. [[Apache web server|Apache]]) activity.)
 
(This is useful for monitoring web server (e.g. [[Apache web server|Apache]]) activity.)
 
==Links==
 
==Links==
 
===Reference===
 
===Reference===
 
* {{l/manpage}}
 
* {{l/manpage}}

Revision as of 23:53, 27 December 2017

About

The find Linux 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.)

Links

Reference