Man pages in windows

Viewing man pages in Windows and MinGW/MSYS

You can download here mandoc binaries built for Windows. These binaries would allow you to format and view man pages in Windows or MinGW/MSYS.

Manual pages, also called man pages, are a well supported, popular way to document software in Unix, BSD, and GNU/Linux operating systems. A text formatter program is required to process the intrinsic formats of man pages into other formats suitable for viewing. GNU/Linux systems typically use groff and some BSD systems, like OpenBSD for example, use mandoc suite of programs as a text formatter. To view man pages in Windows, however, you still need a formatting program. Hence we have decided to build for Windows the main programs of mandoc suite and put together the binaries for download with a short explanation on usage and building from sources.

The fastest way to start is to read the disclaimers at the end of this page as well as authors’ license file. If you agree to the terms and conditions stated in the disclaimers and the license file, you can download mdocml-1.13.1-win32-embedeo-02.zip file (

440KB); extract its contents; possibly, add its bin-directory to your PATH; run the mandoc program with the man page file that you wish to view and pipe the output to a pager program. The default pager in an ordinary Windows system is more . So a minimal usage example will look like:

In MinGW/MSYS less is a better pager:

Mandoc can also output nice looking HTML, optionally with a style sheet and links. Mandoc sources come with two sample style sheets example.style.css and style.css that are worth experimenting with. The first one is also copied during installation, so it could be found in the share/examples/mandoc/ of the binary package. HTML output can be specified, for example, like this:

Mutibyte encoded man pages, for example in UTF-8, need first recoding with the included preconv program. This example converts the French manual of gpasm, part of gputils:

We have built the above mentioned Windows binaries in MinGW/MSYS with modifications mdocml-1.13.1-embedeo-02.patch (

37KB) atop original mandoc source tarball 1.13.1 mdocml-1.13.1.tar.gz with some additional software from other authors.

