This post is in the category: Configurations
Posts here will mostly contain full configuration files for my own reference and will not likely not have much explanation. See posts in the Guides category for more explanational posts.
I have a few customizations to the bash prompt and how bash interfaces with a terminal window.
Custom Bash Prompts
Default user prompt. Short and simple.
PS1='[\u@\h \w]$ '
The root prompt is the same as the user prompt, except red as a warning.
PS1='[\[\e[01;31m\]\u@\h \w\[\e[0m\]]$ '
Yellow prompt that I use on “jumper” boxes. They are normally SSH servers that sit between two networks.
PS1='[\[\e[01;33m\]\u@\h \w\[\e[0m\]]$ '
Update Terminal Title
This is taken from the CentOS default config in /etc/bashrc
. I noticed that my terminal titles were updating on CentOS boxes, but not on Ubuntu boxes. This is the config to add to make things consistent.
case $TERM in xterm*) PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' ;; screen) PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' ;; *) ;; esac