10

Is there a Linux graphics program that displays man commands in a browser?

I need a program that allows me to display all man commands in a browser, or in some graphics program, so that they can be up all the time, rather than having to view them through terminal windows.

4
  • 1
    i assume that sites that already publish man pages are not acceptable? For example explainshell.com – Mike B Apr 9 '15 at 4:12
  • @MikeB I need something on my own computer rather than online – vfclists Apr 9 '15 at 4:22
  • 3
    I don't understand, why don't you just keep a terminal window open? What's the difference? – terdon Apr 9 '15 at 10:34
  • @terdon, some man pages are extremely long (bash!), and navigation in the terminal is suboptimal. Of course that implies that the HTML version should contain a ToC. – A. Donda Jan 18 at 1:46

12 Answers 12

6

There is xman, a graphical utility for displaying manpages.

I don't know anyone who has ever used it though. It was old an archaic already 20 years ago. For your stated use case of having manual pages displayed all the time, you'd probably be better off just opening a new terminal window and typing man something than by using xman.

2
  • Or the desktop environment's help browser, like yelp, which can also handle info pages. – muru Apr 9 '15 at 11:40
  • @Celada How to use this? xman malloc doesn't work. – alhelal Jan 5 '18 at 2:42
18

Yelp is the help viewer in GNOME.

yelp man:cgraph

libcgraph(3) man page

12

On a GNU system, the program you're looking for is man.

BROWSER=firefox man --html man

Try that command (or substitute some other valid value for BROWSER=, such as, for example, cat with a redirect if you wish to save the result) and see what you get.

If you want it to be the default configuration, you'll find instructions for configuring man to your specifications in the browser window that appears.

4
  • 2
    It returned man: command exited with status 3: /usr/lib/man-db/zsoelim | /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE | preconv -e UTF-8 | tbl | groff -mandoc -Thtml – Anwar Jan 26 '18 at 14:19
  • 1
    or better: man --html=firefox man – user86041 Nov 2 '18 at 13:05
  • Here's a bug report for that error @Anwar (it's a problem with apparmor permissions). – Dario Seidl Sep 15 '19 at 17:35
  • This is not working for me, because the browser would need to read the html from stdin. There is posible to use the helper script bcat from ruby-bcat package e.g.: BROWSER=bcat man --html man. See more Rendering HTML from pipe – Martin Vyskočil Jun 16 '20 at 17:02
3

I have no idea why you would want to do this, it seems far simpler to just keep a terminal window open, but you can create HTML versions of all your manuals like this (assuming the names of the directories where your manuals are stored contain no whitespace):

  1. Install man2html

    sudo apt-get install man2html
    
  2. Create the directory where you will keep the HTML files

    mkdir ~/htmlman
    
  3. Find all man pages in your system and convert them to HTML:

    find $(manpath | tr : ' ') -name '*.gz' | 
        while read f; do 
            man2html "$f" > ~/htmlman/"$(basename "$f" .gz)".html; 
        done 
    
  4. Generate an index file

    cd ~/htmlman
    printf "<html><head></head><body>\n" > index.html
    for i in *html; do 
        printf '<a href="%s">%s</a><br>\n' "$i" $(basename "$i" .html) >> index.html
    done
    printf '</body></html>' >> index.html
    

You can then point your browser to file:///home/vfclists/htmlman/index.html and you'll have a list of all your man pages in HTML format.

Notes

  • This is a quick and ugly hack. There will be some error messages printed.
  • This will include man pages in all languages you have installed on your system. You might want to limit it to specific target directories. Change step 3 to:

    find /usr/share/man/man{1..9} -name '*.gz' | 
        while read f; do 
            man2html "$f" > ~/foo/"$(basename "$f" .gz)".html; 
        done 
    
3
  • 3
    I prefer a GUI oriented way of working, and I want to have the man pages in browser tabs with the relevant sections in view so I don't have to keep switching to the terminal and scrolling back and forth to view them. I have started developing a small graphics program for that as it is something I want to embed in other programs. Have you ever tried Smalltalk? – vfclists Apr 9 '15 at 12:14
  • @vfclists ah, yes, tabs make sense. Of course, you could just use a terminal that supports tabs and have the same thing. I just don't understand what else you need, the terminal is a GUI program after all. Anyway, to each their own :) and no, I haven't used Smalltalk. – terdon Apr 9 '15 at 13:17
  • Your answer gets me closest to what I want as it helps me generate the help files in bulk, but celada's answer is the technically right answer to the question :( . When I finish what I have planned I will let you have a look at it. – vfclists Apr 9 '15 at 18:22
