"Find File" (Ubuntu 12.04)

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

"Find File" (Ubuntu 12.04)

Postby catgate » Wed Jul 31, 2013 10:32 am

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.
catgate
LXF regular
 
Posts: 1058
Joined: Wed Jul 19, 2006 6:45 pm
Location: Just over there, in that corner.

Postby roseway » Wed Jul 31, 2013 11:51 am

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
roseway
LXF regular
 
Posts: 450
Joined: Thu Jan 18, 2007 2:27 pm

Postby catgate » Wed Jul 31, 2013 3:46 pm

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.
catgate
LXF regular
 
Posts: 1058
Joined: Wed Jul 19, 2006 6:45 pm
Location: Just over there, in that corner.

Postby nelz » Wed Jul 31, 2013 5:37 pm

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)
User avatar
nelz
Site admin
 
Posts: 8520
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby roseway » Wed Jul 31, 2013 5:38 pm

You're welcome :)

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
roseway
LXF regular
 
Posts: 450
Joined: Thu Jan 18, 2007 2:27 pm

Postby catgate » Thu Aug 01, 2013 3:21 pm

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.
catgate
LXF regular
 
Posts: 1058
Joined: Wed Jul 19, 2006 6:45 pm
Location: Just over there, in that corner.

Postby ajgreeny » Mon Aug 05, 2013 9:41 am

You can also narrow down the locate output by piping to grep, eg
Code: Select all
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: Select all
(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!
ajgreeny
LXF regular
 
Posts: 457
Joined: Wed May 10, 2006 8:18 pm
Location: Oxfordshire.


Return to Help!

Who is online

Users browsing this forum: No registered users and 3 guests