What Is tmux?
tmux is a terminal multiplexer — it lets you run multiple terminal sessions inside one window, detach and reattach sessions, and keep processes running after disconnecting from SSH.
Installation
sudo apt install -y tmux # Ubuntu/Debian
sudo dnf install -y tmux # Rocky/Alma LinuxEssential Commands
# Start a new session
tmux
# Start a named session
tmux new -s myproject
# Detach from session (keeps it running)
# Press: Ctrl+b, then d
# List sessions
tmux ls
# Reattach to a session
tmux attach -t myproject
# Kill a session
tmux kill-session -t myprojectWindow Management
All commands start with the prefix Ctrl+b:
| Key | Action |
|---|---|
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 |
Ctrl+b , | Rename current window |
Ctrl+b & | Close current window |
Pane Splitting
| Key | Action |
|---|---|
Ctrl+b % | Split vertically |
Ctrl+b " | Split horizontally |
Ctrl+b arrow | Navigate between panes |
Ctrl+b z | Toggle pane zoom (fullscreen) |
Ctrl+b x | Close current pane |
Why Use tmux on a VPS?
- Persistent sessions — processes survive SSH disconnects
- Multi-tasking — monitor logs while editing files
- Long-running tasks — start a build and detach safely
- Pair programming — multiple users can attach to the same session