LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   manipulating locate (mlocate, slocate) behaviour (http://www.linuxquestions.org/questions/linux-general-1/manipulating-locate-mlocate-slocate-behaviour-4175426770/)

ajaxStardust 09-11-2012 06:35 PM

manipulating locate (mlocate, slocate) behaviour
 
I suspect I could easily address my rhetoric here such that the truth of my environment be left untold. I've read threads; what appears to be the singular most Cygwin-focused thread, concluding: any discourse which might ensue will likely result in a valid discussion, weighing more on the topic of behaviour of xterm / BASH. Indeed, these operations are within a Cygwin MinTTY or Xterm BASH terminal. As far as I can tell, there's not much need to speak more of that peculiarity, regarding my query. True, 'locate' and 'updatedb' required much more tedious configuration than a "native" Linux shell, but I believe it's functioning rather quite the same.

I see ‘locate’ is not part of the GNU Coreutils, but rather-- I must remark, it's a bit confusing-- it is a branch of the 'dir' node: 'Top' of the INFO tree? (i being one who became quickly acquainted w/ "INFO foo", vs "MAN foo", it's my learning resource. I do NOT know if there is a significant, disparate context; purpose for one or the other (i.e. i presume it matters little whether we talk of INFO or MAN?)

I am struck by my uncertainty in both this notion of 'dir' (the Directory node), vs-- for example-- the coreutils, vs what is or is not simply a BASH command; BASH syntax.

I hope we might lay that to rest, by the end of the thread-- or, perhaps that's a lofty goal, eh? ;-)
(e.g. where am i? what's this handrest, reads qwertyuiop? who is Tim Berners-Lee, and when did I become so impotent?)

HERE'S THE BIG Q:
Please be patent with me: i realize I am overly verbose. I've tried for 20 years-- it doesn't go away; so with the included code, as follows:
Code:

ajaxStardust@Lenovo_I_Jah ~
$ locate -d /usr/local/var/locatedb/locate02.db --regextype=egrep -i -r \/.*\/[^\x2f\x5c]*fire.?ftp[^\x2f\x5c]*\.dat$
//STORA/FamilyLibrary/conf-n-Meta_Any-Other-Soft/FireFTP/fireFTPsites.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/#_DAT/fireFTPsites.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/@_GLOBAL/~_DAT_FireFTP/fireFTPprograms.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/@_GLOBAL/~_DAT_FireFTP/fireFTPsites.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPprograms.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPsites.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Seamonkey/Profiles/SeameTouchmeHealmonkey/fireFTPprograms.dat
//STORA/FamilyLibrary/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Seamonkey/Profiles/SeameTouchmeHealmonkey/fireFTPsites.dat
/cygdrive/c/Users/admin/AppData/Roaming/Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPprograms.dat
/cygdrive/c/Users/admin/AppData/Roaming/Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPsites.dat
/cygdrive/c/Users/i_love_i_jah_no_win7/AppData/Roaming/Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPprograms.dat
/cygdrive/c/Users/i_love_i_jah_no_win7/AppData/Roaming/Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPsites.dat
/cygdrive/o/conf-n-Meta_Any-Other-Soft/FireFTP/fireFTPsites.dat
/cygdrive/o/conf-n-Meta_HTTPClient/#_DAT/fireFTPsites.dat
/cygdrive/o/conf-n-Meta_HTTPClient/@_GLOBAL/~_DAT_FireFTP/fireFTPprograms.dat
/cygdrive/o/conf-n-Meta_HTTPClient/@_GLOBAL/~_DAT_FireFTP/fireFTPsites.dat
/cygdrive/o/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPprograms.dat
/cygdrive/o/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPsites.dat
/cygdrive/o/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Seamonkey/Profiles/SeameTouchmeHealmonkey/fireFTPprograms.dat
/cygdrive/o/conf-n-Meta_HTTPClient/User_AppData_Mozilla/Seamonkey/Profiles/SeameTouchmeHealmonkey/fireFTPsites.dat
/cygdrive/s/Documents and Settings/Uzernomer/Application Data/Mozilla/Firefox/_COMMON/fireFTPprograms.dat
/cygdrive/s/Documents and Settings/Uzernomer/Application Data/Mozilla/Firefox/_COMMON/fireFTPsites.dat
/cygdrive/s/Documents and Settings/Uzernomer/Application Data/Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPprograms.dat
/cygdrive/s/Documents and Settings/Uzernomer/Application Data/Mozilla/Firefox/Profiles/Hoardingbiatch/fireFTPsites.dat
/cygdrive/s/Documents and Settings/Uzernomer/Application Data/Mozilla/Seamonkey/Profiles/SeameTouchmeHealmonkey/fireFTPprograms.dat
/cygdrive/s/Documents and Settings/Uzernomer/Application Data/Mozilla/Seamonkey/Profiles/SeameTouchmeHealmonkey/fireFTPsites.dat 

ajaxStardust@Lenovo_I_Jah ~
$

WHAT I DESIRE:
A recommended method for modifying the command line, such that the (stdout, ?) provides more than the path.

I do not know whether 'UPDATEDB' catalogues meta data, such as '-atime,-ctime,-mtime'. I suspect: No. If yes, I do not know how to get-at-it, and thus-- your opportunity to resolve this thread, most likely.

If the data does not exist in the locate.db, then I'll have to ask another process to inspect those files. I realize 'locate' is related it 'find', in my understanding, at least to the extent that it seems to traverse the filesystem in a similar manner, albeit without troubling to evaluate so many logical expressions. I realize 'FIND' is one of the most powerful tools accessible via Bourne Again Shell terminals (e.g. xterm, rxvt), therefore I realize the notion of "How to use FIND" is quite beyond the scope of such a thread.

However...
Perhaps this is a fairly simple; common operation, as to have many well-known "one-liner" scripts about, as to satisfy what I wish to see in my report. If i have to 'tee' it out, for practical visibility, so be it. Whatever works.

You see the data shown there. It's 'sample data', albeit real as well. These .dat files represent various configurations of the popular Mozilla Firefox add-on component, FireFTP. Within or (as I wish to avoid) withOUT, any of the files shown, I suspect resides data containing the complete set of SFTP logins, and a conveniently configured set of "tools", per the nature of the FireFTP facility.

Using such meta as "size", and/or an attribute like "-mtime", I might easily extrapolate from the list, precisely that file, or three, which is most likely to contain what I want (i.e. rather than go through the unabridged list of quite many more items than what are shown here!)

Many thanks for your attention, and your time.
-JS

unSpawn 09-12-2012 11:46 AM

Quote:

Originally Posted by ajaxStardust (Post 4778019)
I realize 'FIND' is one of the most powerful tools accessible via Bourne Again Shell terminals (e.g. xterm, rxvt), therefore I realize the notion of "How to use FIND" is quite beyond the scope of such a thread.

You could create a SQLite database and fill it with find like
Code:

find /some/path -printf "insert into locatedb values(NULL, \"%T@\", \"%A@\", \"%C@\", \"%U\", \"%G\", \"%m\", \"%s\", \"%y\", \"%f\", \"%p\");\n"|sqlite3 /some/other/path/locatedb.sqlite
and then you can query MAC times by epoch, size, short name, path and such in an easy an efficient way.

ajaxStardust 09-12-2012 04:01 PM

Holy Structured-Query, Batman, it's SQLady, and her MAC minions!
 
Please, excuse my Spanish Mexican{*1}, but that’s baaad-ass! a great solution.

He or She? I beg your pardon: hereafter unSpawn, I have addressed as merely “he”. ‘Blame it on the English

First, I would just like to… say:
For my clumsy stumbling (i.e. -mtime;-atime;-ctime, he demonstrates much more easily expressed as MAC: exquisite!), he lends a stabling hand, yet without mentioning a word; as if to preserve the old-man’s pride. It's really well done. Oh, I suppose I should apologize for that, so much sidelong commentary, mine; so much analytical, fingering-up the photograph, as to smudge all this, once passed-on to the next; whosoever might be seated behind, or front of me, here in the classroom.

NOTE: Much textual /Cutting n pasting/; (colouring books{*6}): now 21:45 GMT: for the record, the above "problem", solved, and long since ADD'd into some kind of-- at best, smoky recollection of anything whence it mattered-- so much like a :‘POOF’: “where'd it go?”; “why was i even bothering with that stupid shit? Old FTP login data-- turned out to be so OLD i don't even have these clients anymore.”{*5}

Let us reckon now, as the Instructor has illustrated:
Quote:

Originally Posted by unSpawn (Post 4778669)
then you can query MAC times

In such few-- yet deliberately placed-- terms, he’s educated me; I have learned more than was my intention;
there is mastery in such effort, as exhibited by unSpawn. I suspect he is aware of the affect. Truly, butterfly effect, in motion. I wonder what it would /sound/ like{*3}

I believe, what you've shown me; what you've essentially done, is written an entirely modernized-- shall we say-- version, of locate itself! Damn. I was really blow-away, at first sight of that.

Man, it seems so cool; almost a rather-- how should i say-- immediate thought; like so much Samurai in reaction to catching an arrow and he didn't flinch [eh, some @adultswim thing, you had to be there]. :Grunt: It seems-- subcutaneously; simultaneously-- like /work/, but I can't argue the value would be so much more.

With much vigor; pressure, I pass the palm ’cross the widening-span of what we call the forehead, through the filthy mane, as if to gather thought, physically.

[b]While this is quite the veritable solution[b] (unSpawn’s), indeed for me, myself (one such as I, particularly, that is), the solution imposes a difficulty I'd rather have avoided: for as much as I am familiar with SQL-- a little dabbling outside of MySQL (i.e. PostgreSQL, MS SQL; mdb, whatever…)-- I'm afraid this will require (at least, heretofore) my long-term avoidance of much deeply digging into the SQLite; how to create, therefore manipulate it to good use. Is it really as simple as that sort of instantiation (i.e. precisely, as the code sample provided; thank you kindly, unSpawn )

I should, though.{*4}

With, I believe, nothing more to say, I ask: where do I go from here? Do I go with this; commence the learning of this SQLite invocation? Should I say, “Dig it, man, but that's not quite what I wanted!”. The truth is: it's not what I wanted. However, it is also precisely what i want. Hmmm…

(:chin-scratch:,:scratch-chin: [no relation to Lao Tsu])

I guess that's it, then? No-- no-- no. Yes. (D*mnit, my damn swiss-grey cheese-matter!)
What is it? (sorry-- i have to type, it i can't think)
Something about… AH-ha! something about-- yes!--- yes! forget that bullshit, i wrote above. haha... no, but serious, yes: I think, what I want (in addition to this solution, and rather than start another thread, I beg your pardon): how do i invoke the “MAC times” model, upon-- let's say-- well, hmm... i suppose I could get that via ‘stat’, but isn't there a less clumsy way?

I was thinking--
let's say I wanted to do this, one file-path at a time, or a smaller group. THat is to say-- assuming I've already acquired; the paths are NOT unbeknown to me-- how might I then invoke a simple comparison, at the command line, against these two (logically, two being boolean-easy, but perhaps three? i dunno...). F*** i think that's right therre in the goddamn FIND MAN pages, to be true. But, would you be so kind as to provide one more example, this day? And what of my nonsensical notions; misunderstanding of this BASH vs Coreutils, etc. issue? Have you any proctologist (would you believe it's not in the spelling correction dict, here? seamonkey?) hehe; Have you any-- RECOMMENDATION-- thaht's the word, a recommendation for my lame-ass (ironic; freudian slip?), that I might more expeditously come to solutions for; resolve these… speed-bumps… i might hit, whilst fumbling about the SHELL{*2}?

{pardon moi:
Pause: I'm here (:inhale:); back to Earth. I beg your pardon. It's the musician common-thread; bass.dll, dig it (Zeppelin); just woke-up; handful of repellants; pellets… washing-it-down: coffee; piss. :sigh: {*0}}


  1. Dig that Jimmy Page bit, right there… [approx 2012-09-12 20:35-20:40 GMT} / “Communication Breakdown: it's always the same; having a nervous breakdown [ohhhh....... suck’t!]” … “Little Robert Anthony wants to… come and play” : beginning the day; the afternoon, escorted by Led Zep, as i'd meant to do previous to passing-out at the keys, hours ago: a daily routine, quite unhealthy.
  2. {*1} for he can be so foul-natured! He's an Illegal, you know.
  3. {*2} (irony in the latter [pre ellipsis], let it remain a clandestine anomaly)
  4. {*3} crude if not private allusion to music; musicianship. off-topic, and likely illegal. my apologies: great difficulty, have i, to control such compulsions
  5. {*4} So many of my favourite programs nowadays use it. (i.e. if you're ever in Windows, I highly recommend the triumvirate of Softvoile [curious Russian bloke, Nikolay Tiushkov]: FlashPaste, FlashNote, and… uh… ClipDiary! Each employing .db, SQLite methinks. Each prove daily, indispensable, to my ramblings; there are no better code snippet management utils.
  6. {*5} How's that one… uh… Ramones tune go? ... something, "I don't want to grow-up". (well, i was thinking grow-old; and i've already gotten there anyway. perhaps i'll find a way: time travellin')
  7. {*6} Inside-joke. Talk of hanging posters in the recording studio (Are you still in there, cutting-and-pasting, with your colouring books?) Old habits: die hard.



P.S. Yes, already into Zep III: did you know you can hear the drum pedal squeaking, really prominant there, at the beginning of "Since I been Lovin' You". That is, if you have ears, and can hear, and-- doubtful, if you concede to the lesser quality mp3-- this; mine, FLAC-- you [i] can hear it.

P.P.S. Dudes; Dudettes -- i know. I suck, big stick. So, for that, and as I've lost track, i'm going to hit post. Please accept my sincere… adieu.

clifford227 09-12-2012 05:52 PM

Well, I didnt expect that.

unSpawn 09-12-2012 08:17 PM

Quote:

Originally Posted by ajaxStardust (Post 4778850)
where do I go from here?

If you create a database:
Code:

echo "create table locatedb (Id INTEGER PRIMARY KEY AUTOINCREMENT, T NUMERIC, A NUMERIC, C NUMERIC, U INTEGER, G INTEGER, m NUMERIC, s NUMERIC, y TEXT, Z TEXT, f TEXT, p TEXT UNIQUE);"|sqlite3 /some/other/path/locatedb.sqlite
then you can fill it with the command I showed you and query it.


Quote:

Originally Posted by ajaxStardust (Post 4778850)
let's say I wanted to do this, one file-path at a time, or a smaller group. THat is to say-- assuming I've already acquired; the paths are NOT unbeknown to me-- how might I then invoke a simple comparison, at the command line, against these two (logically, two being boolean-easy, but perhaps three? i dunno...). F***

Say you only want to list the full path to any "fireFTPsites.dat" files that have been modified between two days and an hour and a half ago:
Code:

echo "select p from locatedb where T between $(date +%s --date="2 days ago") and $(date +%s --date="90 minutes ago") f=fireFTPsites.dat;"| sqlite3

If we forget Cygwin for a moment and if all you want to catch is alterations then you could also check hashes:
Code:

sha1deep -r /some/path > /some/path.sha1
sha1deep -r /some/path -x /some/path.sha1

or use Inotify if you need it in real time:
Code:

inotifywait -m /some/path -e create -e modify --format "%w%f" 2>&-
# | xargs -iX stat 'X'



All times are GMT -5. The time now is 02:25 AM.