Search in database instead the default file name database. Multiple -d options are allowed. Each additional -d option adds the specified database to the list of databases to be searched. The option database may be a colon-separated list of databases. A single colon is a reference to the default database.
$ locate -d $HOME/lib/mydb: foo
will first search string "foo" in $HOME/lib/mydb and then in /var/db/locate.database.
$ locate -d $HOME/lib/mydb::/cdrom/locate.database foo
will first search string "foo" in $HOME/lib/mydb and then in /var/db/locate.database and then in /cdrom/locate.database. "$ locate -d db1 -d db2 -d db3 pattern" is the same as "$ locate -d db1:db2:db3 pattern" or "$ locate -d db1:db2 -d db3 pattern" If - is given as the database name, standard input will be read instead. For example, you can compress your database and use:
$ zcat database.gz | locate -d - pattern
This might be useful on machines with a fast CPU and little RAM and slow I/O. Note: you can only use one pattern for stdin. |