Logging/monitoring/handling Multiple Interactive Shells

GNU Screen is one of the favored tools for system administrators and Unix-based users. It is very popular and many articles have been published about it in the most reputable magazines and journals.

Now what makes this tool powerful? Why do so many users prefer it while so few people even know about it?

Nowadays, at different data centers, there is a large number of servers and applications that carry out different business requirements.

Imagine that you have a dozen of remote machines, and that you need to connect to them on a daily bases over SSH client to perform different tasks (checking logs, processes or evaluating the performance).

GNU Screen works perfectly for these situations because it is a terminal multiplexer. You can use it to run any number of console based applications, curser-based applications, text editors etc…

All you need to do is to connect to the remote machine and run command screen, click < Ctrl+AC>, to create a new window, run it, click top… etc. At any time you can click < Ctrl+AP> to return to a previously opened window. All within a Secure Shell connection SSH.

The real power for GNU Screen is in the supporting the sessions. At any time you can click < Ctrl+AD>, to disconnect from Screen and restart it with ‘r’ to resume an interrupted session with all the windows open, and not an altered state of applications.

All sessions will remain on the server, so it does not matter from which machine it will be restarted. You start the session at work, then go home to continue what you have started at the office this helps to make your work flexible.

OpenBSD starting from version 4.6 integrates Screen in the operating system which is named tmux. tmux major features include:

* A powerful, consistent, well-documented and easily scriptable command interface.
* A window may be split horizontally and vertically into panes.
* Panes can be freely moved and resized, or arranged into one of four preset layouts.
* Support for UTF-8 and 256-colour terminals.
* Copy and paste with multiple buffers.
* Interactive menus to select windows, sessions or clients.
* Change the current window by searching for text in the target.
* Terminal locking, manually or after a timeout.
* A clean, easily extended, BSD-licensed codebase, under active development.

Despite belonging to OpenBSD, tmux is able to work on a set of UNIX-based systems, including FreeBSD, NetBSD, Linux, Mac OS X, Solaris and AIX. Binary packages already available in the repositories of Debian Sid and Ubuntu Karmic, and the source can be obtained from the official website: tmux.sourceforge.net.

After running tmux, you will immediately notice the difference from Screen. First, the status bar is enabled by default, and includes almost all the information that should be added manually on screen. Secondly, there is a difference in the keyboard shortcut < Ca> will be < Cb>. But the other keyboard shortcuts are the same on Screen.

Using GNU Screen and tmux will greatly simplify all administration tasks. Not only allows running different terminal but creates a whole environment for managing the infrastructure.

make sure you subscribe to my RSS feed!