Find files.

      locate [options] pattern


   -d path, --database=path
                Search databases in path.
                path must be a colon- separated list.

   -h, --help   Print a help message and exit.

   --version    Print version information and then exit.

Search database(s) of filenames and print matches. *, ?, [, and ] are treated specially; / and . are not.

Matches include all files that contain pattern, unless pattern includes metacharacters, in which case locate requires an exact match.

If locate does not work, run the command: slocate -u to rebuild the index.

Faster Searches

On modern hardware it is often faster to create and search an uncompressed index file of all filenames than to use the compressed locate database, source: Julia Evans [x]

sudo find / > database.txt
grep Alanis database.txt

[I do not] carry such information in my mind since it is readily available in books. ...The value of a college education is not the learning of many facts but the training of the mind to think ~ Albert Einstein

Related linux commands

udpatedb - Update the database for locate (usually run daily by cron to update the default database).
slocate - Security Enhanced version of GNU Locate (users won’t see files they don’t have access to).
find - Search for files that meet a desired criteria.
Equivalent Windows command: DIR /S - Display a list of files and folders.

Copyright © 1999-2024 SS64.com
Some rights reserved