How To Get Color Man Pages In Linux

To Get Color Man Pages In Linux

Are you frequent visitor to man page (stands for manual pages) If you are, then you would have experienced its eye hurting default view. If you always wanted a solution for that problem, then here is something that would help you out. This tutorial will help you to read man page with colors. Man pages by default use less command as a pager. You can make use of the Most command for this process.

Using Most Command
MOST is a powerful paging program for Linux system that displays file contents on page wise. It display status line on the screen which includes file name, current line number, and the percentage of the file so far displayed.

Getting Color Man Page

Like the other procedures, you are required to update your system before you begin with the installation process.

root@linuxhelp:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease                                       
Hit:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease    
.
.
Fetched 306 kB in 3s (93.6 kB/s)   
Reading package lists... Done


Before changing this, you can take a look at your default man page view. Run the following command for the same purpose.

root@linuxhelp:~# man ps

Now, you shall install the MOST package by making use of the following command.

root@linuxhelp:~# apt-get install most
Reading package lists... Done
.
.
 bingwallpaper
Reading package lists... Done

And then, to export pager to /.bashrc file, you need to make use of the following command

root@linuxhelp:~# export PAGER=' most' 

Or you can also use the following command for the above scenario.

root@linuxhelp:~# export PAGER=" /usr/bin/most -s' 

You shall now check the man page of PS now.

root@linuxhelp:~# man ps

With this, the method to get color man pages on Linux comes to an end.

FAQ
Q
where is Man pages from custom location?
A
For one-off manpage reading, just point man at the specific file:

man ~/.local/share/man/manX/manpage.1.gz
Otherwise, if you want to always check ~/.local/share, then set the MANPATH environment variable for your user session (typically in your .bashrc file). To check what the current MANPATH is, do:

manpath
Q
Is there an index of all the man pages that exist?
A
Linux has thousands of different entires in the manual and knowing them all would be a headache(or an achievement, if you remember them all). Nonetheless, there are sites that have all the man entires on a Linux system.
Q
How best to read the man pages?
A
When reading man pages, a lot of extra characters are shown on screen. Which of the following commands can help.

grep
pg
more
row
col
Q
How to get color man pages under fish shell?
A
You can set the configuration by the following commands,

set -x LESS_TERMCAP_mb (printf "\033[01;31m")
set -x LESS_TERMCAP_md (printf "\033[01;31m")
set -x LESS_TERMCAP_me (printf "\033[0m")
set -x LESS_TERMCAP_se (printf "\033[0m")
set -x LESS_TERMCAP_so (printf "\033[01;44;33m")
set -x LESS_TERMCAP_ue (printf "\033[0m")
set -x LESS_TERMCAP_us (printf "\033[01;32m")
Q
What for "export PAGER="/usr/bin/most -s'" this is used?
A
It is used for adding enviornment variable