- Docs
- Commands
Essential Commands
Search the full tmux command reference — every command with examples, options, and keybindings. Default prefix is Ctrl+b. New to tmux? Start with core concepts to understand the fundamentals.
Showing 40 of 40 commands
Session Management
new-session
⌘+:new (command mode)Short: new
Create a new session. If run from inside tmux, the new session is created but not attached. The new session is grouped with the session specified by -t if given, sharing windows and the current window.
attach-session
N/A (run from shell)Short: attach, a
Attach to an existing session. If no session is specified, attach to the most recently used session. If no sessions exist, an error is reported.
detach-client
⌘+dShort: detach
Detach the current client or the client specified by -t from its session. The session continues running in the background.
kill-session
⌘+: kill-session (command mode)Destroy the given session, closing any windows linked to it and no other sessions, and detaching all clients attached to it.
list-sessions
⌘+s (session list)Short: ls
List all sessions. Each session is shown with its name, number of windows, size, and whether it is attached.
rename-session
⌘+$Short: rename
Rename the session specified by -t, or the current session if -t is not given.
switch-client
⌘+( or ) for prev/next, Prefix + s for pickerShort: switchc
Switch the current client to a different session.
Window Management
new-window
⌘+cShort: neww
Create a new window. If -t is given, the new window is created at the specified index. If a shell-command is given, it is executed in the new window.
select-window
⌘+0-9, Prefix + n/p, Prefix + lShort: selectw
Select a window. The window becomes the current window in its session.
rename-window
⌘+,Short: renamew
Rename the current window, or the window specified by -t.
kill-window
⌘+&Short: killw
Kill the current window or the window specified by -t, and all panes within it.
list-windows
⌘+w (interactive)Short: lsw
List windows in a session. With -a, list all windows in all sessions.
choose-tree
⌘+s (sessions), Prefix + w (windows)Open an interactive tree of sessions, windows, and panes to preview and choose one. This is the picker behind the default Prefix + s (sessions) and Prefix + w (windows) bindings.
swap-window
N/A (bind to a key)Short: swapw
Swap two windows so they exchange positions. With -d the active window is not changed to follow the move.
move-window
N/A (e.g. bind . command-prompt 'move-window -t %%')Short: movew
Move a window to a new index, optionally in another session. With -r, renumber all windows in the session to remove gaps in the indexes.
respawn-window
N/AShort: respawnw
Reuse a window to run a command, restarting it in place. Useful for windows whose command exited when remain-on-exit is on.
Pane Management
split-window
⌘+% (horizontal), Prefix + " (vertical)Short: splitw
Create a new pane by splitting the current pane. The -h flag splits horizontally (creates panes side by side), and -v splits vertically (creates panes above/below).
select-pane
⌘+arrow keys, or Prefix + o to cycleShort: selectp
Select a pane. Various flags allow selecting panes by direction or marking them.
resize-pane
⌘+Ctrl+arrow, Prefix + z (zoom)Short: resizep
Resize a pane, either by a specified amount or to an absolute size.
kill-pane
⌘+xShort: killp
Destroy the current pane or the pane specified by -t.
swap-pane
⌘+{ or } to swapShort: swapp
Swap two panes. If -U is given, swap with the previous pane; if -D, swap with the next pane.
respawn-pane
N/AShort: respawnp
Reuse a pane to run a command, restarting it in place without changing the layout. Handy for re-running a dead or crashed pane.
Copy Mode
copy-mode
⌘+[Enter copy mode. In copy mode, you can scroll through history, search, and copy text. The mode-keys option controls whether vi or emacs keybindings are used.
paste-buffer
⌘+]Short: pasteb
Insert the contents of a paste buffer into the specified pane.
capture-pane
N/A (used in scripts)Short: capturep
Capture the contents of a pane into a paste buffer, or print them to stdout with -p. Useful for scripting, logging, or saving scrollback to a file.
clear-history
Often bound, e.g. bind C-k clear-historyShort: clearhist
Remove and free the scrollback history for a pane. Reclaims memory used by long-running panes with large buffers.
Miscellaneous
source-file
Often bound to ⌘+r in configsShort: source
Execute commands from a file. This is typically used to reload the tmux configuration.
display-message
N/AShort: display
Display a message in the status line. If no message is given, display information about the current pane.
set-option
⌘+: (then type command)Short: set
Set a session, window, or server option. Without -g, the option is set for the current session.
send-keys
N/A (used in scripts)Short: send
Send keys to a pane. This is useful for scripting tmux to automate commands.
list-keys
⌘+?Short: lsk
List all key bindings. Shows the key tables (prefix, root, copy-mode, etc.) and their bindings.
bind-key
N/A (configuration command)Short: bind
Bind a key to a command. The key is bound in the prefix table by default.
display-popup
⌘+: display-popup (or bind a key)Short: popup
Open a temporary popup terminal floating above the current client, running a command (a shell by default). Great for quick tools without disturbing your layout.
display-menu
N/A (bind to a key)Short: menu
Display an interactive menu at the given position. Each item has a display name, a shortcut key, and a tmux command to run when chosen.
pipe-pane
Often bound, e.g. bind P pipe-pane -o 'cat >>~/#W.log'Short: pipep
Pipe a pane's output to a shell command for live logging. With no command, any existing pipe is stopped.
set-hook
N/A (configuration command)Set (or unset) a hook that runs a tmux command automatically when an event occurs, such as a session being created or a window being linked. Flags mirror set-option.
if-shell
N/A (configuration command)Short: if
Run the first command if shell-command succeeds, otherwise the optional second command. With -F, no shell runs and the condition is a format that is true unless empty or zero.
run-shell
N/AShort: run
Run a shell command (or, with -C, a tmux command) and show its output in the message line or a popup. Used heavily by plugins.
Server
server-access
N/AManage the access-control list for the tmux socket, so other users can attach read-only or read-write. The server's owner and root always have access. File-system permissions on the socket must still be set manually.
kill-server
N/AKill the tmux server and all clients and sessions. This is a complete shutdown of tmux.
🎨 Customize Prefix Key
The prefix key is the command that tells tmux "hey, listen to the next keypress". By default, it's Ctrl + b. Learn more about customizing this and other settings in the Configuration guide.
# Add to ~/.tmux.conf
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix