*note I use black as my background color.
PS1 color prompt
Me PS1 prompt has been far to long and tells me little to no information. I am slowly evolving it to tell me more here is what I have so far:
BASE="-=-\[$MAGENTA\]\u@\h\[$LIGHT_GREEN\]-=-\[$CYAN\]\D{'%H:%M'}\[$LIGHT_GREEN\]-=-\[$COLOR_OFF\]\n\
\[$GREEN\]\w\[$CYAN\]> \[$COLOR_OFF\]"
export PS1="\`if [ \$? = 0 ];
then
echo -e '\[$LIGHT_GREEN\]$BASE';
else
# On failure echo this
echo -e '\[$RED\]$BASE';
fi; \`"
fi
Looks like:
-=-username@hostname-=-12:55-=-
/path/to/location>
If the previous command failed a little port of my top line changes:
-=-username@hostname-=-12:55-=-
/path/to/location>
General programs to add more color in to your life
Other programs i've started using that help me see more color:
- colordiff
- colortail
- vimdiff
- htop
What no color less?
Since I can't find a good viable color less I just use screen. I use screen almost everywhere anyways so it works. It feels a little unnatural but i'll take it.
Bash aliases/options to make better color output
colors.bash: a file I import to make using colors easier.
export GRAY="\e[30m"
export RED="\e[31m"
export GREEN="\e[32m"
export LIGHT_GREEN="\e[1;32m"
export YELLOW="\e[33m"
export BLUE="\e[34m"
export LIGHT_BLUE="\e[1;34m"
export CYAN="\e[36m"
export MAGENTA="\e[1;35m"
export GRAY="\e[37m"
export LIGHT_CYAN="\e[1;36m"
export COLOR_OFF="\e[0m"
Make grep display color
export GREP_OPTIONS='--color=auto'
History color output
export HISTTIMEFORMAT=`echo -e "${CYAN}%m/%d/%y ${COLOR_OFF}- ${YELLOW}%H:%M:%S $GREEN"`
1008 05/08/11 - 12:30:22 clevar
Dmesg color and readable dates:
alias dmesg="dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'"
[Mon Sep 9 12:33:35 2013] - EXT4-fs (sda1): re-mounted. Opts: commit=0
Notes:
Look in to switching to tput instead of using the direct ansi colors.
No comments:
Post a Comment