locate — Searching for files from a cached database of files on the system


locate [-i] {search string}

locate [-i] -r {regular expression search string}

Note that the database is created by the updatedb command. Typically, there is a cron job in /etc/cron.daily which will run updatedb daily, but not all systems are setup to do so.


  • Find all filenames containing the word devel in their absolute path

    locate devel

  • Look for .txt files and .TXT files

    locate -i "*.txt"

  • Find all pdf files under user's home directory

    locate "*.pdf" | grep /home/user

  • Locate all c source code files whose names only contain the letters a-f

    locate -r "/[a-f]*\.c$"