This is a quick reference for the most common tmux commands. Remember to press the prefix key combination (Ctrl+b by default) before pressing the command key.
| Action | Command (after Ctrl+b) |
Description |
|---|---|---|
| Session Management | ||
| Detach from session | d |
Detach from the current session, leaving it running. |
| List sessions | s |
Show a list of all sessions to switch between them. |
| Rename current session | $ |
Give the current session a new name. |
| Window Management | ||
| Create a new window | c |
Create a new window (like a new tab). |
| Next window | n |
Switch to the next window. |
| Previous window | p |
Switch to the previous window. |
| Go to a specific window | 0-9 |
Switch to a window by its number (e.g., Ctrl+b 1). |
| Rename current window | , |
Rename the current window. |
| Close current window | & |
Close the current window (will ask for confirmation). |
| Pane Management | ||
| Split pane vertically | % |
Split the current pane into two, side-by-side. |
| Split pane horizontally | " |
Split the current pane into two, one above the other. |
| Switch between panes | Arrow keys |
Move between panes using the arrow keys. |
| Close current pane | x |
Close the current pane (will ask for confirmation). |
| Toggle pane zoom | z |
Zoom in on the current pane to fill the window. |
| Swap panes | o |
Cycle through the panes in the current window. |
| Command | Description |
|---|---|
tmux ls |
List all running tmux sessions. |
tmux a or tmux attach |
Attach to the most recently used session. |
tmux a -t <session_name> |
Attach to a specific session by its name. |