Colored man pages

From Rosalab Wiki
Jump to: navigation, search

How to add colors to man pages? It is actually very easy. To display man pages, ROSA uses the less editor. So we should just configure it properly. In order to do this, find the .bashrc file in your home folder (note that the file is hidden - its name starts with a dot) and add the following lines there:

man() {
	env \
		LESS_TERMCAP_mb=$(printf "\e[1;31m") \
		LESS_TERMCAP_md=$(printf "\e[1;31m") \
		LESS_TERMCAP_me=$(printf "\e[0m") \
		LESS_TERMCAP_se=$(printf "\e[0m") \
		LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
		LESS_TERMCAP_ue=$(printf "\e[0m") \
		LESS_TERMCAP_us=$(printf "\e[1;32m") \
			man "$@"

Now restart terminal emulator (or open a new tab in it). Man pages will be colored from now on - for examples, let's take a look at man mkntfs output: