Sunday, January 22, 2012

man pages in your browser

This worked for me in Ubuntu 10.04 and Debian Squeeze. Don't know yet if it will work in other distros. A "thank you" for this tip to Linux Mint forum member "Habitual."

For this to work, you will need to have groff installed. In Ubuntu 10.04, installing groff brought in these packages:

groff (1.20.1-7)
libnetpbm10 (2:10.0-12.1ubuntu1)
netpbm (2:10.0-12.1ubuntu1)
psutils (1.17-27)

In Squeeze, it brought in these:

groff (1.20.1-10)
psutils (1.17-27)

Next, add the following to ~/.bashrc:

export BROWSER=chromium-browser
alias manb="man -H"

If you don't use Chromium, replace "chromium-browser" with "firefox" or "google-chrome" or whatever.

Then ran the following command:

source ~/.bashrc

(As Mint forum member "Jesse654" explains: "The file .bashrc is being changed. The source command reloads .bashrc. If you logged out, then logged in again, .bashrc would be reloaded automatically.")

Then, the following command will open "man page" in your browser:

$  manb [man page]

For example:

$  manb date

When I tried this without having groff installed, I got something like this:

$  manb date
man: command exited with status 3: /usr/bin/zsoelim | /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE | preconv -e UTF-8 | tbl | groff -mandoc -Thtml

So, you need groff.

I couldn't get this to work in PCLinuxOS. Here's what I saw:

$ source ~/.bashrc
bash: TMOUT: readonly variable
$ manb date
What manual page do you want?

No comments: