You may already use screen for multiplexing a terminal. This is especially useful when you want to start long running processes on a server and do not want to loose the connection because of a ssh connection timeout, firewall settings or other reasons. With screen the session keeps running even if you got disconnected somehow and you may re-attach to the screen session at any point later.
In this post I want to make you aware of another tool that does the same thing. It is called tmux and available for the most Linux/Unix platforms. Installation is straight forward and easy:
For debian based distributions:
apt-get install tmux
For redhat based distributions:
yum install tmux
Imagine you have an oracle database running on a server and you want to perform several tasks without the risk of loosing the connection. With tmux this becomes very easy:
Open a new tmux session:
You will be immediately connected to it. In this session do whatever you want, e.g. tailing the oracle alert.log:
In another session you now want to do a restart of the database. In tmux you can horizontally split the screen by hitting
You can add as many screens as you want. Cycling through the screens is done by
and one of the up/down/left/right arrow keyboard keys. Detaching from the screen is done by
For re-attaching just type:
… and everything will be back.
The man page for tmux is here.