Long standing man page display issue fixed

As I slowly started to upgrade my Linux systems between distros I found that my man pages started looking really bad. Basically, the magic color formatting codes were being escaped, so I would get pages like this:

ESC[1mNAMEESC[0m
ls - list directory contents

ESC[1mSYNOPSISESC[0m
ESC[1mls ESC[22m[ESC[4mOPTIONESC[24m]... [ESC[4mFILEESC[24m]...

This, it turns out, makes it very hard to read. 🙂 Once my laptop finally succumbed to this fate, I needed to figure out a fix. I had originally thought it might be something to do with locales, so I turned off UTF8, to no avail. Yesterday I finally got around to digging deeper and in /etc/man.config found the following:

# Useful paths - note that COL should not be defined when
# NROFF is defined as "groff -Tascii" or "groff -Tlatin1";
# not only is it superfluous, but it actually damages the output.
# For use with utf-8, NROFF should be "nroff -mandoc" without -T option.
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)
#
# If you have a new troff (version 1.18.1?) and its colored output
# causes problems, add the -c option to TROFF, NROFF, JNROFF.
#
TROFF           /usr/bin/groff -Tps -mandoc -c
NROFF           /usr/bin/nroff -Tutf8 -mandoc
JNROFF          /usr/bin/nroff -Tutf8 -mandocj

Changing the NROFF and JNROFF lines to have a -c on them means that my man pages look right again, and I get the following:

NAME        ls - list directory contents  SYNOPSIS        ls [OPTION]... [FILE]...

Hopefully this post will help someone else deal with the same problem in the future.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s