LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-14-2021, 01:32 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Importance of mlocatedb on modern Linux?


How important is mlocate, on a personal desktop distro? What important apps/services rely on it to function properly? It seems I/O these days is probably fast enough, and the desire to see actual files, and not a cached database, practically render locate unneeded?
 
Old 10-14-2021, 01:53 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,813

Rep: Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958
To me, very important.

Many distributions do not even install mlocate anymore. If the typical user does not have much CLI experience then I assume they will just use the file browser for their searches.

If you want to find a file quickly and know it has not been recently updated using locate is easy.

find is a great tool but can get complex quickly and can be confusing for users who do not use the CLI and just want a quick search.
 
3 members found this post helpful.
Old 10-14-2021, 04:38 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,159

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
I use it exclusively. Having had very bad experiences with the indexers - gnome tracker primarily - I make efforts to disable them on every install. Re-running the updatedb is trivial in my case, so I have always disabled the timed task if installed as well.
 
1 members found this post helpful.
Old 10-14-2021, 08:25 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,400
Blog Entries: 28

Rep: Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166
I find mlocate and the associated "locate" command essential.
 
1 members found this post helpful.
Old 10-15-2021, 08:28 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,922

Rep: Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040
I still use locate, but I also have this quick-find function defined in my shell init file
Code:
qf () 
{ 
    find "$HOME" /local/library \( -name ".*" -prune \) -o \( -ipath "*$1*" -type f -readable -print \) 2> /dev/null
}
After the initial search any subsequent ones are quite responsive as everything is in vfs cache, and it has the advantage of being realtime rather than point in time like locatedb. It's also more focussed as my locatedb covers a much wider set of directories.

IMO both approaches have a role to play.


Like syg00 I've had bad experiences with the desktop indexers, and now refuse to go anywhere near them.
 
Old 10-15-2021, 08:38 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,096

Rep: Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365Reputation: 7365
no app/services rely on this (I guess), but I use it too. And find it very useful.

Quote:
Originally Posted by GazL View Post
I still use locate, but I also have this quick-find function defined in my shell init file
Code:
qf () 
{ 
    find "$HOME" /local/library \( -name ".*" -prune \) -o \( -ipath "*$1*" -type f -readable -print \) 2> /dev/null
}
find is slow, there is a tool called fd which is much faster and more efficient. (and by the way, I do not really use it so often, that caching is not really helpful)

Last edited by pan64; 10-15-2021 at 08:39 AM.
 
Old 10-15-2021, 08:59 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,922

Rep: Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040
Code:
$ time -p locate Solsbury
/local/library/audio/CDs/Peter Gabriel/1977 - Peter Gabriel 1/02 - Solsbury Hill.flac
real 0.18
user 0.18
sys 0.00
$ time -p qf Solsbury
/local/library/audio/CDs/Peter Gabriel/1977 - Peter Gabriel 1/02 - Solsbury Hill.flac
real 0.05
user 0.04
sys 0.00
$
That's quick enough for me, and I have enough ram for the dirents to hang around in cache for a very long time.
 
Old 10-15-2021, 11:50 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,706
Blog Entries: 4

Rep: Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949
I still like to use locate, but on my Macintosh I had to turn-off most of the features of their "Spotlight Search" because the daemon was consuming way too many resources updating its databases. Once the initial "locate" database is built, it doesn't take too much time to keep it updated ... usually in the dead of night.
 
Old 10-15-2021, 12:05 PM   #9
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,702
Blog Entries: 19

Rep: Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501Reputation: 4501
I use locate a lot. It's much easier to use than find and has the advantage that it searches substrings by default, so you don't need to have the correct filename.
 
  


Reply



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: Importance of Labs in Linux Training LXer Syndicated Linux News 0 09-26-2009 09:20 AM
LXer: The Importance of Purity on the Linux Desktop LXer Syndicated Linux News 0 07-21-2008 10:50 AM
LXer: The importance of delivering localized Linux LXer Syndicated Linux News 0 12-31-2007 07:40 PM
LXer: The Importance of Video Settings on Linux LXer Syndicated Linux News 0 02-02-2007 12:24 AM
LXer: Microsoft's Support Of Linux Shows Rising Importance Of ... LXer Syndicated Linux News 0 04-10-2006 03:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:57 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration