sudo apt update
sudo apt install tmux
tmux -V
tmux # start new session
tmux new -s work # start named session
tmux ls # list sessions
tmux attach -t work # attach to session "work"
tmux a # attach to last session
exit # closes the current pane/shell
tmux kill-session -t work
tmux kill-server # kills all sessions
Default prefix: Ctrl+b (written as C-b)
So C-b then c means: press Ctrl+b, release, then press c.
C-b d — detach (leave it running)C-b s — list/switch sessionsC-b $ — rename current sessionC-b c — create windowC-b n / C-b p — next / previous windowC-b 0..9 — jump to window numberC-b , — rename windowC-b & — kill windowSplitting:
C-b % — split left/rightC-b " — split top/bottomMoving around:
C-b o — cycle panesC-b ← ↑ → ↓ — move (works in most setups)C-b q — show pane numbers (then press number to jump)Resizing (hold prefix, then):
C-b C-←/→/↑/↓ — resize pane (common)C-b : then resize-pane -L 5 (or -R/-U/-D)Layouts:
C-b Space — cycle layoutsC-b z — zoom/unzoom a paneKilling:
C-b x — kill paneC-b [ — enter copy mode (scroll)? (backward) or / (forward)C-b ] — paste bufferIf you want copying to go straight to system clipboard, use the config snippet below.
C-b : — open tmux command linelist-keys
setw -g mouse on
Temporarily:
tmux set -g mouse on
Persistently in config:
set -g mouse on
~/.tmux.confCreate/edit:
nano ~/.tmux.conf
tmux source-file ~/.tmux.conf
Suggested minimal config:
# Better colors
set -g default-terminal "screen-256color"
# Mouse support
set -g mouse on
# Faster escape (useful in vim)
set -sg escape-time 10
# Vi-style keys in copy mode
setw -g mode-keys vi
# Easy reload
bind r source-file ~/.tmux.conf \; display "Reloaded!"
X11:
sudo apt install xclip
Wayland:
sudo apt install wl-clipboard
Then add one of these to ~/.tmux.conf:
X11 (xclip):
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
Wayland (wl-copy):
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
Use: C-b [ → select (vi keys) → press y to copy to clipboard.
tmux new -s project)C-b d)