Everyone loves to decorate their PC. Specially when you are working in a Linux OS there are lots of opportunity to customize and decorate. Here’s a simple one, about how to change user and host name color in terminal:

This is very simple, just open the terminal and type this to edit the .bashrc file:

sudo leafpad ~/.bashrc

Now uncomment the following line:

#force_color_prompt=yes

Then go to the following lines:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Pay attention at the part \u@\h it is saying “user@host” and the number before it \[\033[01;32m\] indicates the color. This is what you have to change. For example, lets change the “user” for red, the “@host” for white, edit the line to looks like:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;37m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Now save the file.

Close the terminal and open it again.

Bingo!!

Advertisements