[NBLUG/talk] Finding files containing a string
Scott Doty
scott at sonic.net
Sun Dec 12 20:42:39 PST 2004
On Sun, Dec 12, 2004 at 12:52:43PM -0800, Todd Cary wrote:
> Scott -
>
> After looking up each of the individual commands in "Linux in a
> Nutshell", the command line makes sense. However, I get into my Linux
> server every few weeks or so which makes remembering the commands a
> challenge. Has anyone ever published a "Quick Reference"?
I suggest making a "live reference" by putting your often-used commands in
shell scripts, or even bash functions, and then referring to them when you
need to remember a command.
For instance, you could put them in /opt/todd/bin, then ls /opt/todd/bin
when you need to remember a command.
> O'Reilly's "Linux in a Nutshell" is great if one knows the command to
> begin with. It would be great to have one of those Quick Reference
> cards like the one for "vi"; the 100 most used commands in Linux!
>
> Example:
>
> ps -A | grep <process name>
>
> kill -9 <process ID>
>
> Just an idea!
For this, I would use "killall" (on Linux!) -- for instance, on Linux,
"killall -9 icecast" would kill all processes with the name "icecast" on the
system.
Warning: this does not work on Sun's! "killall" on Solaris kills all
processes except the shell invoking it -- a very dangerous command on a Sun.
Also, there's a couple of commands you might like to know:
"apropos" -- gives you commands who's descriptions match the string you give
it. For instance: "apropos directory" will have a listing for "pwd" -- you
can then type "man pwd" to learn more about the command.
A related command is "whatis" -- for instance:
# whatis apropos
apropos (1) - search the whatis database for strings
# whatis ls
ls (1) - list directory contents
I used to modify the makewhatis script to massage the whatis database so
that section (1) commands would appear first -- maybe I should do that up in
perl and submit it to the man(1) maintainers...
Good luck!
-Scott
More information about the talk
mailing list