Search code examples
linuxshellterminalmanpageterminal-emulator

Change width of man command ouput


I use Guake terminal emulator a lot. It's the best thing since sliced bred IMO.

But one thing has been bugging me, when I want to read man pages the default width of the output is the width of the terminal windows, which in my case is always full screen so it's a bit difficult to read.

Is there a way I can make the default width of the output of man command a, pleasant to read, 80 characters?

The man page for man has this part:

   MANWIDTH
          If  $MANWIDTH  is set, its value is used as the line length for which manual pages should be formatted.  If it is not set,
          manual pages will be formatted with a line length appropriate to the current terminal (using an ioctl(2) if available, the
          value  of  $COLUMNS,  or  falling  back  to 80 characters if neither is available).  Cat pages will only be saved when the
          default formatting can be used, that is when the terminal line length is between 66 and 80 characters.

But I cant figure out where to change it.

I tried adding the line:

MANWIDTH 80

to /etc/manpath.config and ~/.bashrc, but with no result.


Solution

  • That's an environment variable.

    Try:

    MANWIDTH=80
    export MANWIDTH
    man bash
    

    If you want that set permanently then you can add those first two lines to your shell session startup scripts or similar.