Ask Your Question

Terminal Colors

asked 2012-01-30 13:38:22 -0500

atobi gravatar image

updated 2014-09-28 19:14:30 -0500

mether gravatar image


I'm currently have two profiles in my terminal: the Default and a "root" (different colors) I created for when I'm switching to ... yes, root. I made this so I remember I'm root and don't compile/make/... It happened (a lot).

Now, I still have to switch manually to that profile. But also that I do forget once and a while; so I would like my terminal to switch automatically to the "root" profile when I switch to root.

Is this possible and how? :)

Many thanks,


edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted

answered 2012-01-30 13:58:28 -0500

KevinA gravatar image

Glenn, What is the difference between the two profiles? Is it just colors of the prompt or colors of all the text within the terminal? If it is the color of the terminal prompt then you should be able to modify the .bashrc belonging to root and set the PS1 variable to set the prompt how you would like it to appear. The link below has more information on customizing the terminal prompt color.

edit flag offensive delete link more

answered 2012-01-30 14:01:00 -0500

Orestes910 gravatar image

Most of whats explained here should be applicable to your situation.

Best of luck!

edit flag offensive delete link more

answered 2012-01-30 14:01:49 -0500

I personally put my root preferences in /root/.bashrc

edit flag offensive delete link more

answered 2012-01-30 22:44:00 -0500

FranciscoD_ gravatar image

Well, the solution would be to not stay logged in as root all the time ;)

Use the 'su -c <command>' format. It is always preferred.

edit flag offensive delete link more

answered 2012-01-31 10:46:30 -0500

bigben87 gravatar image

updated 2012-01-31 10:53:38 -0500

If you have trouble remembering which user you currently are, why not stop switching users altogether? Install sudo via su -c 'yum install sudo' and disable the root account via su -c 'passwd -l root'.

If you prefer su -c '<command>' over sudo <command>, you might just change your behavior, as suggested by FranciscoD_.

edit flag offensive delete link more


Please google su vs sudo and read.

FranciscoD_ gravatar imageFranciscoD_ ( 2012-01-31 13:28:22 -0500 )edit

Question Tools


Asked: 2012-01-30 13:38:22 -0500

Seen: 7,973 times

Last updated: Jan 31 '12