Learning about Commands, Part IV
- 0
- Add a Comment
- No Related Post
Learning about Commands, Part IV
I promised you a trick for filtering out section 3 entries from
apropos (or man -k, as many readers reminded
me) output. This trick involves two tricks: a pipe, and the grep tool. Pipes in Linux are
denoted by the | symbol, and are-as I’ve mentioned before-used to
send the output of one file as the input to another. So, I’d start
with something like:
apropos file |
The grep tool searches the
contents of files or, in this case, output. Everything in section
3 - even the items that are actually (3ssl) - starts with a (3, so
that’s what I want to search on. However, if I do the following:
apropos file | grep "(3"
then what I’ll actually end up with is only items from section 3.
Instead, I use grep's -v flag
to reverse the search:
apropos file | grep -v "(3"
Try both apropos file and the
command above and you’ll see how handy this is!
Now, on to another way to find out about the commands you have
available. Did you know that there’s a ton of documentation in
text and often HTML format right there on your system? Many people
don’t realize that there’s a “doc” directory in Linux. Various
distributions seem to put it different places, so you can try
looking in:
/usr/doc
/usr/local/doc
/usr/share/doc
If you can’t find it, you might need to consult your
distribution’s documentation.
One more tip before I leave you for the rest of the week, here …
I mentioned this in the very first Penguin Shell I did, but I
don’t want to leave it out here. There’s lots of documentation
available at The Linux
Documentation Project. Check it out!
Next week: Wrapping up with great online and print
references.
