locate - find filenames quickly
Shell globbing and quoting characters ``( *'' ``?'' ``\'' ``['' and ``]'' may be used in pattern although they will have to be escaped from the shell. Preceding any character with a backslash (``\'' ) eliminates any special meaning which it may have. The matching differs in that no characters must be matched explicitly, including slashes (``/'' )
As a special case, a pattern containing no globbing characters (``foo'' ) is matched as though it were ``*foo*''
Historically, locate only stored characters between 32 and 127. The current implementation store any character except newline (`\n' ) and NUL (`\0' ) The 8-bit character support does not waste extra space for plain ASCII file names. Characters less than 32 or greater than 127 are stored in 2 bytes.
The following options are available:
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.
The database is typically built by user ``nobody'' and the locate.updatedb8 utility skips directories which are not readable for user ``nobody'' group ``nobody'' or world. For example, if your HOME directory is not world-readable, none of your files are in the database.
The database is not byte order independent. It is not possible to share the databases between machines with different byte order. The current implementation understands databases in host byte order or network byte order if both architectures use the same integer size. So on a Fx Ns /i386 machine (little endian), you can read a locate database which was built on SunOS/sparc machine (big endian, net).
The utility does not recognize multibyte characters.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |