LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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

Reply
 
Search this Thread
Old 03-12-2012, 04:51 PM   #1
LinusStallman
Member
 
Registered: Mar 2010
Location: Ireland
Distribution: Linux Mint 17 MATE
Posts: 275

Rep: Reputation: 14
Question Can someone give me tips on using the 'locate' command - with examples?


Hi.

Can someone give me tips on using the 'locate' command - with examples?

Thanks in advance.

I know this so far:

Code:
# -i means not case sensitive
Code:
locate -i searchstring
Code:
locate -i stuff.txt
Also what is the deal with mlocate?
 
Old 03-12-2012, 04:57 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,390

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
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.
 
Old 03-13-2012, 06:09 AM   #3
LinusStallman
Member
 
Registered: Mar 2010
Location: Ireland
Distribution: Linux Mint 17 MATE
Posts: 275

Original Poster
Rep: Reputation: 14
Quote:
Originally Posted by acid_kewpie View Post
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.
I was just looking for a few quick examples.
 
Old 03-13-2012, 06:47 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,390

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
locate myfile

locate anotherfile

locate athirdfile

;-)
 
Old 03-13-2012, 09:18 AM   #5
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,899

Rep: Reputation: 774Reputation: 774Reputation: 774Reputation: 774Reputation: 774Reputation: 774Reputation: 774
Additional note;

'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.
 
1 members found this post helpful.
  


Reply

Tags
command, locate, search, searching


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Tips from an RHCE: How can I make dd give me a progress report? LXer Syndicated Linux News 0 08-17-2007 06:50 AM
cpan> locate -u Unknown shell command 'locate -u'. Type ? for help. sharad2005 Linux From Scratch 1 08-04-2006 12:40 AM
KDE ksysguard tips? .sgrd file examples? dbc001 Linux - General 0 03-14-2004 12:21 PM
Working examples of dd command satimis Linux - Newbie 2 01-05-2004 07:23 AM
Please give your advice, tips, and comments. gsmonk Linux - Networking 1 04-05-2003 08:57 PM


All times are GMT -5. The time now is 11:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration