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

October 6th, 2011 by Regaz

Searching for Files or Directories on Bash Shell




This 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*"
(Visited 1 times, 1 visits today)

Tags: , , , ,


Comments are disabled