Code(alpha) - Tips & Tutorials for Linux

 
  • Increase font size
  • Default font size
  • Decrease font size
Home Tutorials General / Linux Find files very quickly using Locate with Linux

Find files very quickly using Locate with Linux

Print

Tired of using the Find command? want something faster? Use locate!!! It's easy to use.

locate myfile

Would give you all the files found since last indexing.

Locate uses a database containing file indexes. That's why it is very fast to find files, that's the good point of this system. The bad point is that the database is not updated everytime you create/move/delete a file. But it's easy to force updating.

 

To update the database (as root, that's why we use sudo):

sudo updatedb

This should take around 10 or 20 seconds to complete.

Then you can start searching:

$ locate bashrc
/etc/bash.bashrc
/etc/skel/.bashrc
/home/user1/.bashrc
/home/user2/.bashrc
/root/.bashrc
/usr/share/base-files/dot.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc

 

That's the basics on how to use locate.

Please see "man locate" to get more help about how to use locate.



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! JoomlaVote! Google! Live! Facebook! StumbleUpon! Yahoo! Free social bookmarking plugins and extensions for Joomla! websites!
Last Updated ( Monday, 22 September 2008 14:13 )  

Add your comment

Your name:
Your email:
Subject:
Comment:

Useful Links


Newsflash

The next Ubuntu release, codenamed Intrepid Ibex, version 8.10 beta just released!

If you wish to try it out and find those hidden bugs, go ahead : http://www.ubuntu.com/testing/intrepid/beta

Note: This is a beta release. Do not install it on production machines. The final stable version will be released on October 30th, 2008.