
GNU Screen is like Emacs for your console: Lots of power at the top of a steep learning curve. And just like Emacs, screen can be customized to fit your individual workflow. It's helpful to refer to others' configuration files when you first start using and customizing screen, so I've posted my screen configuration file below.
I also developed a simple utility called pecho that allows you to send keystrokes to multiple screens at the same time, introduced at the end of this post.
What is GNU Screen?
GNU Screen is a full-screen window manager for your terminal. Some features:
Start up multiple shell instances (called windows) inside a single shell. Navigate between them with the keyboard.
Divide your window into multiple regions, with a separate shells running in each region. Again, with keyboard navigation.
Detach from a Screen session, and have the applications keep running. (You can re-attach at a later point.) Very useful for keeping things alive between ssh sessions.
This is not a tutorial. I'm assuming you already know how to run screen and do some simple commands, if not, there are many great tutorials out there.
My Screen Configuration File
I've modified screen to use the same keybindings as Emacs when possible. For example, C-x C-f will create a new shell, and C-x C-b lists all shells. Copy the text below into ~/.screenrc and then run screen.
Pecho - Parallel Echo
A few weeks ago I needed to perform a series of roughly identical operations tasks across 5 machines in a way that couldn't be easily scripted. "This would be so much easier", I thought, "if I could type in one terminal and have my keystrokes broadcast to the other terminals." Thus, Pecho was born.
Here is a short video demonstration:
To install Pecho (short for Parallel Echo), copy the code below to pecho file in your path, and change its attributes to executable. This has been tested on Mac OSX.
To run Pecho (Parallel Echo), simply type pecho followed by the Screen window numbers that should receive the output, ie: pecho 1 2 3 4. Then, type a key in the the pecho window, and it will appear in the other windows.
It works by reading a keystroke on the command line and then iterating over each window number, calling the Screen "stuff" command to transmit the character. If you're careful, you can actually use it to edit multiple remote files in vi at the same time.
