Skip to main content
TMUX is a terminal multiplexer that creates persistent terminal sessions on your Pod.

Why use TMUX

While you can run long-running tasks in JupyterLab notebooks, the kernel can crash unexpectedly, losing hours or days of computation. TMUX runs your commands in persistent terminal sessions that continue even if JupyterLab crashes or you disconnect.

Requirements

To use TMUX, you need terminal access to your Runpod Pod (SSH, web terminal, or JupyterLab terminal).

Video tutorial

For a comprehensive video guide on using TMUX, check out this excellent tutorial: TMUX Tutorial on YouTube

Installing TMUX

TMUX is not installed by default on Runpod Pods. To install it, run:
Install TMUX
Most Runpod templates are based on Ubuntu/Debian images that support apt-get. If you’re using Alpine Linux, use apk add tmux instead. Some minimal images may lack required dependencies.

Practical example: running model training

Here’s a typical workflow for running long-duration model training:
Training workflow

Command reference

Starting a new session

Create a new TMUX session with a descriptive name:
Create named session

Detaching from a session

To detach from a session and leave it running in the background, press:
Your processes will continue running even if you disconnect from the Pod.

Listing active sessions

View all active TMUX sessions:
List sessions

Reattaching to a session

Reconnect to a previously created session:
Reattach to session

Killing a session

End a session when you no longer need it:
Kill session

Killing all sessions

If you need to restart fresh and kill all TMUX sessions:
Kill all sessions
Alternatively, you can kill all sessions except the current one:
Kill other sessions

Advanced TMUX features

Window management

TMUX supports multiple windows within a session:
  • Ctrl+B, C - Create new window
  • Ctrl+B, N - Next window
  • Ctrl+B, P - Previous window
  • Ctrl+B, 0-9 - Switch to window by number

Pane splitting

Split your terminal into multiple panes:
  • Ctrl+B, % - Split vertically
  • Ctrl+B, " - Split horizontally
  • Ctrl+B, Arrow keys - Navigate between panes
  • Ctrl+B, X - Close current pane

Scrolling and copy mode

To scroll through terminal output:
  1. Enter copy mode: Ctrl+B, [
  2. Use arrow keys or Page Up/Down to scroll
  3. Press q to exit copy mode

Best practices

When using TMUX on Runpod Pods, keep these tips in mind:
  • Always name your sessions descriptively to easily identify them later.
  • Regularly check on long-running processes by reattaching to sessions.
  • Clean up finished sessions to avoid confusion.
  • Use TMUX for any process that takes longer than a few minutes to complete.
  • Consider creating a TMUX session immediately when connecting to a Pod for important work.

Troubleshooting

If you can’t reattach to a session after reconnecting to a Pod, the Pod may have been restarted. TMUX sessions don’t persist across Pod restarts, so ensure you save your work regularly and use network volumes for persistent storage.