Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 22 Sep 2019, 14:44
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Normal Linux commands to Locate your system files, INSTANTLY
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 13 [184 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 11, 12, 13 Next
Author Message
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Thu 12 Feb 2015, 05:28    Post subject:  

I understand. The reason for the repeats you've seen is so that WOOFCE/WOOFQ developers who would have the commands a part of the Linux builds could "choose" which they felt most at ease with; namely updatedb or slocate. Personally, I side with your choice of slocate as a single versus the combination updatedb-locate. But, in the past, Lighthouse has made available over the years, the latter.

Either approach could/would be a cron job.

Thanks, though for the clarity. Good idea. Idea

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14312
Location: Gatineau (Qc), Canada

PostPosted: Thu 12 Feb 2015, 08:11    Post subject:  

Hello, file db lovers! Very Happy

Here's a little script that will update your slocate database at every
you-decide-which-interval!Smile

Please take a minute to read the comments in the script.
It'll all become clear how to use it. Thanks.

Besides the attached *.pet will do the default set-up for you
(with an update every 45 minutes).

Code:
#!/bin/ash
# ash is used here because of its +/- 50 % greater speed than bash.
# Filename: /root/my-applications/bin/auto-updatedb-slocate.sh,
# with link in /root/Startup.
# Purpose: update your slocate database every x hour. or x minutes.
# Thanks to member Médor for having found the "while" time loop below.
# musher0, 12 Febr. 2015
####
sleep 1m # With this script, the slocate database will be updated
# exactly one minute after you began your Puppy session. After that
# it will be updated according to the interval you specify below, at
# at lines 19 to 23.

while [ 1 ]; do
   slocate -e "/proc,/dev/,/tmp,/initrd" -f "NFS,iso9660" -l0 -u

# Uncomment the one appropriate for your use.

# sleep 20m # every 20 minutes
# sleep 30m # every 30 minutes
sleep 45m # every 45 minutes
# sleep 1h # every hour
# sleep 2h # every 2 hours
done

# From : auto_clean_mem, by Médor, 20150208. Source :
# http://murga-linux.com/puppy/viewtopic.php?p=826916&sort=lastpost#826916
# Retrieved 09.02.2015 13:43:49.
#


Enjoy!

musher0
auto-updatedb-slocate-0.1.pet
Description  An auto-update db for slocate in all of 977 bytes :)
pet

 Download 
Filename  auto-updatedb-slocate-0.1.pet 
Filesize  977 Bytes 
Downloaded  249 Time(s) 

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
slavvo67

Joined: 12 Oct 2012
Posts: 1601
Location: The other Mr. 305

PostPosted: Fri 13 Feb 2015, 01:07    Post subject:  

I decided to take Retrotechguy's item a bit further. I simply call it drive index creator (in menu under "Business") or via terminal typing "index1".

1st you mount all the drives you wish to index and choose option 1. This creates the index.

Options 2 and 2a let you search the index file you created.

Option 3 lets you copy any of the sub-searches from 2. (root/chuck1)

Most in this thread can probably do better but I had fun making it.

Musher0 - Where is the actual Slocate program? Is it a pet somewhere?

Best,

Slavvo67
Drive_Index_Creator1.pet
Description 
pet

 Download 
Filename  Drive_Index_Creator1.pet 
Filesize  1.44 KB 
Downloaded  235 Time(s) 
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2647

PostPosted: Fri 13 Feb 2015, 03:19    Post subject:  

updatedb/slocate is not a matter of choosing one or the other -the two go together and must be used together. slocate *consults* the database which must first be created by updatedb and must be kept up-to-date using updatedb.

The only way one can get really quick results on a large filesystem is by indexing the contents -then the results can be retrieved nearly instantly. Without an index/db, then a tool like 'find' is the only way to get the information -and it will take about the same time to run as using updatedb.

I, like other here, then to use find -after cd-ing into the directory where I want to look. If I don't remember at all where something is, then that means starting the search from the next level up -or the next...
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Fri 13 Feb 2015, 13:46    Post subject: A PET provides one distro an Instant file-finding capability  

Installed this PET built by @StemSee for Emsee24
  1. Opened a terminal, got this
    Code:
    sh-4.3# slocate
    slocate: warning: Could not find the group: slocate in the /etc/group file.
    slocate: fatal error: This is a result of the group missing or a corrupted group file.

  2. Updated system's group file
    Code:
    sh-4.3# echo "slocate::114:root,spot,fido" >> /etc/group

  3. Group file updated for command use in terminal, got this
    Code:
    sh-4.3# slocate
    slocate: fatal error: Could not find user database '/var/lib/slocate/slocate.db':  No such file or directory
  4. Ask slocate to update/create the database of files PUPPY can see (per recommendation from @Musher0)
    Code:
    sh-4.3# slocate -u -e /dev,/initrd,/lost+found,/proc

  5. NOW, EVERY SEARCH FOR FILESYSTEM FILE IS INSTANTANEOUS!
    Code:
    sh-4.3# slocate *.log
        o   
        o
        o   
        o   
Request for a PET update
    Could this PET be updated adding to the group file when its installed and could it also run an initial "slocate -u" to create the initial database for users. By doing so, no user would pose a support question to the forum on this command when the system database is absent.

We can be hopeful that PUPs build by development via WOOFCE/WOOFQ, doing the following steps, for all new PUPs
  • have slocate -u run at time of build or at initial pfix=ram of any PUP starts
Hope this dialogue is clear and accurate for community understanding and use.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Fri 13 Feb 2015, 14:32    Post subject:  

the pet already has all that code in /.pinstall.sh

But it is my first pinstall script maybe it should not be hidden just /pinstall.sh

For updating /etc/group file you should choose a number tht isn;t already used! 114 was just an educated guess.
Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 2464
Location: In The Way

