In the world of terminal-based workflows, one tool stands out as a game-changer for multitasking, session management, and persistent command-line environments: tmux. Short for Terminal Multiplexer, tmux allows you to run, manage, and resume multiple terminal sessions inside a single terminal window.
Whether you’re managing remote servers via SSH, running long-running scripts, or working on multiple development tasks, tmux gives you superpowers at the command line.
tmux is an open-source terminal multiplexer that enables:
Multiple shell sessions inside one terminal
Persistent sessions (even after disconnection)
Pane and window splitting
Session sharing across users
Easy switching between tasks without leaving the terminal
It’s like having a tiling window manager for your terminal, available anywhere—even over slow SSH connections.
To start a new tmux session:
You’re now inside a new session. But to use it effectively, you’ll need to know some keybindings.
All tmux commands are triggered with a prefix key, which by default is:
So Ctrl + b, then % creates a vertical split, and so on.
Command | Action |
---|---|
tmux | Start a new session |
tmux new -s mysession | Start a named session |
tmux attach -t mysession | Reattach to a session |
tmux ls | List sessions |
tmux kill-session -t mysession | Kill a session |
exit | Exit current pane/window (or kill via tmux kill-pane) |
Create .tmux.conf or shell scripts to automate setup:
Allow collaborative terminal sessions (requires shared permissions):
Example:
# Set prefix to Ctrl + a (like GNU screen)
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Mouse support
set -g mouse on
# Better colors
set -g default-terminal "screen-256color"
Reload config:
When managing a remote VPS via SSH:
Connect via SSH
Start a tmux session:
Run updates or long processes (e.g., apt upgrade)
Disconnect any time—session persists
Reconnect later:
💡 This is invaluable for unreliable connections, especially over mobile or satellite links.
tmux is one of the most powerful tools in the command-line arsenal. Whether you’re coding, monitoring servers, or managing multiple tasks remotely, tmux offers productivity, persistence, and precision. Once mastered, it becomes indispensable—saving time, preserving sessions, and organizing your terminal workflow like a pro.