2

You can use man2html(this is how the package is usually called), an example.

man 1 man | man2html > man.html

And then use firefox, elinks or whatever browser you want to view it.

There are also some services that keep manpages such as http://manpages.ubuntu.com/

1
  • I have tried this option, but it requires going back to the command line to generate a new html file if the relevant html file has not been created. I need something that presents me with a list of commands, and can generate and add a new command to the list if it doesn't already exist. – vfclists Apr 9 '15 at 3:53
2

On Debian systems, there is a package named dwww which provides a simple web GUI for man pages, GNU info pages, any files in /usr/share/doc hierarchy and any other installed Debian document packages. It requires Apache or any other CGI-capable web server installed and running locally, and the appropriate command-line document format converters like info2www.

Other Debian-related distributions, like the Ubuntu family, might have it too.

By default, the URL http://localhost/dwww is available for localhost only, but in a trusted network you can allow other hosts to access it too.

If you just want quick access to man pages, bookmark http://localhost/dwww/man/

2

As a rather complimentary answer to the one above given about Yelp, on Debian systems, at least for GNOME desktop environment version 3.22, you may type directly what you ask for Man or Info help inside the address bar of the Mozilla Firefox browser or the GNOME Epiphany browser so that the Yelp with the asked Man or Info help page is open in Yelp's window (not the browser's). E.g.:

man:chmod.2

man page about 'chmod' from the section **2**, launched from **Firefox**

The 1st example shows the man page about 'chmod' from the section 2, not from the default section 1 (which can be shown by typing man:chmod or man:chmod.1), launched from Firefox.

info:coreutils

info page about 'GNU Coreutils', launched from **Epiphany**

The 2nd example shows the info page about 'GNU Coreutils', launched from Epiphany.

Note: The answer was inspired by the web page about the graphical help from Linuxtopia. According to this page, the (KDE) Konqueror browser may provide what the OP asked if using Linux systems providing KDE software set, but I have not tried it. Also this page informs that the (GNOME) Nautilus provides a searchable index of the Man and Info pages, but I tried the recent version of this application, which does not have any feature regarding the help pages, so it seems an outdated information for any more recent GNOME applications.

2

If you are using KDE, you can use KHelpCenter Application to show UNIX manual pages.

Man pages are in UNIX manual pages or by running khelpcenter man:.

https://userbase.kde.org/KHelpCenter || khelpcenter

1

Just for the record.... I'm using this trick that works for man pages well:

man bash |yad --text-info #or |zenity --text-info

(requires yad or zenity, usually exists in your linux distro).

In this way you have GUI interface without the need of any external tool other than yad/zenity which usually exist in your system.
You can scroll with mouse, and most important for me using gtk3.0 version of yad (default today) i can scroll even with my touchscreen.

PS: You need to maximize the yad / zenity window to see all the contents correctly.

As a more permanent solution, i created a tiny script called mang (no extension) under /usr/bin and as soon as i chmod +x mang i was able to call mang (instead of man) from anywhere as simple as `mang cat' .

For those guys who like to play, this is the content of mang script:

#!/bin/bash
# place this file under /usr/bin , and chmod +x this file in order to be able to call it 
if [[ -z $1 ]];then
echo "You need to provide a manual"
else
man $1 |yad --text-info --height=500 --width=800 --center --title="Man Pages of $1" --wrap --show-uri &
fi
exit

Tips : --show-uri makes the links inside man pages clickable . Operator & sends the yad window to background , mang is terminated and terminal is free.

1

I use w3mman in an extra xterm or horizontally split screen so one program fits the terminal and the windowed scenario.

$ alias man
alias man=w3mman'

w3m's converter from manpage format to HTML (/usr/lib/w3m/cgi-bin/w3mman2html.cgi) can be used as CGI with a HTTPD too:

w3mman's cgi in action

(I disabled w3mman on that server again, it only was activated for making the screenshot.)

1

I'm currently developing a lightweight GTK frontend for man2html using Vala. Wish it could help in the future.

https://github.com/akarin123/manhelper

New contributor
Akarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

Just an alternative. Run explainshell locally; it's available at this Github repo: explainshell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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