PostPosted: Fri 13 Feb 2015, 14:56    Post subject:  

Try this

Edit: It Works!
slocate-3.2-i483.pet
Description 
pet

 Download 
Filename  slocate-3.2-i483.pet 
Filesize  29.29 KB 
Downloaded  238 Time(s) 
Back to top
View user's profile Send private message MSN Messenger 
musher0

Joined: 04 Jan 2009
Posts: 14312
Location: Gatineau (Qc), Canada

PostPosted: Fri 13 Feb 2015, 15:37    Post subject:  

slavvo67 wrote:
(...)
Musher0 - Where is the actual Slocate program? Is it a pet somewhere?

Best,

Slavvo67


Hi, Slavvo67.

You can download the slackware package I used from the second URL listed at:
http://murga-linux.com/puppy/viewtopic.php?p=826647&sort=lastpost#826647
which is on the 1st page of the current thread.

As I mentioned in that post, I felt no need to create a pet package, at least on this
Puppy slacko, because my slacko-6.0b recognized the archive format and installed it
directly and instantly simply by clicking on the slocate.tgz archive.

Alll Puppies can install tgz packages directly, no? The capacity is built-in, in all
Puppies, like for *.deb archives. (I didn't do any extensive testing, but I think so.)

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14312
Location: Gatineau (Qc), Canada

PostPosted: Fri 13 Feb 2015, 15:42    Post subject:  

amigo wrote:
updatedb/slocate is not a matter of choosing one or the other -the two go together and must be used together. slocate *consults* the database which must first be created by updatedb and must be kept up-to-date using updatedb.

The only way one can get really quick results on a large filesystem is by indexing the contents -then the results can be retrieved nearly instantly. Without an index/db, then a tool like 'find' is the only way to get the information -and it will take about the same time to run as using updatedb.

I, like other here, then to use find -after cd-ing into the directory where I want to look. If I don't remember at all where something is, then that means starting the search from the next level up -or the next...


Amigo,

As I kept explaining to gcmartin for a little while, the peculiarity of the slocate
package is that the updatedb is built-in. With slocate you don't need a separate
updatedb utility. The update routine is within the slocate program.

Please read my previsous posts before more confusion sets in? Smile
I mean "read" as in "actually reading" ? Wink Thanks.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2647

PostPosted: Sat 14 Feb 2015, 04:43    Post subject:  

Yes, Musher, of course the slocate package also contains the program updatedb. What I was trying to point out is that this:
"SEARCH FOR FILESYSTEM FILE IS INSTANTANEOUS"
is not accurate. slocate does not search the 'filesystem' -it searches the database created by using 'updatedb' or 'slocate -u'

If your run either of those commands and then add a file or files to the filesystem, these new items will not show up in the slocate 'search' since they are not in the database. slocate is only useful and accurate when the database is kept up-to-date.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14312
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Feb 2015, 07:09    Post subject:  

amigo wrote:
Yes, Musher, of course the slocate package also contains the program updatedb. What I was trying to point out is that this:
"SEARCH FOR FILESYSTEM FILE IS INSTANTANEOUS"
is not accurate. slocate does not search the 'filesystem' -it searches the database created by using 'updatedb' or 'slocate -u'

If your run either of those commands and then add a file or files to the filesystem, these new items will not show up in the slocate 'search' since they are not in the database. slocate is only useful and accurate when the database is kept up-to-date.


True. Sorry for the misunderstanding.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Sat 14 Feb 2015, 15:03    Post subject:  

Our biggest item is how does the command(s) get into PUPs terminal commandset as a standard item. PETs are useful in setup but, if its in the PUP's commandset, then users or distro developers can implement as they see proper need and use.

Not sure how to approach this, now that the community, here, has shown its benefit in use.

This is NOT a special program developed. This is a LINUX command, missing in PUPs

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14312
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Feb 2015, 16:01    Post subject:  

Hi, everyone.

Indeed, it's blazingly fast. Another feature, for me anyway, is that it is accessible
from the initial console. That may sound like nothing, but yesterday, slocate
helped me find my way around on the initial console. (I was wondering where I
had put a new wm I wanted to test.)

In any case, the slocate utility is an all-around plus for PuppyLinux. If it had been
in Puppy when I started, It would have saved me hours of feeling and groping
around the system.

It's worth having slocate in every Puppy and explaining its use to newbies. It'll
save them countless time and frustrations.

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2937
Location: USA

PostPosted: Sat 14 Feb 2015, 22:18    Post subject:  

slavvo67 wrote:
I decided to take Retrotechguy's item a bit further. I simply call it drive index creator (in menu under "Business") or via terminal typing "index1".


I'm still digesting what these tools do...

I have a lot of USB drives (HDD and flash), and usually don't leave stuff plugged in.

I'm thinking a combination of the indexxing tool here, and a better front-end to access the stored databases. It appears that this and slocate both create a single index file in /root/.

Since any given drive might be plugged in, in a random order, it would make sense for each drive to have its own database, and have those collated by the graphical or command line tool when plugged in (the tool can store the list of the file tree, and identify which mount location when it reports the search results).

_________________
Add swapfile
WellMinded Search
PuppyLinux.US Search
Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 2811
Location: South Australia :-(

PostPosted: Sun 15 Feb 2015, 07:32    Post subject:  

By default it creates a database called slocate.db in /var/lib/slocate

By having drives mounted does not necessarily mean they will be indexed, well not here anyway. The only drive/s that seems to get indexed are / and /mnt/home

How do you make it index all drives?

_________________
Software <-> Distros <-> Tips <-> Newsletters
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 3 of 13 [184 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 11, 12, 13 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0916s ][ Queries: 12 (0.0277s) ][ GZIP on ]