Learn to Change Bash shell Terminal Color

Steps to change bash shell Terminal Color
 Following command will Open .bashrc file
$gedit ~/.bashrc

In .bashrc file find the following code segment

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
    PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
fi

Copy  the below color code and paste  it to the above  if condition

# ANSI color codes
RS="[33[0m]"    # reset
HC="[33[1m]"    # hicolor
UL="[33[4m]"    # underline
INV="[33[7m]"   # inverse background and foreground
FBLK="[33[30m]" # foreground black
FRED="[33[31m]" # foreground red
FGRN="[33[32m]" # foreground green
FYEL="[33[33m]" # foreground yellow
FBLE="[33[34m]" # foreground blue
FMAG="[33[35m]" # foreground magenta
FCYN="[33[36m]" # foreground cyan
FWHT="[33[37m]" # foreground white
BBLK="[33[40m]" # background black
BRED="[33[41m]" # background red
BGRN="[33[42m]" # background green
BYEL="[33[43m]" # background yellow
BBLE="[33[44m]" # background blue
BMAG="[33[45m]" # background magenta
BCYN="[33[46m]" # background cyan
BWHT="[33[47m]" # background white

Now comment the  PS1 line in the if condition and paste the following line

PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "

find the following line in .bashrc file and uncomment it

#force_color_prompt=yes

After that ,run the following command.

source ~/.bashrc
  
Now close the terminal and restart it , Your bash prompt is colored now. Happy Scripting :)

Leave a Reply

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