473,486 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

can you change your terminal colors when ssh'ing automatically?

256 Contributor
I frequently ssh into other machines and in order to help me remember which terminal sessions are local and which are remote I like to change the color scheme on the ssh'd ones. (I usually have local terminals with white text on top of black background and ssh'd ones the opposite so I can easily tell just by looking)

I'm using the gnome terminal, and it would be nice if I didn't have to change the setting every time (lazy I know). I tried google and such but I'm finding nothing related to what I want.

Does anybody know a way to accomplish the color scheme switch automatically when I ssh over?

Any ideas or suggestions are welcome and thanks in advance!
Jul 6 '07 #1
3 5291
prn
254 Recognized Expert Contributor
As usual, there are several methods to do something like this.

Unfortunately, the requested method seems not to be one. I have not been able to find a script that changes the profile (or any of the components thereof) in a running gnome-terminal. What you can do is set up so that you open a new gnome-terminal with your preferred color-scheme when you ssh.

Personally, I have created several shortcuts on my desktop that I use to ssh to a number of the boxes that I normally have to use/administer. Each of those shortcuts is associated with a profile where, on the "Title and command" tab, I "run a custom command instead of my shell" and the custom command is along the lines of "ssh -X host.domain.tld". Then each profile has a different color scheme also.

An alternative way to to handle something equivalent is to create a script named ssh (e.g., in your bin directory, making sure that your PATH has your bin directory first) and having a form like:
Expand|Select|Wrap|Line Numbers
  1. #! /bin/bash
  2. gnome-terminal --window-with-profile=$1 -e "ssh $1.domain.tld" &
With the custom command set, this will open a new terminal window and automatically ssh to the host specified in the profile

If you want a single color scheme, e.g., black on white, for all of your ssh windows (personally, I'd much rather have different schemes), you can just create a single profile with that color scheme and no "custom command":
Expand|Select|Wrap|Line Numbers
  1. #! /bin/bash
  2. gnome-terminal --window-with-profile=ssh -e "ssh $1.domain.tld" &
This should do that job.

As I mentioned, I have not found a script that allows you to change the profile of a running gnome-terminal. You can, of course, change the profile manually using the "Terminal" menu from the gnome-terminal menubar, but I find this less reliable. In looking around, I found a mention or two that sort of implied that gconftool-2 could change characteristics of a running gnome-terminal, but nobody included an actual script and I have not tested this myself.

Best Regards,
Paul
Jul 9 '07 #2
mac11
256 Contributor
Thanks Paul, your suggestions are excellent!
I love having the ability to associate each host with a certain color set
Jul 9 '07 #3
prn
254 Recognized Expert Contributor
Thanks Paul, your suggestions are excellent!
I love having the ability to associate each host with a certain color set
Glad you like it! I first started doing that about 10 or 12 years ago. With a bunch of Solaris boxes to deal with, I started setting up each box with a color scheme and then creating shortcuts with corresponding color schemes to SSH to each box (using Teraterm Pro from the windows boxes or just the straight terminal from the other Solaris boxes). Setting up the aliases from the Solaris boxes was dead easy -- I just copied over my profiles to every box. :)

I even tried to set up somewhat related colors for related boxes (e.g., production and test, with the test having just a slightly darker version of the scheme). It really helps (me, at least) a lot to have that extra indicator of where I am.

Best Regards,
Paul
Jul 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

57
4175
by: John Howard | last post by:
I've sent several messages over the last year asking about python - Who teaches python? Is python losing steam? etc. I have noticed, eg, the declinng number of books at my local borders. The last...
9
7669
by: Peter | last post by:
Hi at all, how can I do to make a css file to change automatically the text size of the text that is into a table relatively the screen size? I.E. if the screen is 800 x I want the text...
4
1973
by: Jacob | last post by:
Really more of a VS.NET question than a C# question.... I have a couple files in my solution that I would like copied to the compile directory when the solution is built. How do I set it up so...
0
306
by: Kaworu | last post by:
Mihai N. wrote: > You do not use the .rc at runtime, you use the resources compiled in > a DLL. > > Hi, DLL system is running ok, thanks, but I'd like that the strings > for language interface...
4
3923
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
6
988
by: Ivan V via DotNetMonster.com | last post by:
Dear All: I have this one stupid that I cannot solve lately. It's all about the textbox. For instance, I have 2 textbox, one is called A and the other is called B. First, I had to input any...
3
18726
by: ymcj | last post by:
Hi, I'm trying to change the column name - date to Sdate in all the tables in my database. As i have many to change so i tried to search all tables and have it change automatically rather than...
2
2526
by: Astan Chee | last post by:
Hi, I was looking for a web-based SSH client (something like www.port42.com..but for some reason it doesnt work..can anyone verify this)..does anyone know any other alternative to other websites...
0
1085
sokoun
by: sokoun | last post by:
Hi all, I want to start up terminal automatically when the Desktop environment load finish what should i do ? can you help me? thanks.
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.