How to use different profiles for different console environment?

2

Can I use two or more different profiles used in my console as the same time?

Since, I always ssh to the other machines ,e.g. servers. in my console. Somehow, I always mix it up with my current PC.

I want to use 2 different profiles for different environments. Say, in server console, I use red background color. in my pc console, I use green background color such that i can easily distinguish out.

or can i set the background color in .bashrc?

Thanks

Kit Ho

Posted 2011-07-09T04:02:50.947

Reputation: 3 467

When you say console, do you mean in your terminal windows (Gterm, XTerm, rxvt, ATerm, etc.), or are you out of X completely and only at the command prompt with no GUI to speak of? – Matrix Mole – 2011-07-09T04:38:58.157

yes XTerm, but if there is a way that out of X completely, that even would be better. BUt if you have solution on Xterm, gnome-terminal, it is ok! – Kit Ho – 2011-07-09T04:40:33.473

I wonder if we can set the background in bashrc – Kit Ho – 2011-07-09T04:40:58.493

Ok, I'll post answers for both scenarios – Matrix Mole – 2011-07-09T04:41:21.663

Answers

0

You can modify a lot of the terminal settings in your ~/.Xdefaults file. This post on the gentoo forums (which will work cross distribution btw) give a lot of tweaks on how to set this information. Many of them are for urxvt, but should be easy to tweak for XTerm or even gnome-terminal unless you'd like to install urxvt (which I personally prefer).

For main console outside of X completly, the setterm program can be used to configure a lot of the screen information. Not sure how that will work in virtual terminals (xterm, etc.), but it has foreground, background, etc. color settings you can tweak. It might get called from /etc/rc.d/rc.M on your machine, or you can just build a script file for the setterm info for those times you use it. For the detailed info on setterm there is no better place than man setterm to find it.

Matrix Mole

Posted 2011-07-09T04:02:50.947

Reputation: 3 303

sound like setterm cannot set the background color. It will change it back to original when i press Enter ... – Kit Ho – 2011-07-09T10:27:09.660

setterm -back green – Kit Ho – 2011-07-09T10:27:33.370

I don't have a console on any of my linux machines, so can't test setterm out, but the .Xdefaults modifications should help you with getting screen colors inside xterm windows. Might even be able to tweak with the command line options of xterm to give different background colors based on what command line is used, then have xterm aliases for each different colored background you want. – Matrix Mole – 2011-07-12T01:26:07.830