Home   >   How to change colours in bash prompt for Ubuntu
December

First of all, open up your ~/.bashrc file and enable color prompts:

nano ~/.bashrc

uncomment then line #force_color_prompt=yes

Then, change the PS1 line directly under the line if [ "$color_prompt" = yes ]; then

to:

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

As you can see, 01:34m is light blue and 00:32m is green. Light green would be 01:32m instead of 00:32m.

Press CTRL + o and then press ENTER to save the file. Press CTRL + x to exit nano.

The changes should now apply to every newly opened terminal under your user.

Change colors of  directories in ls -al command

Edit your ~/.bashrc and add below line at bottom.

nano ~/.bashrc
LS_COLORS=$LS_COLORS:'di=0;32:' ; export LS_COLORS

Some nice color choices (in this case 0;35 it is purple) are:

Blue = 34
Green = 32
Light Green = 1;32
Cyan = 36
Red = 31
Purple = 35
Brown = 33
Yellow = 1;33
Bold White = 1;37
Light Grey = 0;37
Black = 30
Dark Grey= 1;30

The first number is the style (1=bold), followed by a semicolon, and then the actual number of the color, possible styles (effects) are:

0   = default colour
1   = bold
4   = underlined
5   = flashing text (disabled on some terminals)
7   = reverse field (exchange foreground and background color)
8   = concealed (invisible)

Tags: , ,

Categorised in: Linux, Ubuntu