LinuxKnowledge

This page documents helpful Linux info I've accumulated through the years. This is not a syntax reference, but rather a tool for gaining knowledge and understanding about the different syntactical options.

Command Line Favorites

find -xdev -iname "filename"

-xdev parameter limits the search to the current filesystem (won't traverse other mounts in the directory structure). -iname makes the search case insensitive. Quotes required only if spaces in the filename. Slower than locate. Slower than grep.

locate

locate "textstring"

to find files on the system that include the textstring. Maybe copy/paste the desired doc file or other file into your browser. locate uses a pre-compiled database, typically refreshed by cron once a week a nominal Mandriva installation. Compare to find -iname, above, which doesn't use a database and is therefore slower, and requires regex filenames rather than implying a more robust match. Experiment with the cron job that does the locate update. Touching updates access times, locate won't be able to find it. Running the cron job as root updates the locate database.

cd
touch newfile
locate newfile

then

su - root
/etc/cron.weekly/slocate.cron
exit
locate newfile

Or, just run the following command as root.

updatedb

man
Once reading the man pages, try /searchstring


Created by brian. Last Modification: Thursday 23 of February, 2006 21:40:15 CST by brian.