Fedora 27 Coloured Bash prompt

For my information, but others might find it useful.

To get this prompt

ps1

Add the following line to your .bashrc file

PS1=”[\[\033[1;31m\]\u\[\033[0m\]@\h \W]\\$ ”

To get this colour at the root prompt

ps2

Add this to the root .bashrc prompt

PS1=”[\[\033[1;32m\]\u\[\033[0m\]@\h \W]\\$ ”

The actual color code is “1;31″ inside the PS1 variable. The 1 says make it ”’bold”’ and the 31 says the color red.

1;30 Black

1;31 Red

1;32 Green

1;33 Yellow

1;34 Blue

1;35 Magenta

1;36 Cyan

1;37 White (Don’t think white would show up too well on this page)

Advertisements

2 thoughts on “Fedora 27 Coloured Bash prompt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s