How-to Find/Search for File/Directory/Image/Path on Mac OS X 10.11 El Capitan Shell

Mac OS X locate Command Quick-Start




This is short Mac Tutorial Get You Started on Mac OS X El Capitan 10.11 with a Very Useful Shell Utility: the locate Command.

Almost all we are working on Mac before or after we need desperately to Find something from the Shell.

The Easiest and Fastest Way to Find System’s Entities in Unix-like Platforms is Matched Using the “locate” Shell Command.

Mac OS X 10.11 El Capitan search/find file/directory/image/path quick-start - featured
  1. Open a Command Line Terminal Window
    Applications > Utilities > Terminal
    (Press “Enter” to Execute Commands)

    How-to Find/Search for File/Image/Path/Directory on Mac OS X Command Line - Open Terminal
  2. Make a Command Alias to Update the locate Database

    nano $HOME/.profile

    Append:

    alias updatedb="sudo /usr/libexec/locate.updatedb"

    Ctrl+x to Save changes & Exit

  3. Update the Locate Database:

    updatedb

    You’ll be Propted to Insert the root User Password
    You need to Wait for a little while Until the Locate Database is Updated…
    This is procedure Should be Repeated Every Time you Use the locate Command and your System made some Significant Change.

    p>How-to Automatically Update the locate Database with Cron

    Cronjob Setup for updatedb
  4. Simple Keyword Searching

    locate [myKeyword]

    Whith the Syntax above you can Locate All Files, Directories, Images and Locations Containing the Given “myKeyword”

  5. How-to Refine your locate Search-Results

    How-to Use grep with locate