We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

micmath on 08/21/07


Tagged

linux


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

mabridge
alexxx
Leech


Find a file


Published in: Bash 


  1. # This can be slow...
  2. find / -name my_lost_file 2>/dev/null
  3.  
  4. # This is preindexed so is faster...
  5. locate my_lost_file
  6.  
  7. # If index is out of date, it needs updating.
  8. # This is also slow...
  9. locate -u

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: capitalist on August 21, 2007

To update locate on Mac/darwin you'll need to sudo /usr/libexec/locate.updatedb

Cheers!

You need to login to post a comment.