tmux: Terminal Multiplexer for Persistent Sessions

The tmux command is available on all login nodes.

tmux is a terminal multiplexer that is essential for maintaining session persistence on remote computing systems.

In a standard SSH session without tmux, your terminal acts as a direct link to a single shell instance. If the terminal window is closed, or if your network connection is interrupted, the shell and all running processes within it are immediately terminated. This lack of persistence poses a risk to professional workflows, particularly those involving long-running computations or unstable remote connections.

With tmux, you can initialize your work within a dedicated session. If you are disconnected, the tmux session remains active (“resident”) on the login node. You can simply log back in, attach to your existing session, and resume your work exactly where you left off. This allows your login sessions to persist effectively for weeks or even months.

Starting a New tmux Session

Assuming you have already logged into a target login node via SSH:

$ tmux

Executing the tmux command initializes a new session. You can begin working within this persistent terminal immediately.

Reattaching to a tmux Session

If you have been disconnected, log back into the same login node and run:

$ tmux attach

This command reattaches your current terminal to your existing tmux session. All previous outputs and running processes will be preserved.

Essential tmux hotkeys

tmux operations rely on a “prefix” key combination (default is Ctrl + b) followed by a command key.

How to create a new terminal window:

  • Click on the current tmux window

  • Press Ctrl + b, release, then press c

How to list and switch between windows:

  • Press Ctrl + b, release, then press w

  • Use the Up/Down arrow keys to navigate the list and press Enter to select a window.

These basic commands cover the core functionality required for most workflows with tmux.

More useful tmux control

Create a new tmux window:

  • Enter Ctrl + b, release, then enter c

List all the existing tmux windows and can select one:

  • Enter Ctrl + b, release, then enter w

List all the existing tmux sessions and can select one:

  • Enter Ctrl + b, release, then enter s

How to add a new tmux session:

  • Enter Ctrl + b, release, then enter d
    • exit tmux session temporaily

  • Run below:

$ tmux new -s "NewSessionName"
$ tmux attch

List all currently running tmux sessions:

$ tmux ls

Terminate entire tmux sessions:

  • Enter Ctrl + b, release, then enter d

$ tmux kill-server

Note

tmux sessions are tied to the local login node. If a login node is rebooted for maintenance, all active tmux sessions on that node will be terminated.

There are ways to save & restore tmux sessions even reboot (ex: tmux-resurrect ), but they are beyond the scope of this introductory guide. We encourage you to explore the extensive range of tmux features to further customize your environment to your specific needs.