Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to explore man pages in bash using something similar to the python help('topics') function. Does this exist in bash?

I know the bash equivalent of python's help('modules') would look something like:

dpkg –get-selection
share|improve this question
3  
bash is only one man page –  sputnick Oct 9 '12 at 0:37
add comment

3 Answers

up vote 1 down vote accepted

help('topics') shows the table of contents of a shorter version of Python's reference manual. The closest thing would be a table of contents of the bash manual. This would not include external commands such as dpkg (which, from bash's point of view, is comparable to a third-party library for Python).

The help command shows a list of bash builtins and keywords. If you add the name of that builtin (e.g. help alias), you get the help for that builtin. That's pretty close to what Python offers.

For more complete documentation, like in Python, read the manual. You can read it in a web browser or with the info program (info bash). Info is an old hypertext browser, with a markup language that's a lot simpler than HTML. It is mostly used by GNU. If there is no Info manual for a command, the info program will show the man page instead. Emacs offers a nicer browser for Info documentation.

If you want external commands as well, you will need to reach for the manual of these commands. You can see the list of man pages for commands (a sort of equivalent of help('topics') for the command line over the whole operating system) with apropos -s 1 '' (1 is the section for user commands; '' means to search for the empty string, i.e. return everything). Note that on a typical system, this will return thousands, perhaps even tens of thousands of hits, so it isn't a practical way of exploring the commands. There's just too much stuff.

If you know roughly what you're about, use the apropos command with a keyword, e.g. apropos -s 1 module to see a list of commands whose short description includes “module” — it's quite a motley bunch. You can then call man to browse a specific man page.

share|improve this answer
add comment

Bash has a help function, but it can only tell you about the Bash built-in functions. Otherwise, you're really stuck with the man command itself, which does have some useful options.

Try the following

man -a intro

man -k *keyword*

man -K *keyword*
share|improve this answer
    
On Linux, there are also GNU info pages. –  jordanm Oct 9 '12 at 1:25
    
I am aware of these. The OP may also be; he explicitly asked for tools to explore manpages. –  itsbruce Oct 9 '12 at 1:26
1  
In emacs there is M-x woman which allows you to browse manpages via hyperlinks. –  jordanm Oct 9 '12 at 1:28
add comment

Since you mention dpkg, you're probably using debian (or ubuntu or some other debian derivative).

If so, you could explore man pages for particular packages using dlocate -lsman <pkgname> (or even dpkg -L <pkgname> | grep '/usr/share/man/.*gz' if you don't have dlocate installed) - this will list all man pages belonging to a package.

Mostly useful for targeted RTFM-ing on particular package(s), but not so much for serendipitous discovery.

(full disclosure: i'm the author of dlocate and maintainer of the package in debian, so i'm kind of biased towards using it).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.