Nice terminal prompt

To change the terminal prompt to show current user, machine and current location (and a flashy green dot instead of normal hash symbol), put in .bashrc:

export PS1="\u@\h:\W`if [ $? = 0 ]; then echo -e '\[\e[01;32m\] #'; else echo -e '\[\e[01;31m\] #'; fi` \[\e[0m\]"

This was taken from really useful Xterm, Aterm and URXVT features (GNU Screen) in the Gentoo forums.

Note that I couldn't get xtermcontrol to work properly without it messing up runlevel 3 prompt (outside of xwindows), although I didn't really spend much time trying because I found the above code which achieved everythind I wanted from xtermcontrol.

Last modified: 07/05/2006 (most likely earlier as a site migration in 2006 reset some dates) Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top