Adapt bash & environments
adapt the pager
( pager tools are less , more and
f.i. : less < man modutil
maar man output is not colorized , difficult to read
=>
1/ most is a syntax aware pager
install : sudo apt-get install most
set most as the Default Pager, changing the PAGER environment variable : export PAGER=“most”
this is only valid during 1 terminal setting
to have most permantly the default ; adapt .bashrc
usage :
man gaat default een pager aanroepen , cat niet
cat .bashrc | most
man modutilt
2/ adapt termcap settings
( termcap : old shool unix V library , stiil valid in linux , see wiki)
xed .bashrc
add a shell function “man” at the bottom of your “.bashrc” file.
man() {
LESS_TERMCAP_md=$’\e[01;31m’ \
LESS_TERMCAP_me=$’\e[0m’ \
LESS_TERMCAP_us=$’\e[01;32m’ \
LESS_TERMCAP_ue=$’\e[0m’ \
LESS_TERMCAP_so=$’\e[45;93m’ \
LESS_TERMCAP_se=$’\e[0m’ \
command man “$@”
}
temcap uitleg
These were once used to specify how computer terminals of different makes and models should interpret display commands. Software packages also had their own termcap settings, and less does, too.
the definitions of the less termcap settings:
- LESS_TERMCAP_md: Start bold effect (double-bright).
- LESS_TERMCAP_me: Stop bold effect.
- LESS_TERMCAP_us: Start underline effect.
- LESS_TERMCAP_ue: Stop underline effect.
- LESS_TERMCAP_so: Start stand-out effect (similar to reverse text).
- LESS_TERMCAP_se: Stop stand-out effect (similar to reverse text).
Again, we’ll set these to control color combinations using the American National Standard Institute (ANSI) color codes.
The format of the color code is easy to read once you understand it:
- The “\e” at the beginning identifies the sequence as a control code or escape sequence.
- The “m” at the end of the sequence command indicates the end of the command. It also causes the control code to be actioned.
- The numbers between the “[” and “m” dictate which colors will be used. The colors are identified by number. Some numbers represent background colors and some represent foreground (text) colors.
These are the codes we’ll use to start a color sequence, and how to turn them all off:
- ‘\e[01;31m’: Black background, red text.
- ‘\e[01;32m’: Black background, green text.
- ‘\e[45;93m’: Magenta background, bright yellow text.
- ’‘\e[0m’: Turn off all effects.