Colors in Man Pages

When I consider a man web page in my 'console' (not an xterm) I see some pigmentation, yet I do not get this in my xterm's (e.g. konsole) exists any kind of means I can enable this? with any luck a rather straightforward remedy?

2019-05-05 00:23:08
Source Share
Answers: 3

You can address this concern by utilizing a various pager, as an example most. man will in fact make use of the program defined in the PAGER setting variable. From the man (1) man web page :


If $MANPAGER or $PAGER is set ($MANPAGER is made use of in choice), its value is made use of as the name of the program made use of to present the hand-operated web page. By default, pager - s is made use of.

The value might be a straightforward command name or a command with debates, and also might make use of covering pricing estimate (backslashes, solitary quotes, or double quotes).

It might not make use of pipelines to connect numerous commands ; if you require that, make use of a wrapper manuscript, which might take the documents to present either as an argument or on typical input.

If most is mounted on your system, attempt this, prior to releasing man :

export PAGER=most
2019-05-08 19:16:38

Taken from

Excerpt :

$ mkdir ~/.terminfo/ && cd ~/.terminfo

Currently get the terminfo summary (conserve the adhering to as mostlike.txt) :

# Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm-pcolor
mostlike|manpages with color looking like most, 
    am, hs, km, mir, msgr, xenl, 
    cols#80, it#8, lines#24, wsl#40, 
    bel=^G, bold=\E[1m\E[31m, clear=\E[H\E[2J, cr=^M, 
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, 
    cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, 
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, 
    dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, 
    dsl=\E]0;\007, ed=\E[J, el=\E[K, enacs=\E)0, fsl=^G, 
    home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, 
    is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, kbs=^H, 
    kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, 
    kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, 
    kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, 
    kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, 
    kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, 
    kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, 
    kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, 
    kslt=\E[4~, rc=\E8, rev=\E[7m\E[34m, ri=\EM, rmacs=^O, 
    rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, 
    rmso=\E[m, rmul=\E[m, 
    rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>, sc=\E7, 
    sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, 
    smkx=\E[?1h\E=, smso=\E[1;30m\E[47m, smul=\E[32m, 
    tbc=\E[3g, tsl=\E]0;, u6=\E[%i%d;%dR, u7=\E[6n, 
    u8=\E[?1;2c, u9=\E[c, 

Currently compile it making use of tic (the terminfo entry-description compiler) :

$ tic mostlike.txt

(You might intend to delete the mostlike.txt documents after assembling.)

And afterwards simply specify a pen name in the *rc documents of your favored shell.

$ alias man="TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man"

If you intend to change the terminfo documents, usage infocmp mostlike to get the web content of it later on.

2019-05-08 04:59:07

You require to make use of the termcap(5) attribute. The man web page on some Unices claims this device is out-of-date and also to make use of terminfo, yet it's still readily available on others (and also terminfo is extra difficult).

Extra notably, less makes use of termcap.

Establishing colors for less

I do the adhering to to make sure that less and also man (which makes use of less) will certainly have shade :

$ cat ~/.LESS_TERMCAP 
export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green
export LESS_TERMCAP_md=$(tput bold; tput setaf 6) # cyan
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4) # yellow on blue
export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7) # white
export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
export GROFF_NO_SGR=1         # For Konsole and Gnome-terminal

And afterwards in my ~/.bashrc, I do this :

# Get color support for 'less'

# Use colors for less, man, etc.
[[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP

KEEP IN MIND : See Documentation on LESS_TERMCAP_* variables? for just how this functions.

The result

2019-05-08 04:50:52