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

Coloring Terminal's SSH server connections UNIX
If you find yourself heading in and out of various remote servers (especially if done in the same Terminal window), then this AppleScript should be quite useful. I found a few other tips on this site about coloring Terminal windows, but none of them offered what I wanted: A single script which could be activated by a command key (via QuicKeys, iKey, Spark, etc.). The others seemed a bit too complex for such a simple task. A simple hostname and some sed parsing, and you're golden.

A couple of notes on the script (duplicated in the script's comments as well):
  1. You need to be inside a shell, not within an application (e.g. vi, emacs, pine...).
  2. The script parses the hostname using sed, so you'll need to make sure your prompt has an identifiable character within it.
Regarding the other hints linked above, some are for random coloring and others specific to ssh logins -- although I can't seem to get the .term files to open a new ssh connection when changing the ExecutionString entry in the term file. Maybe someone can add that trick to this post. Enjoy!

[robg adds: I haven't tested this one...]
    •    
  • Currently 1.50 / 5
  You rated: 2 / 5 (2 votes cast)
 
[11,200 views]  

Coloring Terminal's SSH server connections | 5 comments | Create New Account
Click here to return to the 'Coloring Terminal's SSH server connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
My favourite
Authored by: sapporo on Aug 23, '05 11:16:42AM
And then there's ssh_host, my personal favourite.

It's a wrapper script around ssh that sets the window color depending on the arguments passed through.

The nice thing is that it gets triggered whenever you execute ssh (assuming you set up an alias), and restores the terminal background color when you logout.

Now that I think about it, you could also use it to change the background color for other local processes, like emacs.

[ Reply to This | # ]

Scripts are totally unnecessary
Authored by: pauljlucas on Aug 23, '05 12:06:25PM

So what's wrong with creating a Terminal window exactly as you like it, with the right color and everything, and saving the .term file to use? You don't need any scripts of any kind whatsoever.

As for the ExecutionString, what works is to set the Shell string instead.

---
- Paul



[ Reply to This | # ]
Scripts are totally unnecessary
Authored by: luomat on Aug 23, '05 02:49:50PM

Paul has a point... I've done this with Launchbar for some time now.

Unless you are ssh'ing to a whole lot of new and different hosts all the time, a saved .term file seems like a better / easier way to go.



[ Reply to This | # ]
Scripts are totally unnecessary
Authored by: sjk on Aug 24, '05 09:02:52PM

Exactly. The other methods suggested may be overly complicated most of the time.



[ Reply to This | # ]
Coloring Terminal's SSH server connections
Authored by: fniessen on Aug 24, '05 01:11:16AM

I am working with different ssh connection at the same time and I am using iTerm ( http://iterm.sourceforge.net/ ) for coloring the font (and some other great features).
I am using red for production server, blue for the hot standby and white for local shells.

Frank



[ Reply to This | # ]