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.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
what's to explain? That's all I know about it, and the manpage is pretty self explanatory. You really need to ask specific questions, rather than expecting to be taught.
ignore the name mlocate, it's just a different implementation of the same service. M = merging with the updatedb tool.
what's to explain? That's all I know about it, and the manpage is pretty self explanatory. You really need to ask specific questions, rather than expecting to be taught.
ignore the name mlocate, it's just a different implementation of the same service. M = merging with the updatedb tool.
'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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.