Unix / Linux: Display Color Man Pages

by on April 9, 2012 · 8 comments· LAST UPDATED April 9, 2012

in ,

How do I add a bit of color to my man pages under Linux / FreeBSD / Apple OS X / Unix like operating systems?

You can install a page called most. It is a paging program that displays, one windowful at a time, the contents of a file on a terminal.

It pauses after each windowful and prints on the window status line the screen the file name, current line number, and the percentage of the file so far displayed.

How Do I Install most Under FreeBSD?

To install the port, enter:
# cd /usr/ports/sysutils/most/
# make install clean

Alternatively, you can add the binary package called most using the the following command:
# pkg_add -r most

How Do I Install most Under Debian / Ubuntu Linux?

Type the following command:
# apt-get install most

How Do I Install most Under Fedora / RHEL / SL / CentOS Linux?

Make sure RPMForge repo is configured. Type the following command to install the same:
# yum install most

How Do I Use most Command?

Type the following command to set PAGER bash shell variable, enter:

 
export PAGER="most"
 

OR

 
export PAGER="/usr/bin/most -s"
 

I recommend that you modify and setup environment variable called PAGER in ~/.bashrc file.

A Note About CSH / TCSH Shell Users

CSH / tcsh shell users, type the following command:

 
setenv PAGER /usr/local/bin/most
 

Try viewing man for any command. To view the man page of Linux date command, enter:
$ man date
Sample outputs:

Unix / Linux: View Colour Man Pages

Fig.: Unix / Linux: Color man pages with most command

most Command Summary

Quitting:
  Q                      Quit MOST.
  :N,:n                  Quit this file and view next.
                            (Use UP/DOWN arrow keys to select next file.)
Movement:
  SPACE, D              *Scroll down one Screen.
  U, DELETE             *Scroll Up one screen.
  RETURN, DOWN          *Move Down one line.
  UP                    *Move Up one line.
  T                      Goto Top of File.
  B                      Goto Bottom of file.
  > , TAB                Scroll Window right
  <                      Scroll Window left
  RIGHT                  Scroll Window left by 1 column
  LEFT                   Scroll Window right by 1 column
  J, G                   Goto line.
  %                      Goto percent.
Window Commands:
  Ctrl-X 2, Ctrl-W 2     Split window.
  Ctrl-X 1, Ctrl-W 1     Make only one window.
  O, Ctrl-X O            Move to other window.
  Ctrl-X 0               Delete Window.
Searching:
  S, f, /               *Search forward
  ?                     *Search Backward
  N                     *Find next in current search direction.
Miscellaneous:
  W                      Toggle width between 80 and 132 char mode.
  Ctrl-X Ctrl-F          Read a file from disk
  R, Ctrl-R              Redraw Screen.
  F                      Simulate tail -f mode
  :o                     Toggle options:  b-binary, w-wrap, t-tab
  E                      Edit file.  Uses MOST_EDITOR and EDITOR
                           environment variables.
*Note:  This command may be repeated `n' times By entering a number then
        the command key, e.g.,  '5 SPACE' moves 5 screens forward.

External links

  • Download most paging program for Unix, VMS, MSDOS, and win32 systems.


If you would like to be kept up to date with our posts, you can follow us on Twitter, Facebook, Google+, or even by subscribing to our RSS Feed.


This entry is 1 of 2 in the Linux / UNIX Colorful Man Pages Tutorial series. Keep reading the rest of the series:
  1. Unix / Linux: Display Color Man Pages
  2. Linux / Unix: Colored Man Pages With less Command

{ 8 comments… read them below or add one }

1 Bill Carroll April 9, 2012 at 2:33 pm

On Mac OSX there are some interesting options. I use zsh as my shell and I use homebrew instead of macports for installing stuff like “most”.

If you have homebrew you can open terminal and:
“brew install most”

Then with “most” installed you can pipe man to most:
“man date | most”

I also found out today you can pipe man to preview:
“man -t most | open -f -a /Applications/Preview.app”

This creates a PDF, although it’s not colored.

Reply

2 Vivek Gite April 9, 2012 at 3:08 pm

Thanks for the sharing OS X specific info.

Reply

3 Stefan Lasiewski April 10, 2012 at 12:59 am

I use Termcap to add color to manpages.

1. Add the following to ~/.LESS_TERMCAP

export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green
export LESS_TERMCAP_md=$(tput bold; tput setaf 6) # cyan
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4) # yellow on blue
export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7) # white
export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)

2. Source this file from .bashrc :

        # Use colors for less, man, etc.
        [[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP

More details at http://unix.stackexchange.com/a/147/4

Reply

4 Vivek Gite April 11, 2012 at 6:17 am

Great info. I appreciate your comment.

Reply

5 angelblade April 10, 2012 at 11:07 pm

Archlinux has same package , vía pacman

Reply

6 tangram April 11, 2012 at 9:29 am

I like most however I’m too used to use J and K to scroll in less.
If there was a way to bind J and K to scroll up/down I’d be sold.

Reply

7 Andy Paton April 12, 2012 at 8:43 am

On CENTOS/RED HAT you can change the pager for MAN pages only from “less” to “most”.

Edit the setting for PAGER setting in /etc/man.config
PAGER /usr/bin/less -is
to
PAGER /usr/bin/most -s

Reply

8 Matt Doar July 18, 2012 at 8:34 pm

Built fine from source on OSX. First download slang from the same site.
./configure, make, sudo make install
I couldn’t get most to build with an uninstalled version of slang
Then the same thing for most

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , , ,

Previous Faq:

Next Faq: