Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
02-24-2005, 07:16 AM
|
#1
|
Member
Registered: Sep 2003
Posts: 52
Rep:
|
Can updatedb update a single directory?
I know if I run `updatedb` it would index all filesystem files. Sometimes, I install files into a directory and I want the new files to be in the database. I want a command such as `updatedb /opt/appdir` to update the new files information into the global database, not changing others. I consulted man but could not figure a way to update a single directory. Is it possible to do it?
|
|
|
02-24-2005, 07:29 AM
|
#2
|
Senior Member
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517
Rep:
|
Have you tried updatedb --localpaths='/path/to/directory'?
This is from 'man updatedb', btw.
|
|
|
02-24-2005, 07:56 AM
|
#3
|
Member
Registered: Sep 2003
Posts: 52
Original Poster
Rep:
|
I am using Fedora Core 3. I tried man updatedb, man locate/man slocate but none of them has the --localpaths info documented.
What's wrong with FC3?
And, I don't think `updatedb --localpaths=/opt/mozilla.org` works for me. It still takes several minutes to complete. /opt/mozilla.org has Firefox and Thunderbird installed. That does not need to take so long right?
Last edited by neo_in_matrix; 02-24-2005 at 08:00 AM.
|
|
|
02-24-2005, 08:48 AM
|
#4
|
Senior Member
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517
Rep:
|
I tried this on my homedirectory (33000 files) and it took appr. 30 s to complete.
Did you try it with ' around your path?
EDIT: here is the section from 'man updatedb':
Code:
OPTIONS
--localpaths='path1 path2...'
Non-network directories to put in the database.
Default is /.
--netpaths='path1 path2...'
Network (NFS, AFS, RFS, etc.) directories to put in
the database. The environment variable NETPATHS
also sets this value. Default is none.
--prunepaths='path1 path2...'
Directories to not put in the database, which would
otherwise be. The environment variable PRUNEPATHS
also sets this value. Default is /tmp /usr/tmp
/var/tmp /afs.
--prunefs='path...'
File systems to not put in the database, which
would otherwise be. Note that files are pruned
when a file system is reached; Any file system
mounted under an undesired file system will be
ignored. The environment variable PRUNEFS also
sets this value. Default is nfs NFS proc.
Last edited by abisko00; 02-24-2005 at 08:51 AM.
|
|
|
02-24-2005, 10:03 AM
|
#5
|
Member
Registered: Sep 2003
Posts: 52
Original Poster
Rep:
|
What's wrong with my system? I run `man updatedb` but it only a very short message (less than 2 pages), without the text you have.
|
|
|
02-24-2005, 12:58 PM
|
#6
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Your system is fine ... his distro doesn't use slocate
but the ordinary, security-hole infested version :} which
has a different set of options ... only downside: you
can't update an individual directory
Cheers,
Tink
Last edited by Tinkster; 02-24-2005 at 12:59 PM.
|
|
|
02-24-2005, 07:23 PM
|
#7
|
Member
Registered: Sep 2003
Posts: 52
Original Poster
Rep:
|
I don't understand. Fedora Core 3 is believed to have the latest software (they say this on there website).
BTW, I can run slocate. For example: slocate glib.h
|
|
|
02-24-2005, 08:38 PM
|
#8
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Heh... yup, and that's exactly what I said: The problem
is not with your installation but with his. He uses the OLD,
insecure locate/updatedb rather than the NEW, secure
slocate. And I didn't say you can't run it ...
Cheers,
Tink
|
|
|
02-24-2005, 09:23 PM
|
#9
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep:
|
Learn the find utility because it is just as quick as the locate utility. Depending on the filesystem used. Searching for files should take less than a minute when using the find utility.
|
|
|
02-24-2005, 09:57 PM
|
#10
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
And less than two seconds using locate ;)
That said: find has MANY things to offer that
locate can't cover, and I use it heaps.
Cheers,
Tink
|
|
|
02-25-2005, 04:25 AM
|
#11
|
Member
Registered: Sep 2003
Posts: 52
Original Poster
Rep:
|
On my FC3 box:
>slocate --version
Secure Locate 2.7 - Released January 24, 2003
What version do you have?
|
|
|
02-25-2005, 05:06 AM
|
#12
|
Senior Member
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517
Rep:
|
Sorry to hear about the 'old and insecure' version of locate in SuSE.
And also sorry for the previously provided wrong information: updatedb --localpaths='' will do the same as updatedb -U path: it creates a database from this path and replaces the previously existing database. It will not update the existing database with the specified path.
|
|
|
02-25-2005, 06:00 AM
|
#13
|
Member
Registered: Sep 2003
Posts: 52
Original Poster
Rep:
|
Thanks for your reply. It's helpful :-)
And where can I download the latest version of slocate? I prefer prebuilt RPM packages. Thanks again.
|
|
|
02-25-2005, 06:56 AM
|
#14
|
Senior Member
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517
Rep:
|
I guess with 2.7 your are pretty up-to-date, the problem seems to be my SuSE, not your FC3 version.
But have a look here:
http://rpmseek.com/rpm-pl/slocate.ht...ate:PN:0:0:0:0
|
|
|
02-25-2005, 07:04 AM
|
#15
|
Senior Member
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517
Rep:
|
I was curious to find out more about the difference between locate and slocate. It seems that slocate will show only files the actual user has access to, whereas locate shows all data. I guess this doesn't matter on a single user system. Is there more to know?
|
|
|
All times are GMT -5. The time now is 10:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|