Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to "colorize" manpages output? I mean - the output of for example:

man command_name
share|improve this question
add comment

4 Answers 4

up vote 5 down vote accepted

I use the following shell function to view manpages in Vim, which provides nice syntax highlighing:

man() {
  /usr/bin/man $* | \
    col -b | \
    vim -R -c 'set ft=man nomod nolist' -
}
share|improve this answer
    
and finally I won't be pressing j by mistake all the time –  daithib8 Apr 18 '11 at 16:24
    
Well, j works fine in less as well :) –  Adam Byrtek Apr 18 '11 at 16:26
    
But you should change $* to "$@" to avoid potential problems with white space. Otherwise, thanks a bunch! –  Scott Severance Apr 21 '11 at 13:09
    
I suggest a little modification, to get more close to less style: substitute vim with /usr/share/vim/vim72/macros/less.sh. –  enzotib Apr 25 '11 at 9:07
add comment

aha. adding this to ~/.bashrc does the trick. It's not perfect though. but hey:

# Less Colors for Man Pages 
export LESS_TERMCAP_mb=$'\E[01;31m'       # begin blinking 
export LESS_TERMCAP_md=$'\E[01;38;5;74m'  # begin bold 
export LESS_TERMCAP_me=$'\E[0m'           # end mode 
export LESS_TERMCAP_se=$'\E[0m'           # end standout-mode 
export LESS_TERMCAP_so=$'\E[38;5;246m'    # begin standout-mode - info box 
export LESS_TERMCAP_ue=$'\E[0m'           # end underline 
export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
share|improve this answer
    
Why man pages in virtual terminal have a minimum of color (cyan for bold), and in graphic terminal are black and white? –  enzotib Apr 18 '11 at 7:01
add comment

add export PAGER=most to .bashrc

share|improve this answer
add comment

Does it have to be in the terminal?

Else you can use: System->Help->System Documentation and on the left of the window that comes up click "Manual Pages" (found this tip here)

Or you can use Konqueror, which shows the man pages like this: Man page in Konqueror

share|improve this answer
    
wow. didn't know one can do that. –  Stann May 24 '11 at 15:12
    
Does any other browser support this? –  udiboy1209 Apr 7 at 5:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.