Is it possible to change the colors in the command prompt for the user@computer
, as well as the the current directory and command parts of the prompt display?
I've already seen something like this done by OSX users, but I don't know how to do the same thing in gnome terminal (I can only change foreground and background colors).
It'd be very useful when, for example, trying to compile programs that have errors, since long, unformatted messages make it hard to distinguish which lines are commands and which are output.
Best Answer
You can edit the settings editing the file:
~/.bashrc
.Open the file:
gedit ~/.bashrc
.Look for the line with
#force_color_prompt=yes
and uncomment (delete the#
).Look for the line below
if [ "$color_prompt" = yes ]; then
that should looks like: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 to purple, the "@" to black and host to green. Edit the line so it looks like:Result:
The colors numbers are:
References: 1, 2.