Personalize your $PS1

  • code • prompt • cli • personal • personalization • howto • it • terminal • curiosity • english • bash • utility
  • 45 words
Fancy $PS1 setting

The code to make the Bash prompt looks like mine is (~/.bashrc):

case $TERM in
	xterm*|rxvt*)
		TITLEBAR='\[\033]0;\u@\h:\w\007\]'
		;;
	*)
		TITLEBAR=""
		;;
esac;

PS1="${TITLEBAR}\n\[\033[0;0m\][\033[0;32m\]time: \
\[\033[0m\]\[\033[1;31m\]\t\[\033[0m\]\[\033[0;0m\]]-\
[\[\033[0m\]\[\033[0;32m\]host: \[\033[0m\]\
\[\033[1;31m\]\h\[\033[0m\]\[\033[0;0m\]]-\
[\[\033[0m\]\[\033[0;32m\]user: \[\033[0m\]\[\033[1;31m\]\u\
\[\033[0m\]\[\033[0;0m\]]-[\[\033[0m\]\[\033[0;32m\]bash: \
\[\033[0m\]\[\033[1;31m\]\v\[\033[0;0m\]]\n\
\[\033[0;0m\][\[\033[0;32m\]cwd: \[\033[0m\]\[\033[1;31m\]\w\
\[\033[0m\]\[\033[0;0m\]]# "

Thanks to Bash Prompt HOWTO.