tmux

Tmux, short for terminal multiplexer, is a utility which allows for the creation and use of multiple terminal sessions with a single window. A user can easily manage multiple tasks and command line programs on a Linux server, without the clutter of many open windows. Sessions can be detached, attached and shared, staying in the background.

Tmux is very similar to GNU Screen, but with some additional advanced features, and is more regularly maintained.

Installing tmux

Tmux is available in the EPEL yum repository. To use this repository, install the following rpm:

rpm -ivh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Now that the EPEL repository is accessible by yum, tmux can be installed.

yum install tmux

Using tmux

To start a tmux session, simple execute the command.

tmux

You'll then be under a new shell, in the initial tmux window. At the bottom, you'll see a green bar which lists this session's windows.

To create an additional window, execute the keystrokes "Ctrl+b" then "c". A new window will be created (window 1), and you'll be placed at that prompt. To list and move between windows, execute "Ctrl+b" + 'w'. Closing a window simply involves exiting the shell; with the 'exit' command.

"Ctrl+b" is the prefix key stroke. It will need to be executed before any other. For a complete listing of the available key bindings, execute "Ctlr+b" + "?".

Detach and Resume Session

To detach a tmux session, issue the keystrokes "Ctrl+b" + "d". You'll then leave the tmux session, and be brought to your original prompt.

To resume a session, run the command:

# tmux attach

If you have multiple tmux sessions running, you'll need to identify the desired session, and then attach with the '-t' flag.

# tmux ls
0: 1 windows (created Fri Jul 13 00:47:46 2011) [113x20]
1: 1 windows (created Fri Jul 13 00:49:12 2011) [113x20]
# tmux attach -t 1
        

 

Refer to the tmux man page for additional information