When I install the Ubuntu server and ssh to the server, the default shell is bash.

It looks like below.

I prefer to have a colorful terminal window. So I goole it and find the solution:

  • open ~/.bashrc in an editor
  • copy this and add it at the end of .bashrc file:
PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '

  • save the file and restart bashrc:
source ~/.bashrc

After that, the terminal window changed as below:

The user name, host name, path have different colors.

 

There is option to use bash’s official color scheme.

Open ~/.bashrc in text editor and uncomment line:

#force_color_prompt=yes

Save then execute source ~/.bashrc

The terminal window will be changed to :

It has color promot, but it is not that easy to read.

David Yin

David is a blogger, geek, and web developer — founder of FreeInOutBoard.com. If you like his post, you can say thank you here

Leave a Reply

Your email address will not be published. Required fields are marked *