tmux Cheat Sheet

Essential commands for terminal multiplexing

Prefix Key: Ctrl+b Press prefix key, release, then press command key

Session Management

Command Description
tmux Start a new tmux session
tmux new -s <name> Start a new session with specific name
tmux ls List all active sessions
tmux attach -t <name> Attach to a named session
Prefix + d Detach from current session
Prefix + $ Rename current session
Prefix + ( Switch to previous session
Prefix + ) Switch to next session
Prefix + s List all sessions in interactive menu

Window Management

Windows are like tabs in a terminal

Command Description
Prefix + c Create a new window
Prefix + p Navigate to previous window
Prefix + n Navigate to next window
Prefix + <number> Navigate to window by number (0, 1, 2...)
Prefix + w List all windows in interactive menu
Prefix + , Rename current window
Prefix + & Kill current window
Prefix + f Find window by name or content
Prefix + l Switch to last (previously) active window

Pane Management

Split windows into multiple terminals

Command Description
Prefix + " Split pane horizontally (top/bottom)
Prefix + % Split pane vertically (left/right)
Prefix + <arrow> Navigate between panes with arrow keys
Prefix + o Cycle through panes
Prefix + z Toggle pane zoom (fullscreen)
Prefix + x Kill current pane
Prefix + { Move pane to the left
Prefix + } Move pane to the right
Prefix + Space Cycle through pane layouts
Prefix + Hold <arrow> Resize pane in arrow direction
Prefix + ; Toggle focus to previously active pane
Prefix + q Display pane numbers (press number to switch)

Copy Mode

Scroll and copy text from terminal history

Command Description
Prefix + [ Enter copy mode (scroll with arrows/PageUp/PageDown)
q Exit copy mode
Space Start text selection (in copy mode)
Enter Copy selected text to tmux buffer
Prefix + ] Paste tmux buffer contents

Troubleshooting

When prefix key doesn't work

Solution Description
Click with mouse Click on pane to switch focus (requires mouse mode)
set -g mouse on Add to ~/.tmux.conf to enable mouse support
Prefix + Prefix + cmd For nested sessions, press prefix twice