Tuesday, March 17, 2009

Tip: Add color to man pages with most on FreeBSD

man pages are formatted using FreeBSD less and more utilities which display text in blank and white colors. most on the other hand introduces the ability to view man pages formatted with colors.

most is a pager (like less and more) that displays, one windowful at a time, the contents of a file on a terminal. It pauses after each windowful and prints the following on the window status line: the screen, the file name, current line number, and the percentage of the file so far displayed.

Let's install most:
  • % su
  • # cd /usr/ports/sysutils/most
  • # make install clean
  • # rehash
  • # exit
Users of csh or tcsh shells can try most out by setting the PAGER environment variable like so:
  • % setenv PAGER most
Those that use the zsh shell can set the PAGER environment variable like this:
  • % export PAGER=most
If you like it editing you user shell configuration file and set the PAGER variable to most.

As most is a third party application I'd suggest that you don't use it as the default pager for the root account. I'm sure you don't want to find yourself in single user mode with only the root partition mounted and realize that your .cshrc defines most has the pager ;)

No comments: