Difference between revisions of "Find and Locate"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
(Created page with "Find and Locate - Searching for files in Linux Use the find command to search for a file or pattern. here are examples: find ./ -name filename (locate filename in or be...")
 
m
Line 1: Line 1:
 
Find and Locate - Searching for files in Linux
 
Find and Locate - Searching for files in Linux
  
 +
* The find command works without the need to build a metabase
 +
* The locate command is much faster but depends on a metabase
 +
* find it typically present on any linux system while locate is part of mlocate which needs installed
 +
* find results are real-time, recent changes to the file system is not a problem
 +
* locate requires you run 'updatedb' to rebuild the metabase before recent changes on the file system can be searched
 +
 +
== Find ==
 
Use the find command to search for a file or pattern.
 
Use the find command to search for a file or pattern.
  
Line 10: Line 17:
 
   find ./ -iname 'filen*'  (locate all files begin with
 
   find ./ -iname 'filen*'  (locate all files begin with
 
   filen and ignore case)
 
   filen and ignore case)
 +
 +
== Locate ==

Revision as of 10:18, 28 March 2019

Find and Locate - Searching for files in Linux

  • The find command works without the need to build a metabase
  • The locate command is much faster but depends on a metabase
  • find it typically present on any linux system while locate is part of mlocate which needs installed
  • find results are real-time, recent changes to the file system is not a problem
  • locate requires you run 'updatedb' to rebuild the metabase before recent changes on the file system can be searched

Find

Use the find command to search for a file or pattern.

here are examples:

  find ./ -name filename   (locate filename in or below the
  current directory path)
  find / -name 'filename' 2>/dev/null   (locate filename 
  anywhere up from root filesystem)
  find ./ -iname 'filen*'   (locate all files begin with
  filen and ignore case)

Locate