Human Readable  

 

     
   
     

A Slackware Desktop Enhancement Guide

Colorized Man Pages and Screen Output

Written by Darrell Anderson.

Few people enjoy being told to RTFM (Read The Fricking Manual). Especially when that “manual” is a man page. Man pages often contain a lot of information, usually cryptic, and usually pure gobbledygook to people who do not know exactly the information they seek. Reading man pages is tedious because they also are not formatted well and appear in traditional white text on a black screen. Yet there is a way to introduce a small spark of life into man pages to make them more readable on screen: Use the most pager utility.

In the appropriate bash startup script, add the following:

export PAGER="most"

You’ll need to log out and log in to see the changes. The next time you use the man command to read a man page, such as man mkfs, the man page will display in color, which for most people will significantly help reading the text.

If you dislike the default colors of most, copy the default most.rc file to /etc (in Slackware a sample default file is located at /usr/doc/most — 4.10.2/most.rc). Then in the appropriate bash startup script, export the environment variable MOST_INITFILE:

export MOST_INITFILE="/etc/most.rc"

Modify the new most.rc file as desired.

Speaking of text pagers, the stock Slackware less pager will cause less to maintain a history file in your user directory. Many people do not want that file created. To eliminate the file, add another environment variable:

export LESSHISTFILE="-"

The next time you log in you’ll no longer see that less history file being created when you use the less pager utility.

If you do not like modifying the stock /etc/profile, but still want the option available to all users, then add the command to /etc/bashrc. Of course, if you do not possess administrative rights to modify either /etc/profile or /etc/bashrc, then export these variables from within your user .bashrc or .bashprofile. Learn more about configuring the bash configuration startup scripts at Harmonizing the Bash Startup Scripts.

Lastly, add some readability to grep too. Export the following environment variables within the appropriate bash startup script:

GREP_OPTIONS='--color=auto'
GREP_COLOR='1;32'

When using colors with grep the default grep output color is red (ANSI number 1;31). The previous example uses the green color, usually very readable on most video screens.

One more tip about man pages if you are using KDE, or specifically, Konqueror. KDE comes packaged with a man protocol. In the Konqueror location bar, type man: followed by the man page you want to read, such as man:mkfs. Konqueror will display a nicely formatted and easy to read man page.

Finis.

Table of Contents