The default MinGW installation lacks POSIX-compliant memory mapping like mmap() and related functions, so we have installed and linked against mman-win32, which is a MIT licensed, lightweight wrapper library and it is sufficient for the purpose. You can install the library libmman.a from its sources in mman.zip file (

The vasprintf() and wcwidth() functions are not available in a typical MinGW and Windows environments, and although their implementations (source files) are already included in our patch here are links to vasprintf.c for vasprintf() under modified BSD licence and wcwidth.c for wcwidth() under a permissive license. Both licenses and authors’ information are also included in their files and therefore also in our patch without any modification.

Our own work in mdocml-1.13.1-embedeo-02.patch is public domain and WE DISCLAIM ALL WARRANTIES WITH REGARD TO ANY SOFTWARE IN SOURCE OR BINARY FORM, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.

As we aimed at building only the main parts of mandoc suite, it will only work for base-build target. For example, in MinGW/MSYS the build commands could be:

We would like to thank all the authors and contributors of mandoc suite, mman-win32, vasprintf.c and wcwidth.c!

Читайте также:  How to install windows from flash drive

All trademarks and registered trademarks appearing on this page are the property of their respective owners.

Man pages in windows

Man pages for Windows commands

At the moment there are not available any man pages for windows applications.

But you can find here the batch file man.bat which can be used to display man pages available e.g. in packages MinGW or GnuWin32.

There is also available bash script man to be used under bash delivered e.g. by MinGW SYS bash or Git bash.

Batch file man.bat to be used in Command Prompt and PowerShell

Supported syntax for man.bat is:

man [-d] [section] page

man [-d] page[.section]

man [—debug] [section] page

man [—debug] page[.section]

To use man.bat you should configure environment variable MANPATH to semicolon separated list of paths containing man files. IF MANPATH is not defined the PATH is analyzed to find man pages delivered with following packages: MinGW, GnuWin32, and emacs.

Possible locations of man pages in Windows system: . \GnuWin32\man . \emacs-24.5\share\man . \MinGW\msys\1.0\share\man . \MinGW\share\man

man.bat requires following applications:

Application Available in
gzip GnuWin32 or MinGW
groff GnuWin32
sed GnuWin32 or MinGW
less GnuWin32 or MinGW

In my environment GnuWin32 version of less does not understand VT100 control sequences so I need to force MinGW to be earlier in PATH, befor GnuWin32.

MinGW implementation of less inerprets underline mode as a blue foreground.

What is the equivalent to —help or man page in Windows?

If I want to know what my options are for a Linux program then I’ll do man program or program —help to find out. How do you do that on Windows?

I was reading about how to run a screensaver from the command line and I found out about this file:

When called directly, the settings page for that screensaver is launched instead of the actual screensaver.

I tried help scrnsave.scr and scrnsave.scr /? and more, but nothing worked. It wasn’t until I tried google that I found the command line options in the middle of a MSDN article and knew I had to use:

How was I supposed to know about the /s option? What is the correct way to find program options in the Windows command line?

2 Answers 2

There isn’t a correct way. But there isn’t on Unix, either. The —help convention is in fact a GNU convention. It’s widespread on Linux distributions, where the operating system utilities are GNU ones. But you won’t see it in the operating system utilities on a BSD, for example:

Much as the —help convention has been seen by many as a good idea, and adopted; the /? convention (which originated in DR-DOS 5.0 as a /H convention) has been seen by many as a good idea, and adopted. You’ll find that many commands support it. But equally as not all commands in Unix or Linux support —help not all commands in DOS or Windows NT support /? .

You might think that man comes to the rescue here. Thanks to GNU info , and the fact that several program maintainers seem to place information (even sometimes information as basic as what the command-line options are) only in the info page and not in the man page or vice versa, it’s not the panacaea that it might be thought to be, however.

man doesn’t really have an equivalent in the DOS and Windows NT world. The closest equivalent was help command, which in DR-DOS 5.0 and later and MS-DOS 6.0 and later would look up command in a database of help pages and display the page. The problem here is that whilst all of the operating system’s own housekeeping utilities had pages in this database, almost no-one else’s programs did, and the system was hard to add third-party information to.

(DOSBook, introduced in DR-DOS 6.0 was about the best that any commercial DOS got with this. MS-DOS used QuickHelp files, the tool for compiling which wasn’t supplied with the base operating system. PC-DOS 7 had the IPF system, a tool for compiling which again was lacking from the operating system. OS/2 had the same IPF system as PC-DOS, and a HELP command that was integrated with it, although again the compiler, IPFC, was in the Developers Toolkit rather than in the box with the operating system. Many years ago I wrote an improvement upon the supplied HELP command where one could configure which command references it looked commands up in by default, with an environment variable. I also provided an extended command reference book for some commands that I’d written.)

Windows NT still has help command to this day. It’s a step backwards from what MS-DOS 6 had, let alone from what DR-DOS, PC-DOS, and OS/2 had.

So the actual answer is: You’re supposed to trawl through MSDN, or read someone else’s WWW site, or read a book, or read the source code (if it’s open source), or just know telepathically …

That said, documentation on the WWW is not a bad thing, and is largely the expectation nowadays. (Although one can miss things like IPFC building indexes and tables of contents for one. ☺) Microsoft documents a whole raft of command-line commands on TechNet and in MSDN, as you have seen.

On Viewing `man` Pages

When you frequently use Terminal, you will use man pages. They contain tons of useful information on most of the tools and commands you use on the shell.

However, the man command’s user interface was designed for terminal output decades ago and does not really integrate well with the modern macOS UI. When you run the man command the output will take over your current Terminal window and scrolling through long man pages can be tedious.

However, on macOS you do not have to man like it’s 1989.

First solution is to use

instead of man . This will open the man page in a new yellow Terminal window, so you can still see what you are actually doing, while reading the man page. If the yellow is just too annoying for you, you can change the look of the window by changing the ‘Man Page’ window profile in the Terminal Preferences. Since this window shows the entire man page, you can scroll and even use ‘Find’ (Command-F) in this window.

Since typing this open command is a bit awkward, you can add a function to your bash profile or bashrc file:

Note: You could use xman here. However, that will conflict with another command when you have X11/XQuartz installed.

You can also put ‘x-man-page:’ URLs in other applications, such as emails or chat applications. However, not all applications will recognize URLs starting with x-man-page : as URLs, so your results may be mixed. It does work in Slack, even though Slack is skeptic of the links:

Taken from Context

In Terminal, you can open a man page from the context menu. Simply do a secondary (ctrl/right/two-finger) click on a word in a Terminal window and choose ‘Open man Page’ from the context menu. This will open the man page in a separate window, like opening x-man-page URLs.

man Page with a (Pre)view

Back in the early days of computing you could (or had to) convert man pages into postscript output, so they would look nicer when printing. These options are still present and we can (ab)use them to show a man page in Preview. (Please don’t waste paper printing man pages.) The command for this is:

The -t options pipes the man page into another tool ( groff ) to reformat it into pdf which we then pipe into open and send to the Preview application. (More on the open command.) If you use this more frequently, you want to create a function for this in your bash profile or .bashrc :

Text Editors

You can also send a man page to a tex editor. Before you pipe the output into a text editor, you have to clean it up a bit:

This will open in TextEdit. If your favored text editor can receive data from stdin, then replace the open -f with its command. For BBEdit, this will work great:

And again, if want to use this method frequently, create a bash function for it.

ManOpen

The ManOpen application has been around for a long, long time, but amazingly, it still works on macOS Sierra. It will also display man pages in a separate window. The main advantage MacOpen has over the other solutions here is that it will automatically detect other commands and highlight them as hyperlinks to their man pages. There is also a command line tool, confusingly called openman to open the app directly from the Terminal.

Automation

You can also create an Automator Service for this. Then you can open man pages from (nearly) any application with a keystroke or from the context menu. I described this in an older post on man pages.

How to parse man pages in Windows?

Here is a raw man page. Is there a way I can parse it under Windows to make it more readable?

2 Answers 2

I am affiliated with the webpage that JakeGould have posted in his answer. I have ported the essence of mandoc suite to Windows (MinGW/MSYS) and I have created that page. My thanks to the authors and contributors of mandoc suite and MinGW/MSYS! So you have 3 options:

UPDATE: With this option, you only need Windows and the pre-built binaries of mandoc (mdocml), available on my webpage. You do NOT need to have MinGW, or MSYS, or cygwin runtime installed! Go to my page Viewing man pages in Windows or MinGW/MSYS, please read the disclaimer, download the zip-file with pre-built binaries, for example mdocml-1.13.1-win32-embedeo-02.zip, extract locally and then run either of the following commands on Windows command line (cmd.exe) with your man-page as an argument:

or, my preferred way, convert to an html page:

Besides, it is a good idea to be aware of mandoc, if you ever come across the idea of writing your own man-pages. In my view, mandoc suite is superior to a roff-only tool set and a better «common denominator» from author’s perspective.

However if your man-page is overly «traditional» roff, or if you are not happy with mandoc’s formatting, you might want to format/view your man-page with GNU troff (groff). For example, you can get groff pre-built binaries for Windows from ezwinports.

You can search for an online html variant of your man-page. However I would not recommend this option, because there is always risk that the online document might cover different version of the software than the version that you have locally.

Читайте также:  Windows media player как добавить звуковую дорожку
Оцените статью