Can someone give me tips on using the 'locate' command - with examples?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
'locate' can also be combined with 'grep' (ok, that should be obvious), to useful effect;
So, eg, if what you know is that the file that you are looking for, you probably stored in your downloads directory and it probably was a pdf file
locate downloads | grep -i pdf
might get you closer. Still not close enough? Well, let's say it also concerned ubuntu, maybe
locate downloads | grep -i pdf |grep -i ubuntu
is the thing that gets you there. More than that ought to be an application of similar principles and possibly a careful reading of the man page. Anything really clever, and you'll probably need 'find' instead.