Linux locate

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux locate

The command locate and find are used to search a file by their filename. But difference is that locate command is a background process and searches the file in database whereas, find command searches in filesystem. The locate command is much faster than find command.

If you are unable to find a file with locate command then it means that your database is out of date, and you can updte your database with the updatedb command.

Syntax:

locate <fileName>

Example:

  1. locate sysctl.conf  

  Linux Locate

 

Look at the above snapshot, command "locate sysctl.conf" has displayed all the locations of file 'sysctl.conf'.