Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Colorize remote connection windows UNIX
Are you sprawled out across different computers? Do you su from time to time? If you are an even occasional user of ssh (rsh, etc), you can decrease your chances of confusion by having these commands run themselves in specific colors.

For example, if you're connected to sourceforge.net, your terminal could be in green, whereas if you connect to your mac.com address, as in a previous hint, it'd be amber. Whenever you do an su, it could be red to keep you alert. You'll want to do the following:
  1. Download the colorssh scripts [4K download]

  2. In the terminal, type:
     % mkdir ~/scripts
    % cd ~/scripts
    % tar -xzvf colorssh_2003-02-10.tgz
  3. Append the stuff from ~/scripts/colorssh/aliases.mine to your tcsh configuration (revise accordingly for bash)

  4. Edit ~/scripts/colorssh/servercolors.sh to suit your taste (pretty self-explanatory, i think)
That's it! Try it out:
 % ssh someserver.blah.com
% su
% etc...
[Editor's note: I haven't had a chance to try this one out yet, but I will as I often find myself forgetting which remote window is which!]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[8,296 views]  

Colorize remote connection windows | 7 comments | Create New Account
Click here to return to the 'Colorize remote connection windows' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
works well, except...
Authored by: armin on Feb 13, '03 01:40:38PM
this is a great hint!

be aware that there is a typo in the provided aliases.mine

line 2 should read like that:
set TERMCOLOR_DIR=${HOME}/scripts/colorssh

notice the leading set and the spelling of TERMCOLOR (delete "U" from the original file)

otherwise it works as described. the only problem i have is that when i su or ssh i get the following comments/errors:
## Component Manager: attempting to find symbols in a component alias of type (regR/carP/x!bt)
## Component Manager: attempting to find symbols in a component alias of type (regR/carP/x!bt)

yes - twice! except this minor glitch (i don“t even have the slightest glue what this means) the colors do change the way i want them...
anybody else with these symptoms? what are these errors about?

[ Reply to This | # ]
works well, except...
Authored by: kholburn on Feb 13, '03 08:30:34PM

I get those log entries all the time and I have never used this script. I have yet to discover what they mean. I do have coloured terminal windows though.



[ Reply to This | # ]
works well, except...
Authored by: gidds on Mar 18, '03 06:22:05PM
One cause of these messages is having the file /Library/QuickTime/Toast Video CD Support.qtx installed... if you have Toast but won't be using Video CDs (whatever those are), then deleting the file should get rid of at least one set of those messages!

(I've just discovered this in another comment on this site, and it works for me, but I can't post as link as I could only find it in Google's cache...)

---

Andy/

[ Reply to This | # ]

Another way
Authored by: pbx on Feb 13, '03 03:44:13PM

Varying the appearance of terminal windows is a great trick. Here's a totally different, not to say better, way of doing it:

1) In Terminal, create a new window. Tweak its size, font settings, colors, etc.

2) Save these settings as a .term file

3) In a text editor, open the .term file (it's XML) and look for the "Shell" key. Edit that setting to look like this:

<key>Shell</key>
<string>/usr/bin/ssh ACCOUNT@HOST</string>

filling in the appropriate account and host values of course.

4) Save changes

5) That's it. Open the .term file to create a new connection. If you've got ssh set up right (I'm sure there's a hint on that somewhere here), you won't even have to type your password.

This works great in conjunction with something like Launchbar to make quick work of opening the various .term files.

In my web development work, I actually tweak the terminal window colors to match the color scheme of the client site. This makes it obvious at a glance which shell sessions are associated with which jobs.



[ Reply to This | # ]
Another way
Authored by: readparse on Feb 14, '03 12:50:31AM

Yeah, this is what I do in Terminal, and the same kind of thing that I've done for years with other terminal programs (xterm and SecureCRT). It's a very good practice, but there's also something to be said for a program that will change the color of the text when certain programs (or strings, as they case may be) are run. I, for one, have been in one Terminal session that was set up for a remote ssh connection, then been disconnected from that session, to find myself in a local shell that appears at first glance to be a remote shell. Things like that. If the colorization is done at the command level, it can become a whole lot less confusing.

Oh, and the idea of having strongly-highlighted text for the "su" command is ingenious. Love it

John



[ Reply to This | # ]
Another way
Authored by: the_shrubber on Feb 14, '03 07:12:29AM

That's very kind, thanks.

two notes: If you switch windows before the applescript has a chance to run, it'll end up colouring the wrong terminal (doh)..

Also, if you ctrl-C your app, the script won't have a chance to run it's set-the-colour-back stuff, so you'll have to manually perform 'decolorterm" (the decolorterm alias is set with the assumption that your terminal is dark-backgrounded; you should change it to taste)



[ Reply to This | # ]
script fixed
Authored by: the_shrubber on Feb 14, '03 06:53:05AM
thanks to armin for his note (i used setenv in mine, but a) forgot about it b) setenv is overkill ) the new scripts can be found here

[ Reply to This | # ]