Complete.Org: Mailing Lists: Archives: discussion: September 2000:
[aclug-L] Re: Unix/Linux question

[aclug-L] Re: Unix/Linux question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: discussion@xxxxxxxxx
Subject: [aclug-L] Re: Unix/Linux question
From: Tom Hull <thull@xxxxxxxxxxx>
Date: Fri, 15 Sep 2000 12:57:00 -0500
Reply-to: discussion@xxxxxxxxx

Carl D Cravens wrote:
> On Fri, 15 Sep 2000, Maverick Ieong wrote:
> >     How can I show ALL the unix commands on one line
> > with briefly description?

The program /usr/sbin/makewhatis creates a whatis file in each directory
in your MANPATH. Each whatis file has a one-line summary extracted from
each man page in that directory, so you could do something like:

  for i in $(man --path | tr ':' ' ')
    if [ -f $i/whatis ]; then
        cat $i/whatis
  done | sort

You can then save that in a file, grep it, awk it, etc. That is basically
what the programs whatis, apropos, and man -k do (with varying degrees of
success and/or aggravation). /usr/bin/whatis is a shell script, so you can
take a look at it for pointers.

Note that there is some garbage in the whatis files; also that this only
knows about man pages, which doesn't help if you don't have man pages,
e.g. if nobody wrote a man page, and/or if the man page isn't useful
(which is all too often the case).

The programs themselves also strike me as pretty buggy. E.g., if I do:

  PAGER= whatis keyword

whatis sets PAGER to less (the default if PAGER is undefined). Also, the
absence of a keyword gives you nothing instead of everything; looking at
the code suggests maybe:

  PAGER=cat whatis '.*'

but sloppy shell scripting gets $1 re-evaluated. Yecch!

/usr/bin/apropos is also a shell script, written by the same guy.

> Bash tells me that there are 1110 executables in my path.  You don't want
> that, I think.
> But something that'll come close to what you want is this...
> cd /usr/bin; man -k *

I get a lot of errors doing this, probably for reasons noted above.

> That's the majority of the user programs on your system... and over 600 on
> mine, so it takes awhile.  But there are other binary directories that may
> or may not be in your path, so you won't get everything that way.
> --
> Carl D Cravens (raven@xxxxxxxxxxx)
> I'm not lost, I'm "locationally challenged".

 *  Tom Hull * thull@xxxxxxxxxxx *

-- This is the discussion@xxxxxxxxx list.  To unsubscribe,

[Prev in Thread] Current Thread [Next in Thread]