here.
"> here. "> here. " />Thoughts on security, privacy, and building software.
05 July 2015
Of all the configuration files, .bashrc is the one that will most affect the command line environment. The .bashrc file controls the configuration options for the bash shell, and for the most part it is the same as it would be in linux. My full .bashrc is here.
One alternative to make man pages more readable is to install most and use it for viewing man pages by putting ‘export PAGER=”most”’ into your .bashrc. Alternately, you can colourize ‘less’ by inserting the following into your .bashrc to colorize man pages.
# Less Colors for Man Pages
export LESS_TERMCAP_mb=$'E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'E[00;34m' # begin bold
export LESS_TERMCAP_me=$'E[0m' # end mode
export LESS_TERMCAP_se=$'E[0m' # end standout-mode
export LESS_TERMCAP_so=$'E[01;44;33m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'E[0m' # end underline
export LESS_TERMCAP_us=$'E[00;32m' # begin underline</pre>
I can’t track down where that tip came from originally, but Gen2ly has a good example on his excellent site, so I’ll give the credit to him.
Next is the all important PATH variable, which controls where the computer looks for executable files. I always include the directory to the windows system executables, as there are commands in there that don’t have cygwin counterparts, like tracert.
# Path
PATH="$PATH:/usr/local/bin:/usr/local/sbin:/bin:/sbin"
PATH="$PATH:/usr/bin:/usr/sbin:/usr/ssl/bin"
PATH="$PATH:/cygdrive/c/Windows/SysWOW64" # Windows Progs such as tracert
export PATH
The bash prompt is usually better when colourized. This is the one I use:
PS1='[e[1;36m][[e[0;36m]u[e[1;36m]@[e[0;36m]h[e[1;36m]] [[e[1;31m]w[e[1;36m]]$[e[0m] '
You can see how all the potential colours will look with this handy script:
#!/bin/bash
#
# Daniel Crisman's ANSI color chart script from
# The Bash Prompt HOWTO: 6.1. Colours
# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#
# This file echoes a bunch of color codes to the terminal to demonstrate what's available. Each
# line is the color code of one forground color, out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background colors (default + 8 escapes).
T='gYw' # The test text
echo -e "n 40m 41m 42m 43m
44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m'
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m'
' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs 33[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS 33[$FG