Tmux Cheatsheet โ Essential Commands
Tmux (terminal multiplexer) is a powerful tool that allows you to run multiple terminal sessions, windows, and panes inside a single terminal window. It lets you detach from a session (leaving it running in the background) and reattach later, making it indispensable for remote servers, long-running processes, and efficient local development. All commands inside tmux are triggered by a prefix key โ by default, that is Ctrl + b (hold Ctrl, press b, then release both). This cheatsheet covers everything from starting a session to managing panes, windows, and copy mode.
1. Session Management (Run Outside Tmux)
Use these commands in your regular terminal (not inside tmux) to start, list, or kill sessions.
| Command | Description |
|---|---|
tmux new -s <name> |
Create a new session with a given name (e.g., tmux new -s dev). |
tmux ls |
List all running tmux sessions. |
tmux a -t <name> |
Attach to an existing session (e.g., tmux a -t dev). |
tmux kill-session -t <name> |
Kill/close a specific session. |
tmux kill-server |
Kill all tmux sessions and stop the tmux server entirely. |
2. Session Commands (Inside Tmux with Prefix)
These commands are used inside tmux, always prefixed with Ctrl + b.
| Command | Description |
|---|---|
Prefix + d |
Detach from the session (leave it running in the background). |
Prefix + s |
List all sessions interactively (navigate with arrows and press Enter). |
Prefix + $ |
Rename the current session. |
Prefix + ( |
Switch to the previous session. |
Prefix + ) |
Switch to the next session. |
Prefix + L |
Switch back to the last session you were in (capital 'L'). |
3. Window Management (Tabs)
Windows act like tabs inside a session.
| Command | Description |
|---|---|
Prefix + c |
Create a new window. |
Prefix + , |
Rename the current window. |
Prefix + n |
Go to the next window. |
Prefix + p |
Go to the previous window. |
Prefix + 0-9 |
Jump directly to window number 0 through 9. |
Prefix + w |
List all windows in a tree view (interactive selection). |
Prefix + & |
Kill (close) the current window (confirm with 'y'). |
Prefix + f |
Find a window by its name (search). |
4. Pane Management (Splits)
Panes split a single window into multiple terminal areas.
| Command | Description |
|---|---|
Prefix + " |
Split pane horizontally (top/bottom). |
Prefix + % |
Split pane vertically (left/right). |
Prefix + o |
Jump to the next pane in cyclic order. |
Prefix + ; |
Toggle back to the last active pane. |
Prefix + (Arrow Keys) |
Move to the pane in that direction (โ/โ/โ/โ). |
Prefix + q |
Show pane numbers (type the number to jump to that pane instantly). |
Prefix + z |
Zoom the current pane to full screen (press again to unzoom). |
Prefix + { |
Swap the current pane with the one to the left. |
Prefix + } |
Swap the current pane with the one to the right. |
Prefix + Space |
Cycle through different pane layouts (tiled, horizontal, vertical, etc.). |
Prefix + x |
Kill (close) the current pane (confirm with 'y'). |
Prefix + ! |
Convert the current pane into its own separate window. |
Ctrl + d |
(Type this inside the pane) Exit the shell and close the pane โ fastest method. |
5. Resizing Panes
Hold Prefix + Ctrl while pressing an arrow key to resize.
| Command | Description |
|---|---|
Prefix + Ctrl + โ |
Increase pane size upwards. |
Prefix + Ctrl + โ |
Decrease pane size downwards. |
Prefix + Ctrl + โ |
Increase pane size to the left. |
Prefix + Ctrl + โ |
Decrease pane size to the right. |
6. Copy Mode (Scrolling & Copying)
Tmux disables mouse scrolling by default. Use copy mode to navigate history and copy text.
| Command | Description |
|---|---|
Prefix + [ |
Enter Copy Mode (uses Vim/Emacs keybindings). |
(In Copy Mode) โ / โ |
Scroll up/down line by line. |
(In Copy Mode) Page Up / Page Down |
Scroll by pages. |
(In Copy Mode) Space |
Start highlighting text. |
(In Copy Mode) Enter |
Copy the highlighted text. |
Prefix + ] |
Paste the copied text. |
Prefix + Page Up |
Directly enter Copy Mode and scroll up (handy shortcut). |
7. Quick Reference Cheat Sheet
Ctrl+bโ Everything starts here.dโ Detach.cโ New window (tab).n/pโ Next / Previous window."โ Split horizontal.%โ Split vertical.zโ Zoom pane.[โ Enter scroll/copy mode.
8. Pro Tips & Configuration
Reload configuration without restarting tmux: