One common workflow of mine is to open a manual page in a terminal, then another terminal in which to test things. The man page is formatted to the initial dimensions of the first terminal. When I now resize my windows (or have my WM do that for me automatically), there is either a gap to the right of the preformatted page, or lines wrap. At this point I usually q(uit) and !! (run again), which loses my position in the page.

I assume the formatting process is quite CPU intensive, or maybe it stems from ancient times of fixed terminal sizes. The less pager dynamically reacts to terminal resize events, so it should be possible in theory.

I tried perusing man pages, searching the Web, asking on IRC -- the whole lot -- but couldn't come up with anything.

  • Can I trigger reformatting from within or outside of the man utility?

  • Is there a version of the man utility that resizes the page dynamically?

  • Is there way to customize some part of the formatting/display process to make it update on SIGWINCH?

  • man actually uses less as the pager; you can hit h in a man page to get the less help screen. I'm not sure why it doesn't dynamically resize man pages Commented Apr 15, 2011 at 14:44
  • 3
    The problem appears to be that man renders the output to the width of the term. What you need is a pager that can bookmark where you are in the document, re-execute man (which it really has no idea about since it's piped to it) and return to the bookmark. Alternatively, a new man command that incorporates a pager.
    – nix
    Commented Apr 15, 2011 at 14:48

2 Answers 2


The basic problem is that the formatting is done by one program and the paging is done by another. Even if the formatter were to get a signal that the window size has changed and reformat the text for the new window size, all it can do is feed new text down the pipeline to the pager. There's no way for the pager to know with certainty what position in the new stream corresponds to the position in the old stream it was currently displaying.

What you need is for the pager to be able to do the reformatting. As @Robin Green said, that's HTML.

If you want to use HTML but still work in a terminal, you can tell man(1) to output in HTML and call a text-mode browser to display it.

man -Hlynx man

That will display the man(1) manpage in the lynx text-mode browser. Lynx does not directly respond to window size changes, but you can press ctrl-R and lynx will re-render the page for the new window size.

There are two other text-mode browsers that I know of: links and elinks. You could experiment with those and lynx and determine which give you the best experience for browsing man pages. You may want to use a custom configuration just for man pages and invoke a script that invokes the browser with that specific configuration.

You can put the man options you like into the MANOPT environment variable.

$ export MANOPT=-Hlynx
$ export MANOPT=-Hmanlynx # provide your own wrapper to execute
                          # lynx with a different configuration.

You will need to install the groff package for man to be able to generate HTML.

  • The limitation of the -H argument to man is that it doesn't use a webserver, but simply a small file. While this avoids any problems with misconfigured firewalls, it doesn't allow hyperlinks to other man pages to be generated (which at least some third-party man->html scripts support). Commented Apr 16, 2011 at 6:12
  • 2
    @Robin Green: The question is about supporting man pages in re-sizable terminal windows. In that context not using a webserver is not a limitation. And not having hyperlinks is not a limitation, since man pages displayed in less do not have hyperlinks.
    – camh
    Commented Apr 16, 2011 at 6:31
  • That's true, it's certainly a valid answer. Commented Apr 16, 2011 at 6:49
  • Could someone elaborate on -Hmanlynx? I can't find anything about it.
    – ratijas
    Commented Oct 10, 2020 at 9:51
  • Also, man -Hlynx man falls short on its first page: table (actually a list formatted thereof) of sections is replaced by "Image grohtml-5000141.png". I wonder, is there any workaround?
    – ratijas
    Commented Oct 10, 2020 at 9:53

Convert the man pages to html on the fly using a suitable script such as manserver, viewing them in a web browser (which can of course be a text-based web browser like lynx).

This is presumably why no-one has solved this problem - because the problem became irrelevant with the development of man->html scripts.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .