Action | Command |
---|---|
Start new tmux session | tmux |
Create named session | tmux new -s [name] |
Detach from session | Ctrl + B , then D |
Attach to last session | tmux a |
Attach to specific session | tmux a -t [name/id] |
List sessions | tmux ls |
Kill current session | tmux kill-session |
Kill specific session | tmux kill-session -t [name/id] |
Action | Key Combo |
---|---|
New window | Ctrl + B , then C |
Next window | Ctrl + B , then N |
Rename window | Ctrl + B , then , |
List windows | Ctrl + B , then W |
Kill window | Ctrl + B , then & |
Action | Key Combo |
---|---|
Split pane vertically | Ctrl + B , then " |
Split pane horizontally | Ctrl + B , then % |
Switch panes | Ctrl + B , then Arrow keys |
Show pane numbers | Ctrl + B , then q |
Jump to pane by index | Ctrl + B , then q + number |
Resize pane | Ctrl + B + Ctrl/Alt + Arrow keys |
Preset | Key Combo |
---|---|
Even vertical layout | Ctrl + B , then Alt + 1 |
Even horizontal layout | Ctrl + B , then Alt + 2 |
Main-horizontal layout | Ctrl + B , then Alt + 3 |
Tiled (4 corners) | Ctrl + B , then Alt + 4 |
Custom layout | Ctrl + B , then Alt + 5 |
#!/bin/bash
tmux new-session -d -s dev
tmux split-window -h
tmux send-keys -t 0 'htop' C-m
tmux send-keys -t 1 'docker ps' C-m
tmux attach-session -t dev
Use Tmuxinator or Teamocil for YAML-based tmux project layouts.
# Vi-style keys
setw -g mode-keys vi
# Reload config with prefix + r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
This combo ensures your SSH sessions are fast, stable, and tmux survives disconnections.
~/.ssh/config
Host your-server.com
HostName your-server.com
User your_username
ControlMaster auto
ControlPath ~/.ssh/cm-%r@%h:%p
ControlPersist 10m
ssh your-server.com
Now tmux will stay up, even if SSH disconnects. Reconnect anytime and pick up where you left off.
tpm
(tmux plugin manager)git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
~/.tmux.conf
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
run '~/.tmux/plugins/tpm/tpm'
Ctrl + B
, then :
→ source-file ~/.tmux.conf
Ctrl + B
, then I
(capital i)set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'
Ctrl + B
, then Ctrl + S
Ctrl + B
, then Ctrl + R
Crafted with ❤️ by Sreeju — for terminal pros who live on the edge.