I like when the shell prompt shows the username, hostname and the name of the working directory. In addition, I like, when all of this is shown in colors. So I usually put
export PS1='\[\033[0;32m\]\u@\h:\[\033[36m\]\W\[\033[0m\] \$ '
~/.bashrc. In order to apply changes immediately, call
Also if you switch to root using
su it is good to see bash prompt in a different color, so that you exercise extra caution. For this I add the line
export PS1='\[\033[0;31m\]\u@\h:\[\033[36m\]\W\[\033[0m\] \$ '
/root/.bashrc. And call
to apply the changes. Then it looks like this
Very often VPS server admins provide dumb hostnames. In order to change it, open
/etc/sysconfig/network and change the line
If you want different colors for
username@host part, you have to change 0;32m part in the first example, or 0;31m part in the second example. The list of available colors can be found here
.bashrc is executed for non-login shells, do not forget to double check that
if [ -f ~/.bashrc ]; then
is present in
~/.bash_profile is executed at your login. And also add the same piece into