Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"Find File" (Ubuntu 12.04)

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
catgate
LXF regular


Joined: Wed Jul 19, 2006 7:45 pm
Posts: 1037
Location: Just over there, in that corner.

PostPosted: Wed Jul 31, 2013 11:32 am    Post subject: "Find File" (Ubuntu 12.04) Reply with quote

It is a feature that I seldom use, but when it is needed it is a very useful thing. This morning such a need arose, but could I find "Find File"...?

Please can someone point me in the right direction...or has it been left out of the distro?

Many thanks in advance.
_________________
Oh, sod it.
Back to top
View user's profile Send private message
roseway
LXF regular


Joined: Thu Jan 18, 2007 2:27 pm
Posts: 445

PostPosted: Wed Jul 31, 2013 12:51 pm    Post subject: Reply with quote

If your system has mlocate installed (or slocate or locate) then the quickest way to find a file by name is to type locate <part of filename>
_________________
Eric
Back to top
View user's profile Send private message
catgate
LXF regular


Joined: Wed Jul 19, 2006 7:45 pm
Posts: 1037
Location: Just over there, in that corner.

PostPosted: Wed Jul 31, 2013 4:46 pm    Post subject: Reply with quote

roseway wrote:
If your system has mlocate installed (or slocate or locate) then the quickest way to find a file by name is to type locate <part of filename>


Hecky thump, that's fast.
Thank you kindly.
_________________
Oh, sod it.
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8452
Location: Warrington, UK

PostPosted: Wed Jul 31, 2013 6:37 pm    Post subject: Reply with quote

locate uses a database, regularly rebuilt by a cron task, so there's no need for it to trawl the filesystem, but the downside is that it is not necessarily up to date. Find looks at the actual filesystem, so is slower but completely up to date.
_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
roseway
LXF regular


Joined: Thu Jan 18, 2007 2:27 pm
Posts: 445

PostPosted: Wed Jul 31, 2013 6:38 pm    Post subject: Reply with quote

You're welcome Smile

Locate (and its improved successors) uses a lookup database which gets refreshed periodically. You can update its database manually at any time by typing (as root) updatedb

(Crossed in the post with nelz)
_________________
Eric
Back to top
View user's profile Send private message
catgate
LXF regular


Joined: Wed Jul 19, 2006 7:45 pm
Posts: 1037
Location: Just over there, in that corner.

PostPosted: Thu Aug 01, 2013 4:21 pm    Post subject: Reply with quote

Thank you both.
I shall now have to brush up my Terminal skills. Ho Ho Ho.
I am still clearing up after my HD debacle.
_________________
Oh, sod it.
Back to top
View user's profile Send private message
ajgreeny
LXF regular


Joined: Wed May 10, 2006 9:18 pm
Posts: 449
Location: Oxfordshire.

PostPosted: Mon Aug 05, 2013 10:41 am    Post subject: Reply with quote

You can also narrow down the locate output by piping to grep, eg
Code:
locate filename | grep &USER
which will only report output from the current users home.

You can also limit the database locate uses by running, for example
Code:
(sudo) updatedb -U $HOME
sudo needed in ubuntu, etc, or run as root in non-sudo distros. This also works on actual folder pathways, eg sudo updatedb -U /etc
_________________
Xubuntu 12.04 user, and loving it!
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast