man pages in your browser

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
Habitual

man pages in your browser

Post by Habitual »

You can force your browser to open man pages with this simple trick:

Terminal >

Code: Select all

vi + ~/.bashrc
and add:

Code: Select all

export BROWSER=firefox
alias manb="man -H"
Save and exit vi using either ZZ or :wq!

Code: Select all

source ~/.bashrc
Now in terminal type

Code: Select all

manb date
and firefox will gladly open it.

Another GUI'ish method to get man pages "graphically" is to use
Alt+F2 > "yelp man:date"

Enjoy.
mads

Re: man pages in your browser

Post by mads »

Thanks. :D
Jesse654

Re: man pages in your browser

Post by Jesse654 »

I tried this and got an error:
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

I used gedit to modify my .bashrc, so I was wondering whether gedit or vi was playing a trick on me. :) As it turned out, I went into Synaptic Package Manager and found that I had groff-base installed but not groff (on my LM9-gnome system). groff's description includes, "This package contains additional devices and drivers for output to...HTML... " So I installed groff and voila, it works fine.

Thanks, Habitual, way to find a useful option!

Do you know of an analogous one for the info pages?

Check out http://linux.die.net/ too.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: man pages in your browser

Post by MALsPa »

Thanks, Habitual. I tried this in Ubuntu 10.04, but used "chromium-browser" instead of "firefox." At first I got the same error messages as Jesse654 got, so I installed groff, and it worked.

Could someone explain why it is necessary to run the following command:

Code: Select all

source ~/.bashrc
Jesse654

Re: man pages in your browser

Post by Jesse654 »

MALsPa wrote:Could someone explain why it is necessary to run the following command:

Code: Select all

source ~/.bashrc
The file .bashrc is being changed. The source command reloads .bashrc. If you logged out, then logged in again, .bashrc would be reloaded automatically.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: man pages in your browser

Post by MALsPa »

Jesse654 wrote:
MALsPa wrote:Could someone explain why it is necessary to run the following command:

Code: Select all

source ~/.bashrc
The file .bashrc is being changed. The source command reloads .bashrc. If you logged out, then logged in again, .bashrc would be reloaded automatically.
Thanks!

By the way, couldn't get this to work in PCLinuxOS:

Code: Select all

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

Re: man pages in your browser

Post by Habitual »

MALsPa wrote:...By the way, couldn't get this to work in PCLinuxOS:...
Can you shoot me output of

Code: Select all

echo $BROWSER && type -t manb
please.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: man pages in your browser

Post by MALsPa »

Code: Select all

$ echo $BROWSER && type -t manb
chromium-browser
alias
Habitual

Re: man pages in your browser

Post by Habitual »

MALsPa wrote:

Code: Select all

$ echo $BROWSER && type -t manb
chromium-browser
alias
Try "export BROWSER=firefox" just for grins and giggles?

then "manb date".

I'm curious.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: man pages in your browser

Post by MALsPa »

Code: Select all

steve[~]$ export BROWSER=firefox
steve[~]$ manb date
What manual page do you want?
steve[~]$
Jesse654

Re: man pages in your browser

Post by Jesse654 »

MALsPa wrote:By the way, couldn't get this to work in PCLinuxOS:

Code: Select all

steve[~]$ source ~/.bashrc
bash: TMOUT: readonly variable
steve[~]$ manb date
What manual page do you want?
While I'm not a bash expert by a long shot...
Does it work if you logout, then login again? Is BROWSER (or manb) already set in .bashrc (and made readonly)?
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: man pages in your browser

Post by MALsPa »

Jesse654 wrote:
MALsPa wrote:By the way, couldn't get this to work in PCLinuxOS:

Code: Select all

steve[~]$ source ~/.bashrc
bash: TMOUT: readonly variable
steve[~]$ manb date
What manual page do you want?
While I'm not a bash expert by a long shot...
Does it work if you logout, then login again? Is BROWSER (or manb) already set in .bashrc (and made readonly)?
Doesn't work after logging out and logging back in. BROWSER and manb were not set in .bashrc until I set them.

PCLOS is a kinda different animal sometimes, so this isn't a big deal -- don't spend a lot of time on it unless you really feel like it. I kinda researched the following output:

Code: Select all

steve[~]$ source ~/.bashrc
bash: TMOUT: readonly variable
Decided not to pursue this thing in PCLOS. But I'll try it in Fedora and see what happens.

Edit: Works fine in Fedora 16. And groff was already installed there.
Last edited by MALsPa on Mon Jan 23, 2012 4:08 pm, edited 1 time in total.
Habitual

Re: man pages in your browser

Post by Habitual »

/me is stumped.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: man pages in your browser

Post by MALsPa »

The thing is, I don't think I'll actually use this very often. Being able to view man pages in a browser is convenient at times -- I'd do so every now and then with Konqueror in KDE -- but sometimes it's just as convenient to export the man page to a text file.

Still, this is a nice hack to know about. Thanks for starting this thread!
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: man pages in your browser

Post by AlbertP »

You can also see many manpages on http://linux.die.net
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
Jesse654

Re: man pages in your browser

Post by Jesse654 »

AlbertP wrote:You can also see many manpages on http://linux.die.net
Getting a feeling of deja vu. :)
Jesse654 wrote:Do you know of an analogous one for the info pages?
I think I found an answer to my own question via Habitual's other tip:
Alt+F2, then "yelp info:date"
gives the info pages in a GUI format. I bookmarked the Top section. Funny about the links: Clicking doesn't activate them for me; I need to right click and choose "Open Link."
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: man pages in your browser

Post by AlbertP »

You're right Jesse. I think I have overlooked some posts while reading this topic.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
Habitual

Re: man pages in your browser

Post by Habitual »

Jesse654 wrote:
AlbertP wrote:... think I found an answer to my own question via Habitual's other tip:
Alt+F2, then "yelp info:date"...
But wait, there's more ...
Man pages by 'default' clear the screen after viewing. Sucky
When I was a noob, I thought this was a cruel 'feature'.

This is one of my personal favorite c-li 'hacks'...

Code: Select all

echo "export LESS='FiX'" >> ~/.bashrc
source ~/.bashrc
type man bash and scroll a page or 2 (or 20!) then Q for exit.

It stays on the screen.
AlbertP
Level 16
Level 16
Posts: 6701
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

Re: man pages in your browser

Post by AlbertP »

That's one quote too much, Habitual. You're quoting Jesse (who has indeed quoted me too in the same post).
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
Habitual

Re: man pages in your browser

Post by Habitual »

I resemble that remark.
Post Reply

Return to “Tutorials”