Table of Contents
This tip is about the how to View Colored Man Pages in Linux. So read this free guide, How to View Colored Man Pages in Linux step by step. If you have query related to same article you may contact us.
How to View Colored Man Pages in Linux – Guide
A man page (full man page) is documentation for a terminal-based program, tool, or utility on Unix-like operating systems (commonly known as a command). It includes information such as command name, syntax, description, possible options, author, copyright, and related commands.
How to Display Colored Man Pages in Linux
You can read the man page for a Linux command as follows; this will display the man page for the df command:
$ man df
By default, the man program normally uses a terminal pager program like more or less to format its output, and the default view is normally white for all types of text (bold, underline, etc.).
You can make some tweaks to your ~/.bashrc file to get really colorful man pages by specifying a color scheme using various LESS_TERMCAP variables.
$ saw ~/.bashrc
Add the following color scheme variables.
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=$’ and[01;33m’ export LESS_TERMCAP_ue=$’e[0m’ export LESS_TERMCAP_us=$’e[1;4;31m’
The following are the color codes we used in the configuration above.
And here are the meanings of the escape codes used in the above configuration.
You can also reset your terminal by typing reset or even start up another shell. Now when you try to view a man page df command it should look like this, better than the default view.
Alternatively, you can use the paging program MOST, which works on Unix-like operating systems and supports multiple windows and can scroll left and right.
$ sudo apt install most #Debian/Ubuntu # yum install most #RHEL/CentOS # dnf install most #Fedora 22+
Then add the line below in your ~/.bashrc file, then provide the file as before and possibly reset your terminal.
export PAGER=”more”
Final note
I hope you like the guide How to View Colored Man Pages in Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.