tmux Cheat Sheet

tmux reference with sessions, windows, panes, copy mode, and terminal multiplexing commands. Essential for remote development.

45 entries 6 sections

Sessions

Syntax Description Example
Create a named session tmux new -s dev
List all sessions tmux ls → dev: 1 windows
Attach to a session tmux attach -t dev (or tmux a -t dev)
Kill a session tmux kill-session -t dev
Detach from session Ctrl+b then d → detach
Rename current session Ctrl+b then $ → enter new name
Switch between sessions Ctrl+b then s → session list
Switch to previous session Ctrl+b then ( → previous session
Switch to next session Ctrl+b then ) → next session
Kill all sessions and tmux tmux kill-server → terminate everything

Windows

Syntax Description Example
Create new window Ctrl+b then c → new window
Rename current window Ctrl+b then , → enter new name
Next / previous window Ctrl+b then n → next window
Switch to window by number Ctrl+b then 2 → go to window 2
List and choose window Ctrl+b then w → interactive list
Kill current window Ctrl+b then & → confirm kill
Toggle last active window Ctrl+b then l → switch back
Find window by name Ctrl+b then f → search

Panes

Syntax Description Example
Split pane vertically Ctrl+b then % → side by side
Split pane horizontally Ctrl+b then " → top and bottom
Navigate between panes Ctrl+b then → → move to right pane
Cycle through panes Ctrl+b then o → next pane
Kill current pane Ctrl+b then x → confirm close
Toggle pane zoom (fullscreen) Ctrl+b then z → zoom/unzoom
Move pane left Ctrl+b then { → swap left
Move pane right Ctrl+b then } → swap right
Show pane numbers Ctrl+b then q → press number to switch
Cycle pane layouts Ctrl+b then Space → toggle layout
Break pane into new window Ctrl+b then ! → pane becomes window

Resizing

Syntax Description Example
Resize pane in direction Ctrl+b then Ctrl+→ → grow right
Resize pane by 5 cells Ctrl+b then Alt+↑ → grow up by 5
Resize by n cells :resize-pane -R 10 → grow right 10

Copy Mode

Syntax Description Example
Enter copy/scroll mode Ctrl+b then [ → scroll with arrows/PgUp
Exit copy mode q → return to normal mode
Start selection Space → begin highlighting text
Copy selection Enter → copy highlighted text
Paste from buffer Ctrl+b then ] → paste copied text
Search forward / backward / → type search term, Enter

Commands

Syntax Description Example
Enter command mode Ctrl+b then : → type command
Reload tmux config Prefix + : → source-file ~/.tmux.conf
Type in all panes simultaneously :setw synchronize-panes on
Swap window position :swap-window -t 0 → move to position 0
Join pane to another window :join-pane -t dev:1
List all key bindings Ctrl+b then ? → show all shortcuts
Show clock Ctrl+b then t → display time

Frequently asked questions

What is tmux and why should I use it?

tmux (terminal multiplexer) lets you create multiple terminal sessions within one window, split panes, and detach/reattach sessions. Key benefits: your work persists when you disconnect (SSH), you can organize terminals into logical groups, and you can share sessions for pair programming.

What's the difference between tmux and GNU Screen?

Both are terminal multiplexers. tmux has a more modern codebase, better scripting API, true split-pane support, and is more actively developed. Screen is older but still widely available. tmux is generally recommended for new users.

How do I customize tmux?

Edit ~/.tmux.conf. Common customizations: change prefix key, enable mouse, set vi mode, customize status bar colors, add plugins via TPM (tmux plugin manager). Reload with 'tmux source-file ~/.tmux.conf' or Prefix + : source-file ~/.tmux.conf.

How do I scroll up in tmux?

Enter copy mode with Prefix + [ (Ctrl+b then [), then use arrow keys, PgUp/PgDn, or vi keys (if enabled) to scroll. Press q to exit. With mouse mode enabled, you can also scroll with your mouse wheel.

How do I copy text in tmux?

Enter copy mode (Prefix + [), navigate to start, press Space to begin selection, move to end, press Enter to copy. Paste with Prefix + ]. With vi mode: use v for selection, y to yank. For system clipboard integration, install xclip and add a keybinding.

What are the best tmux plugins?

Essential plugins: tmux-resurrect (session persistence), tmux-continuum (auto-save), tmux-sensible (sane defaults), tmux-yank (system clipboard), tmux-pain-control (better pane management). Install via TPM: git clone tpm, add plugins to .tmux.conf, Prefix + I to install.

Go from reference to real skills

Cheat sheets are great for quick lookups. Our in-depth courses take you from the fundamentals to professional-level mastery.

Browse all courses