How Search/Find/Locate File or Directory on Linux/Mac/Unix Shell

October 6, 2011 | By Regaz | Filed in: Uncategorized.

Searching for Files or Directories on Bash Shell

The Tutorial Tutorial Shows You Simply How to Search for Files and Directories on Linux/Unix Command Line Shell.

There are 2 Main ways of Searching for Files or Directories on the Unix like Systems Shell.

How Search/Find/Locate File or Directory on Linux/Mac/Unix Shell - Featured
  1. The ‘find‘ Command (More time consuming always ready.)

    Case Sensitive

    find path/To/Root/Search -name "String*" 2>/dev/null
  2. Case Insensitive

    find path/To/Root/Search -iname "StRinG*" 2>/dev/null

    The “2>/dev/null” mean: Don’t take in Compt the Errors than Can Stop the Searching process…

  3. And the ‘locate’ Command (Quicker but may Require of Updating the Search DB…)

    How to Update the locate Search Database

    Guide on Updating locate DB
    locate String*

    This will give you a List of all Files and Directories Containing the “String”
    To Refine your Search you can use a Pipe with the “grep” Command
    In practice you Filter your Search Results

    locate String* | grep "*some/Thing*"

Tags: , , , ,