tmux Cheat Sheet
Terminal multiplexer for persistent sessions, split panes, and windows — keep shells alive across SSH drops.
Overview
tmux lets you run multiple terminals inside one screen, detach a session and reattach later (even after an SSH disconnect), and split the screen into panes. Essential for long-running scans and remote work. Every shortcut starts with the prefix key, Ctrl-b by default — written below as 'prefix'.
Authorized testing only. Use only on systems, networks, and accounts you own or have explicit written permission to test.
Sessions (from the shell)
Start a new unnamed session
tmuxStart a named session 'recon'
tmux new -s reconList sessions
tmux lsReattach to session 'recon'
tmux attach -t reconKill a session
tmux kill-session -t reconSessions (inside tmux)
Detach (session keeps running in background)
prefix dInteractive session switcher
prefix sRename current session
prefix $Windows (tabs)
Create a new window
prefix cNext / previous window
prefix n / prefix pJump to window by number
prefix 0-9Rename current window
prefix ,Kill current window
prefix &Panes (splits)
Split vertically (side by side)
prefix %Split horizontally (top/bottom)
prefix "Move between panes
prefix <arrow>Zoom/unzoom current pane to fullscreen
prefix zKill current pane
prefix xSwap pane with previous / next
prefix { / prefix }Copy mode & scrolling
Enter copy mode (then PgUp/arrows to scroll)
prefix [In copy mode: start selection, then copy
Space ... EnterPress q to exit copy mode.
Paste the tmux buffer
prefix ]Quick one-liners
Attach to the last session, or create one if none exist
tmux a || tmuxKill the tmux server and every session
tmux kill-serverRun a command in a new detached session
tmux new -d -s scan 'nmap -p- 10.10.10.5'Reload config without restarting
tmux source-file ~/.tmux.confTips
- Detach (prefix d) before closing your laptop or dropping SSH — the session and its jobs survive.
- Run long scans inside tmux so a disconnect never kills them.
- Rebind the prefix to Ctrl-a in ~/.tmux.conf if Ctrl-b is awkward: set -g prefix C-a
- Enable mouse mode for click-to-select panes: set -g mouse on