Difference between revisions of "Find"


From Knoppix Documentation Wiki
Jump to: navigation, search
(Init from PHPWiki)
 
m (rm redundant text)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
catrletob
 
[[find]] is a powerful [[Linux]] command used to locate files in many ways.
 
[[find]] is a powerful [[Linux]] command used to locate files in many ways.
  
Line 14: Line 15:
 
Locate all files in other directory, as above.
 
Locate all files in other directory, as above.
 
   
 
   
  [[find]] . -daystart -cmin -3660 -cmin +0 -name '.txt' -print
+
  [[find]] . -daystart -cmin -3660 -cmin 0 -name '.txt' -print
 
Locate all files, named '''.txt, and have changed yesterday. <br>
 
Locate all files, named '''.txt, and have changed yesterday. <br>
  
Line 23: Line 24:
  
 
Where do you find this stuff? If man pages don't have enough examples. Try linux help sites, the old guy's Unix books, or FAQ Unix command web searches.
 
Where do you find this stuff? If man pages don't have enough examples. Try linux help sites, the old guy's Unix books, or FAQ Unix command web searches.
 
[[Old GuyUnixBooks]]
 
 
  
 
[[Category:Useful Linux Commands]]
 
[[Category:Useful Linux Commands]]

Latest revision as of 13:01, 16 October 2008

catrletob find is a powerful Linux command used to locate files in many ways.

Note: This is perhaps the most complex (grammatically) Unix command there is. Don't worry if it looks confusing. Few Linux pros really know all the ins and outs of it, either.

Examples

find . -print

Locate all files, links, and directories.

find . -name '.txt' -print

Locate all files named .txt, from current dirctory.

[[find /home/knoppix -name '*.bak' -print

Locate all files in other directory, as above.

find . -daystart -cmin -3660 -cmin  0 -name '.txt' -print

Locate all files, named .txt, and have changed yesterday.

find . --maxdepth 1 -type f -print

Locate all "only" files in current directory.

Yes, the grammar and switches can get quite intense.

Where do you find this stuff? If man pages don't have enough examples. Try linux help sites, the old guy's Unix books, or FAQ Unix command web searches.