Updated: 3 November 2026 · Applies to: Linux, tested with GNU man and less

To get colored man pages in Linux, tell the less pager (the default viewer behind man) which colors to use for bold and underlined text, with a few LESS_TERMCAP environment variables in your shell's startup file.

Why man pages show up in plain white by default

A man page is the built in documentation for a command: its syntax, options, examples and related commands. You view one with:

man df

man hands the formatted text to a pager, usually less, which does not apply any color on its own: bold and underlined text both render as plain text in the same color.

Add color with LESS_TERMCAP variables

Open your shell's startup file. For bash:

nano ~/.bashrc

Add these lines, then save the file:

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'

Reload the file, or open a new terminal, then try man df again:

source ~/.bashrc

Each variable controls one part of the display: md is the start of bold text, us the start of underlined text, so highlighted search matches, and the me/se/ue variables reset each of those back to normal. The numbers are standard ANSI escape codes: 1 is bold, 4 is underlined, and 31/32/33 are red, green and yellow.

Pick any ANSI color you prefer instead of these; 30 to 37 covers the eight standard foreground colors.

Alternative: the most pager

most is a pager with its own built in color support and the ability to scroll a page sideways, not just up and down. Install it:

apt install -y most

On AlmaLinux, Rocky Linux or RHEL, enable EPEL first:

dnf install -y epel-release
dnf install -y most

Then make it the default pager, again in ~/.bashrc:

export PAGER="most"

Reload the file the same way as above, and man will open through most from then on.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket