Site icon David Yin's Blog

Color Scheme for the command line of bash

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:

PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '

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.

Exit mobile version