Sunday, March 13, 2011

A cool terminal tip for Mac users

If you use a Mac, and you are dealing with many similar tasks at once, like examining many database servers in different terminals, you may like this one.
I have been using iTerm 2 for a while, and my handling of parallel tasks has improved a lot. (No, I am not talking about Parallel replication, although I have applied this trick while testing that technology as well.)
iTerm2 has some cool features, and probably the most striking one is split panes. That alone would be a good reason for giving iTerm2 a try. But the one that I use the most, often in combination with Split Panes, is called Send Input to all tabs.
Here is how it works.
Let's say I need to use 4 servers at once, and perform a non-repeating operation in all of them.
So I open a separate window and I split the screen into 5 panes. I connect to each server in the first four panes, and I open a vim instance in the fifth.
With that done, I enable the magic option.


A word of caution. This option sends the input to all the open tabs in your current window. If you don't want this to happen, do as I do, and open a separate window. Then make sure that all tabs, and eventually split panes, are supposed to receive your input. The application asks you for confirmation.


After that, whatever I type on one pane will be mirrored on all the panes. So I will see the commands running on my four servers, and being logged in a text file in the fifth one. All with just single command, I have all servers under control at once:

5 comments:

Anonymous said...

See also cssh for Linux, or csshX for OSX.

Peter said...

If somebody has a tip on how to run the client in 'Powershell' in Windows7 it would be nice too! It also has a lot of rich features (as compared to cmd.exe). But I am not able to get it work. I wonder if a wrapper for the client written in .NET is required?

osx remote desktop said...

Very good post.
Made me realize I was totally wrong about this issue.
I figure that one learns something new everyday.
Nice, informative website by the way.

Darren Cassar said...

Giuseppe, have you tried `screen` on a standard terminal? It is the best terminal setup I have ever used personally whereby you can attach and detach sessions from multiple computers keeping all your sessions open, have multiple tabs at once, name each tab and if you must :) you can even split a single page using `Control+a and Shift+s` unsplit using `Control+a and Shift-x`. Shortcuts are not the easiest to remember :) but it is indeed the best terminal setup on any OS. (to me at least).

Giuseppe Maxia said...

@Darren
Yes, I know about screen.