Linux: Enable colors in Man Pages

man is the system’s manual pager. Each page argument given to man is normally the name of a program, utility or function.

Edit your shell profile configuration file:

# if you use bash
vi ~/.bashrc

# if you use zsh
vi ~/.zshrc

Then add the following lines:

###################################
# Enable colors in man
#
# Color example values: 
# ---------------------
# 31 – red
# 32 – green
# 33 – yellow
# 
# Style example values:
# ---------------------
# 0 – reset/normal
# 1 – bold
# 4 – underlined
##################################
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'

and source the configuration:

# if you use bash
. ~/.bashrc

# if you use zsh
. ~/.zshrc

Check that the changes work properly: (example: man ping)