Difference between revisions of "Locate"
From Hackepedia
Jump to navigationJump to searchLine 1: | Line 1: | ||
− | |||
Trying to locate a file, if you're lucky you can try | Trying to locate a file, if you're lucky you can try | ||
$ locate [[variables|$file]] | $ locate [[variables|$file]] | ||
+ | |||
+ | |||
+ | |||
+ | == Updated your locate database == | ||
+ | |||
+ | On FreeBSD: | ||
+ | |||
+ | # vi /etc/locate.rc | ||
+ | |||
+ | as you might want to say add /usr/ports to PRUNEPATH and then: | ||
+ | |||
+ | # /usr/libexec/locate.updatedb | ||
+ | |||
+ | |||
+ | On Debian GNU/Linux: | ||
+ | |||
+ | --prunepath is one of the many options found in the [[Manual]], then rebuild your database: | ||
+ | |||
+ | # /usr/bin/updatedb | ||
+ | |||
+ | Once you have this database, you can use many tools such as which, whereis and locate. | ||
+ | |||
+ | # which bash | ||
+ | /usr/local/bin/bash | ||
+ | # whereis bash | ||
+ | bash: /usr/local/bin/bash /usr/local/man/man1/bash.1.gz /usr/ports/shells/bash | ||
+ | # locate bash | ||
+ | /usr/jail/usr/share/zoneinfo/Africa/Lubumbashi | ||
+ | /usr/local/bin/bash | ||
+ | /usr/local/bin/bash2 | ||
+ | /usr/local/bin/bashbug | ||
+ | [snip] |
Revision as of 14:17, 18 January 2006
Trying to locate a file, if you're lucky you can try
$ locate $file
Updated your locate database
On FreeBSD:
# vi /etc/locate.rc
as you might want to say add /usr/ports to PRUNEPATH and then:
# /usr/libexec/locate.updatedb
On Debian GNU/Linux:
--prunepath is one of the many options found in the Manual, then rebuild your database:
# /usr/bin/updatedb
Once you have this database, you can use many tools such as which, whereis and locate.
# which bash /usr/local/bin/bash # whereis bash bash: /usr/local/bin/bash /usr/local/man/man1/bash.1.gz /usr/ports/shells/bash # locate bash /usr/jail/usr/share/zoneinfo/Africa/Lubumbashi /usr/local/bin/bash /usr/local/bin/bash2 /usr/local/bin/bashbug [snip]