Locate command with examples

The locate command can quickly find a file.

When invoked, locate does not trail tree your disc, but uses a database to retrieve the file faster.

Advantage :

Search very rapidly.

Disadvantage :

It searches the files which are only in database or it won’t locate the file

To solve this problem. The command updatedb will update the database.

The generic syntax of locate is simple:

locate xyzfile

Without option, locate will return all occurrences of  xyzfile.

Some options to refine your search ,Search all files .py  and does not display error messages.

locate “*.py” -q



Search  for xorg file and limits the number of entries to 10

locate “xorg” -n 10


Search for in case sensitive file name

locate -i XYZ.PHP

Related Posts with Thumbnails

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comment moderation is enabled. Your comment may take some time to appear.