Pete's Linux Advent Calendar 2007

The 12th day

Locating files

You probably know the command locate. How about building your own locate database of your home directory? Since in many environments the home directories are not included in the system locatedb for privacy reasons. That's actually quite simple, create a (weekly or daily) crontab entry that runs this command:
updatedb --localpaths="${HOME}" --output="${HOME}/.locatedb"
and create a script Locate:
#!/bin/bash
locate --database="${HOME}/.locatedb" "$@"
Now you can use Locate just as locate it only searches the contents your home directory.
Pete's Linux Advent Calendar 2007

Valid HTML 4.01!

Comments? send mail to pkruse@arcor.de my monogram