View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 4 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Lost?
PostPosted: Mon Apr 25, 2005 9:44 pm 
Offline
Joined: Tue Dec 07, 2004 12:04 pm
Posts: 369
For those of us who have a deep-seated fear of learning how to use the `find` command, there's a bit of a cheat. The below (when executed by the root user) will create a database of the file paths on your filesystem in the background.

Code:
updatedb&


When it is done, you can find things pretty quickly using the `locate` command followed by a substring of the filename you are looking for, e.g.:

Code:
locate ivtv1


or better yet:

Code:
locate ivtv1|less


I use it all the time when I can't seem to find my own ass-orted files. :)

Either add the updatedb& command to your startup scripts or enter it by hand on a regular basis.

-brendan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 26, 2005 6:17 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
I'd swear it's there already... Despite my rather cozy relationship with the find command, I also use locate all the time on my system...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 7:57 am 
Offline
Joined: Tue Apr 13, 2004 6:51 pm
Posts: 890
Location: Groton, MA
Im a big fan of find....expecially the -exec parameter

Code:
find / -name "*.xml" -exec grep someSetting {} /dev/null \;

_________________
R5F1 - Dell P4 2.4Ghz 500MB - PVR250 x 2 - GeForce FX 5200 - Onboard sound/NIC 80GB ATA/250GB ATA/400GB SATA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2005 7:35 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
You're almost always better off using the xargs command rather than exec unless there is something that you absolutely positively want to run once per file or are in the deepest darkest foulest bowels of quoting hell. For example the following is usually substantiallly faster than running one grep per file:
Code:
find -name "*.xml" -print0 | xargs -0  grep someSetting


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 92 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu