Friday, June 20, 2025

Installing MOST to get colorful MAN pages

I had to read some MAN pages (manuals for terminal commands i.e. man ls would show you the help file for the ls command).  On my Ubuntu 24.04 machine the MAN pages are in black and white text with just some bold thrown in. I've seen some MAN Pages screen shots online that were in color, which made them easier to read.  After some investigation a lot of people were recommending the use of MOST app to read your MAN pages.  Lets give it a go, it's a two step process to set this up.  

First we install MOST:

1.  Open a terminal window and type the following:
     sudo apt-get install most

Step two; We need to add a couple of lines to make your OS use MOST and we need a line to tell MAN to let MOST handle the formatting of the output.

1.  In you HOME directory you will have a file called .bashrc (it will be hidden so be sure to have show hidden files checked)

2.  Make a backup copy of .bashrc, then open .bashrc with your favorite text editor.

3.  Once open, navigate to the bottom of the .bashrc file and add these three lines:
    # Write yourself a note here to explain what you are doing
     export GROFF_NO_SGR=1
     export PAGER="most"

    NOTE: replace the words after the "#" with a note to yourself explaining the changes you are adding

4.  After you make these changes, save your .bashrc file

5.  Open a terminal window and refresh your bash setting with the new .bashrc by typing the following in the terminal:
    source ~/.bashrc

That's it, we are done!  Lets test it.  In your terminal window type man ls and you should see something like this:


MOST is a type of software called a PAGER and is used by other command (i.e. man) to display information.  Everything I read said just installing MOST would make MAN show color output but it didn't for me.  After a some searching and read on the web I discovered that others had to add the line  "export GROFF_NO_SGR=1"  to their .bashrc to see color output from MAN.  You may not have too but I did.  Here is the research I did to figure that out in case you want a little deeper dive.


Compatibility: Some pagers, like less and most, expect man page input in the older backspace-based format and don't correctly interpret SGR sequences. Setting GROFF_NO_SGR=1 ensures compatibility with these pagers.

Disables SGR (Select Graphic Rendition) for groff output: SGR is a mechanism used by groff (the typesetting system often used to format man pages) to produce enhanced text formatting like bold and color.

Forces use of an older formatting scheme: When GROFF_NO_SGR is set (=1), grotty (the groff driver for typewriter-like devices) reverts to an older drawing method that uses backspace characters to achieve effects like bold and underline.

Disables colors: This setting also explicitly disables color output in the man pages generated by groff.