Tmux Commands: Essential Commands & Shortcuts (With Examples)
TL;DR — Start with tmux new -s mysession, list with tmux ls, run any action as tmux <command>, and use the prefix for shortcuts: Ctrl+b ? lists the noted bindings, Ctrl+b d detaches.
How tmux commands are structured
tmux has three entry points, and mixing them up is the main source of confusion:
- Shell commands — typed at your normal prompt as
tmux <command>. They talk to the tmux server and mostly work whether or not you are attached;attach, andnewwhen it would attach, are refused from a shell inside tmux (unset$TMUXto force), and commands that act on a client need one (or an explicit client target). - Key bindings — the prefix (Ctrl+b by default) followed by one key. Each binding simply runs a command: Ctrl+b % runs
split-window -h. - Command mode — Ctrl+b : opens a prompt inside tmux where you type the command name directly, for example
rename-session mysession.
The 30 essential tmux commands
Grouped by what you are trying to do. Every command also accepts the prefix plus : form when you are already inside tmux.
Sessions
| Command | Long name | What it does |
|---|---|---|
| new-session | Creates a named session and attaches this terminal to it. |
| list-sessions | Shows each session with its window count and whether a client is attached. |
| attach-session | Reconnects this terminal to the named session. |
| detach-client | Disconnects the client while the session and its processes keep running. |
| kill-session | Ends the named session and the windows that exist only in it; windows also linked to another session keep running. |
| kill-server | Shuts down the tmux server, which ends all sessions. |
| rename-session | Changes the current session's name. |
Windows
| Command | Long name | What it does |
|---|---|---|
| new-window | Adds a window and gives it a label in the status bar. |
| list-windows | Lists windows in the current session and marks the active one. |
| select-window | Moves focus to a window by index or name. |
| rename-window | Renames the window you are in. |
| kill-window | Closes a window together with its panes. |
| move-window | Moves a window to another index in a session. |
Panes
| Command | Long name | What it does |
|---|---|---|
| split-window | Splits the current window side by side; use -v for top and bottom. |
| select-pane | Focuses the pane to the left; -R, -U and -D cover the other directions. |
| resize-pane | Resizes the current pane ten columns to the right. |
| kill-pane | Closes the current pane and lets the remaining panes reflow. |
| swap-pane | Swaps the current pane with the previous pane by number. |
| break-pane | Turns the current pane into a separate window. |
| join-pane | Brings an existing pane into the current window. |
Copy mode and buffers
| Command | Long name | What it does |
|---|---|---|
| copy-mode | Enters scrollback one page up so you can navigate history. |
| save-buffer | Writes the latest copy buffer to a file. |
| paste-buffer | Pastes the latest buffer into the active pane. |
| capture-pane | Prints a pane's visible contents to stdout. |
Scripting and options
| Command | Long name | What it does |
|---|---|---|
| send-keys | Types text and key names into another pane. |
| list-panes | Lists panes with ids and geometry for scripts. |
| list-keys | Prints every key binding and its command. |
| source-file | Reloads a config file in the running server. |
| set-option | Sets the global session option, which sessions without their own value inherit; use off to disable mouse. |
| show-options | Prints the global session options; use -s for server options and -w for window options. |
Essential tmux key bindings
| Shortcut | Action |
|---|---|
| Ctrl+b c | Create a window |
| Ctrl+b n / p | Next / previous window |
| Ctrl+b 0–9 | Jump to a window by index |
| Ctrl+b w | Pick a window from a list |
| Ctrl+b , | Rename the current window |
| Ctrl+b & | Kill the current window |
| Ctrl+b % | Split side by side |
| Ctrl+b " | Split top and bottom |
| Ctrl+b + arrow | Move between panes |
| Ctrl+b o | Cycle through panes |
| Ctrl+b z | Zoom / unzoom the active pane |
| Ctrl+b q | Show pane numbers |
| Ctrl+b x | Close the active pane |
| Ctrl+b { / } | Swap panes |
| Ctrl+b Space | Next layout |
| Ctrl+b [ | Enter copy mode |
| Ctrl+b ] | Paste the buffer |
| Ctrl+b ? | List the noted key bindings (tmux list-keys shows all) |
| Ctrl+b : | Open the command prompt |
| Ctrl+b d | Detach from the session |
| Ctrl+b $ | Rename the current session |
See the top 10 commands in action
The recording starts at a shell prompt and runs ten of the commands above end to end: create a session, split, select panes, resize, open a second window, detach, list the session with tmux ls, reattach, and clean up.
Frequently asked questions
What is the tmux prefix key?
The prefix is Ctrl+b by default. Press it, release it, then press the command key: Ctrl+b then c creates a window, Ctrl+b then d detaches. The prefix only applies while you are inside tmux; shell commands are typed as tmux <command>.
How do I see all tmux commands?
Run tmux list-commands from a shell to print every server command with its flags. For the noted key bindings, run tmux lsk -N | more from a shell, or press Ctrl+b then ? inside tmux; run tmux list-keys for every binding together with its command.
How do I run a tmux command without the prefix?
Type it as a shell command, for example tmux list-windows or tmux split-window -h. Inside tmux you can also press Ctrl+b then : to open the command prompt and enter the command name there.
What is the difference between a tmux command and a key binding?
A command is the action itself, such as split-window or detach-client. A key binding is a shortcut that runs a command: by default Ctrl+b % runs split-window -h. You can inspect bindings with tmux list-keys.
Which tmux version do these commands target?
This list is verified against tmux 3.8. Check your own version with tmux -V. Older releases lack a few newer commands and flags, so confirm anything unusual against your version.
How do I run a command in another tmux pane?
Address the pane as session:window.pane and use tmux send-keys -t mysession:0.1 "npm test" Enter. Add key names such as Enter after the text so the line actually runs. Read the result back with tmux capture-pane -p -t mysession:0.1.
How do I reload .tmux.conf without restarting tmux?
Run tmux source-file ~/.tmux.conf. The running server reloads the file and keeps every session, window and pane alive. If a line has a syntax error, tmux reports the file and line number and the previous settings stay in effect.
Keep exploring with the tmux cheat sheet and build a starting config with the tmux config generator.