Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Color Bash Prompt on Ubuntu and Debian

Ubuntu

Green Prompt for your user

Edit ”~/.bashrc” and change:

#force_color_prompt=yes

to:

force_color_prompt=yes

To change it for all new users make the same in ”/etc/skel/.bashrc”.

Red Prompt for root

Edit ”/root/.bashrc” and change ”force_color_prompt=yes” like for your user.

Now change the color to red. Search this line:

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

and change it to:

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

Note: For this change to take effect, you must log out then log in again.

Debian (older versions)

Green Prompt for your user

Open ”~/.bashrc” and append:

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

Red Prompt for root

Edit ”/root/.bashrc” and append:

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

Other colors

Color	Code
Black	30
Blue	34
Green	32
Cyan	36
Red	31
Purple	35
Brown	33
Blue	34
Green	32
Cyan	36
Red	31
Purple	35
Brown	33

,

2 thoughts on “Color Bash Prompt on Ubuntu and Debian

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.