The hint:
- a) uses sudo to update the db as root,
- b) assumes you're using bash as your shell interpreter,
- c) sets an alias so as to be transparent,
- d) adds "-i" to your locate command, making it case-insensitive,
- e) considers the db outdated if it's older than an hour, (actually 3600 seconds, which you can change of course.)
alias locate='if [ $((`date +%s`-`eval $(stat -s /var/db/locate.database); echo $st_mtime`)) -gt 3600 ]; then echo "locate: db is too old!">/dev/stderr; sudo /usr/libexec/locate.updatedb; fi; locate -i'
[crarko adds: Note that in creating the command alias you slightly change the meaning of the locate command; you can use a different alias if you want to keep both ways around and update manually. You lose some of the value of the hint if you do that.]

