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 YouTubeInstalling 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: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
Kill other sessions
Advanced TMUX features
Window management
TMUX supports multiple windows within a session:Ctrl+B, C
- Create new windowCtrl+B, N
- Next windowCtrl+B, P
- Previous windowCtrl+B, 0-9
- Switch to window by number
Pane splitting
Split your terminal into multiple panes:Ctrl+B, %
- Split verticallyCtrl+B, "
- Split horizontallyCtrl+B, Arrow keys
- Navigate between panesCtrl+B, X
- Close current pane
Scrolling and copy mode
To scroll through terminal output:- Enter copy mode:
Ctrl+B, [
- Use arrow keys or Page Up/Down to scroll
- 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.