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


Reply
  Search this Thread
Old 02-24-2005, 08:16 AM   #1
neo_in_matrix
Member
 
Registered: Sep 2003
Posts: 52

Rep: Reputation: 15
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?
 
Old 02-24-2005, 08:29 AM   #2
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
Have you tried updatedb --localpaths='/path/to/directory'?

This is from 'man updatedb', btw.
 
Old 02-24-2005, 08:56 AM   #3
neo_in_matrix
Member
 
Registered: Sep 2003
Posts: 52

Original Poster
Rep: Reputation: 15
Red face

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 09:00 AM.
 
Old 02-24-2005, 09:48 AM   #4
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
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 09:51 AM.
 
Old 02-24-2005, 11:03 AM   #5
neo_in_matrix
Member
 
Registered: Sep 2003
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
Old 02-24-2005, 01:58 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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 01:59 PM.
 
Old 02-24-2005, 08:23 PM   #7
neo_in_matrix
Member
 
Registered: Sep 2003
Posts: 52

Original Poster
Rep: Reputation: 15
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
 
Old 02-24-2005, 09:38 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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
 
Old 02-24-2005, 10:23 PM   #9
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
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.
 
Old 02-24-2005, 10:57 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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
 
Old 02-25-2005, 05:25 AM   #11
neo_in_matrix
Member
 
Registered: Sep 2003
Posts: 52

Original Poster
Rep: Reputation: 15
On my FC3 box:
>slocate --version
Secure Locate 2.7 - Released January 24, 2003

What version do you have?
 
Old 02-25-2005, 06:06 AM   #12
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
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.
 
Old 02-25-2005, 07:00 AM   #13
neo_in_matrix
Member
 
Registered: Sep 2003
Posts: 52

Original Poster
Rep: Reputation: 15
Thanks for your reply. It's helpful :-)

And where can I download the latest version of slocate? I prefer prebuilt RPM packages. Thanks again.
 
Old 02-25-2005, 07:56 AM   #14
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
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
 
Old 02-25-2005, 08:04 AM   #15
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: SuSE, Ubuntu
Posts: 3,513

Rep: Reputation: 58
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?
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to configure updatedb to update locate database manually septanla Linux - General 4 12-22-2010 03:05 PM
Moving all mp3s to a single directory wjleon Linux - Newbie 4 07-13-2005 04:26 AM
how to configure updatedb.conf file for NFS sub-directory ursidious Linux - Newbie 1 04-05-2005 06:00 PM
is there a way to update a single package in gentoo? mdpniesta Linux - Software 4 01-26-2005 03:19 AM
What's the difference between 'updatedb' and 'updatedb&' ?? DreameR-X Linux - Newbie 4 12-18-2004 05:36 PM


All times are GMT -5. The time now is 04:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration