[olug] Newbie Bash Scripting Tutorial

Christopher Cashell topher-olug at zyp.org
Thu Sep 17 14:14:35 UTC 2009


On Thu, Sep 17, 2009 at 12:59 AM, Rob Townley <rob.townley at gmail.com> wrote:
> I depended on google too much for information that i had totally
> forgot was built into *nix systems and wasted time, so a friendly
> reminder of all the reference material built-in at the command line.

[Snip.]

> We often forget the info built into the OS and accessible from the
> command line.  Tutorials are fine but when hacking at a problem, quick
> access to some essentials can be more useful.

This reminds me of another command that many newer people might not be
aware of: 'apropos' (also known as 'man -k').  apropos searches local
command documentation (man pages).  You can use regular expressions as
the argument to it, and it will search the name and descriptions for
man pages.

For example, maybe I've heard that there's a grep command for use with
compressed files, but I can't remember what it's called.  So, I'll
search for things related to grep:

topher at nexus:~$ apropos grep
ack-grep (1p)        - grep-like text finder
agrep (1)            - search a file for a string or regular expression, with...
bzegrep (1)          - search possibly bzip2 compressed files for a regular e...
bzfgrep (1)          - search possibly bzip2 compressed files for a regular e...
bzgrep (1)           - search possibly bzip2 compressed files for a regular e...
degrep (1)           - - grep through files belonging to an installed Debian ...
dfgrep (1)           - - grep through files belonging to an installed Debian ...
dgrep (1)            - - grep through files belonging to an installed Debian ...
dzgrep (1)           - - grep through files belonging to an installed Debian ...
egrep (1)            - print lines matching a pattern
fgrep (1)            - print lines matching a pattern
git-grep (1)         - Print lines matching a pattern
grep (1)             - print lines matching a pattern
grep-aptavail (1)    - grep Debian control files
grep-available (1)   - grep Debian control files
grep-dctrl (1)       - grep Debian control files
grep-debtags (1)     - grep Debian control files
grep-status (1)      - grep Debian control files
grepcidr (1)         - Filter IP addresses matching IPv4 CIDR/network specifi...
grepdiff (1)         - show files modified by a diff containing a regex
grepjar (1)          - search files in a jar file for a pattern
grepmail (1p)        - search mailboxes for mail matching a regular expression
Mail::Box::Search::Grep (3pm) - select messages within a mail box like grep does
Mail::Mbox::MessageParser::Grep (3pm) - A GNU grep-based mbox folder reader
mboxgrep (1)         - displays email messages matching a pattern
ngrep (8)            - network grep
numgrep (1)          - This program is the numeric equivilent of the grep uti...
pcregrep (1)         - a grep with Perl-compatible regular expressions.
pfunc (1p)           - grep for perl functions
pgrep (1)            - look up or signal processes based on name and other at...
POE::Filter::Grep (3pm) - select or remove items based on simple rules
rgrep (1)            - print lines matching a pattern
sgrep (1)            - search a file for a structured pattern
tre-agrep (1)        - print lines approximately matching a pattern
xml_grep (1p)        - grep XML files looking for specific elements
zegrep (1)           - search possibly compressed files for a regular expression
zfgrep (1)           - search possibly compressed files for a regular expression
zgrep (1)            - search possibly compressed files for a regular expression
zipgrep (1)          - search files in a ZIP archive for lines matching a pat...
zpcregrep (1)        - a grep with Perl-compatible regular expressions.

There I see zgrep, which is what I was looking for.

For more information, try 'man apropos'.  Many times you might suspect
there's a command out there to do what you want, but you aren't sure
what that command might be.  Using apropos with some related terms to
what you're trying to do could help find the command you need.

-- 
Christopher



More information about the OLUG mailing list