Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Linux / Unix locate command

Quick links

About 
Syntax
Examples
Related commands
Unix main page

About locate

List files in databases that match a pattern.

Syntax

locate [-d path | --database=path] [-e | --existing] [-i | --ignore-case ] [--version] [--help] pattern...

-d path
--database=path
Instead of searching the default file name database, search the file name databases in path, which is a colon-separated list of database file names. You can also use the environment variable LOCATE_PATH to set the list of database files to search. The option overrides the environment variable if both are used.

The file name database format changed starting with GNU find and locate version 4.0 to allow machines with different byte orderings to share the databases. This version of locate can automatically recognize and read databases produced for older versions of GNU locate or Unix versions of locate or find.

-e
--existing
Only print out such names that currently exist (instead of such names that existed when the database was created). Note that this may slow down the program a lot, if there are many matches in the database.
-i
--ignore-case
Ignore case distinctions in both the pattern and the file names.
--help Print a summary of the options to locate and exit.
--version Print the version number of locate and exit.

Examples

locate perl

In the above example the system would locate perl on the local machine.

Note: You may need to run the "updatedb" command to update the database in order to find the file you are searching for. This command should be ran anytime *nix is first installed or a major update occurs.

Related commands

find
whereis
xargs

 

Index

Category:
Linux / Unix

Companies:
Click here

Related Pages:

 

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope