Tmux Commands¶
This pae goes through tmux commands and its arguments. Most of these notes come
from man tmux
To see all commands in a nice little table, check out the Table of Commands.
The options aren't explained there like they are in the list, but it's easier to look at.
Tmux Basics¶
Usage¶
command [flags]- This specifies one of a set of commands to send to tmux.
- If no commands are given,
new-sessionis assumed.
Most important options:
-f file: Specify the config file to use.-s session-name: Specify the name of a new session.-t session-name: Specify the name of an existing session
Usage Examples¶
tmux new -s session1 # Create and attach a new session named "session1"
tmux a -t session1 # Attach to and existing session named "session1"
tmux new -s session1 -d # Create and new session named "session1" and detach
tmux kill-session -t session1 # Kill the session named "session1"
List of Options¶
When launching tmux from the command line, you can specify the following options:
-2- Force tmux to assume the terminal supports 256 colours. Equivalent to
-T 256
- Force tmux to assume the terminal supports 256 colours. Equivalent to
-C- Start in control mode (see
man://tmux 2933). - Given twice (
-CC) disablesecho.
- Start in control mode (see
-
-c shell-command- Execute
shell-commandusing the default shell.
- Execute
-
-D- Do not start the tmux server as a daemon.
- This also turns the
exit-emptyoption off. - With
-D,commandmay not be specified.
-
-f file- Specify an alternative configuration file.
- By default, tmux loads the system configuration file from
/etc/tmux.conf, if present - Then it looks for a user configuration file at
~/.tmux.conf.
-
-L socket-name- tmux stores the server socket in a directory under
TMUX_TMPDIR(defaults to/tmp). - The default socket is named
default. - Allows a different socket name to be specified, allowing several independent
tmux servers to be run.
- tmux stores the server socket in a directory under
-
-l- Behave as a login shell.
- Currently has no effect. Exists for compatibility with other shells when using tmux as a login shell.
-
-N- Do not start the server even if the command would normally do so.
- E.g., with
new-sessionorstart-server.
-
-S socket-path- Specify a full alternative path to the server socket.
- If
-Sis specified, the default socket directory is not used and any-Lflag is ignored.
-
-u- Force output to be
UTF-8in the terminal. IgnoresLC_ALL,LC_CTYPE, orLANG. - Equivalent to
-T UTF-8.
- Force output to be
-
-T features- Set terminal features for the client as a comma-separated list of features.
- Equivalent to setting
terminal-featuresin tmux config.
-
-v- Verbose logging.
-
Log messages are saved into
tmux-client-PID.logandtmux-server-PID.logfiles
in the current directory.PIDis thePIDof the server or client process.- If
-vis specified twice, an additionaltmux-out-PID.logfile is generated with
a copy of everything tmux writes to the terminal.
- If
-
-V- Output the tmux version.
Useful Commands Quickref¶
Note: -t is usually target.
| Command | Alias | Effect |
|---|---|---|
list-panes [-ast] |
lsp |
-a: List all panes on server. -s: List panes for a session |
list-windows [-afFt] |
lsw |
-a: List all windows on server. -F: Format for each line. -f: Filter. |
List of tmux Commands and their Options/Argumnents¶
tmux list-commands
-
attach-session(attach)- -t: Target session
- -d: Detach other clients
-
bind-key(bind)- -T: Key table
- -n: No prefix key required
-
break-pane(breakp)- -d: Leave pane in detached state
- -n: New window name
-
capture-pane(capturep)- -S: Start line
- -E: End line
-
choose-buffer -
choose-client -
choose-session -
choose-tree -
choose-window -
clear-history(clearhist) -
clock-mode -
command-prompt -
confirm-before(confirm)-p: Prompt message
-
copy-mode-u: Scroll one page up
-
copy-pipe- command: Shell command to pipe to
-
delete-buffer(deleteb)-b: Buffer index
-
display-menu (menu) [-O] [-c target-client] [-t target-pane] [-T title] [-x position] [-y position] name key command ... -
detach-client(detach)-s: Target session-a: All but current client
-
display-message-c: Target client-p: Print message to stdout
-
display-panes -
find-window-N: Search window names-C: Search window contents
-
has-session-t: Target session
-
if-shell- shell-command: Shell command to execute
- tmux-command: Tmux command to run if shell-command succeeds
-
join-pane-h: Join horizontally-v: Join vertically
-
kill-pane-t: Target pane
-
kill-server -
kill-session-t: Target session
-
kill-window-t: Target window
-
last-pane -
last-window -
link-window-s: Source window-t: Target window
-
list-buffers -
list-clients -
list-commands -
list-keys -
list-panes -
list-sessions-F: Format
-
list-windows -
load-buffer-b: Buffer name- path: File path
-
lock-client-t: Target client
-
lock-server(lock) -
lock-session-t: Target session
-
move-pane-t: Target window
-
move-window-t: Target session-s: Source window
-
new-session-s: Session name-n: Window name-c: Start directory-d: Detached session
-
new-window-n: Window name-c: Start directory-d: Detached window
-
next-layout -
next-window -
paste-buffer-b: Buffer index-t: Target pane
-
pipe-pane-o: Only pipe new output- command: Shell command to pipe to
-
previous-layout -
previous-window -
refresh-client-S: Save layout
-
rename-session- new-name: New session name
-
rename-window- new-name: New window name
-
resize-pane-U: Resize up-D: Resize down-L: Resize left-R: Resize right
-
resize-window-U: Resize up-D: Resize down-L: Resize left-R: Resize right
-
respawn-pane-k: Kill existing pane- command: Command to execute
-
respawn-window-k: Kill existing window- command: Command to execute
-
rotate-window-D: Rotate down-U: Rotate up
-
run-shell(run)command: Shell command to execute
-
save-buffer-b: Buffer indexpath: File path
-
select-layoutlayout-name: Name of the layout
-
select-pane-U: Up-D: Down-L: Left-R: Right-mand-M: Set and clear themarked pane.- There is one marked pane at a time.
- Setting a new one clears the last.
- The marked pane is the default target for
-sto:join-panemove-paneswap-paneswap-window
-
select-window-t: Target window
-
send-keys-t: Target pane-l: Literal string-R: Clear pane's input buffer
-
send-prefix -
set-buffer-b: Buffer indexdata: Data to set
-
set-environment-g: Global variable-u: Unset variable
-
set-hook- hook-name: Name of the hook
- command: Command to run
-
set-option-g: Global option-w: Window option-s: Server option
-
set-window-optionoption: Window optionvalue: Value to set
-
show-buffer-b: Buffer index
-
show-environment-g: Show global variables
-
show-hooks -
show-messages -
show-options-g: Global options-w: Window options-s: Server options
-
show-window-options -
source-filefile: File to source
-
split-window-h: Horizontal split-v: Vertical split-c: Start directory
-
start-server -
suspend-client-t: Target client
-
swap-pane-s: Source pane-t: Target pane
-
swap-window-s: Source window-t: Target window
-
switch-client-n: Next session-p: Previous session-t: Target session
-
unbind-key-T: Key table
-
unlink-window-k: Kill window if becomes detached
-
wait-for- channel: Channel to wait for
Table of tmux list-commands Output¶
This table does not explain what each option does, but it is exhaustive.
| Command | Shorthand | Options |
|---|---|---|
tmux attach-session |
attach |
[-dErx] [-c working-directory] [-f flags] [-t target-session] |
tmux bind-key |
bind |
[-nr] [-T key-table] [-N note] key [command [arguments]] |
tmux break-pane |
breakp |
[-abdP] [-F format] [-n window-name] [-s src-pane] [-t dst-window] |
tmux capture-pane |
capturep |
[-aCeJNpPq] [-b buffer-name] [-E end-line] [-S start-line] [-t target-pane] |
tmux choose-buffer |
[-NrZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template] |
|
tmux choose-client |
[-NrZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template] |
|
tmux choose-tree |
[-GNrswZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template] |
|
tmux clear-history |
clearhist |
[-t target-pane] |
tmux clock-mode |
[-t target-pane] |
|
tmux command-prompt |
[-1kiNTW] [-I inputs] [-p prompts] [-t target-client] [template] |
|
tmux confirm-before |
confirm |
[-p prompt] [-t target-client] command |
tmux copy-mode |
[-eHMuq] [-s src-pane] [-t target-pane] |
|
tmux customize-mode |
[-NZ] [-F format] [-f filter] [-t target-pane] |
|
tmux delete-buffer |
deleteb |
[-b buffer-name] |
tmux detach-client |
detach |
[-aP] [-E shell-command] [-s target-session] [-t target-client] |
tmux display-menu |
menu |
[-O] [-c target-client] [-t target-pane] [-T title] [-x position] [-y position] name key command ... |
tmux display-message |
display |
[-aINpv] [-c target-client] [-d delay] [-F format] [-t target-pane] [message] |
tmux display-popup |
popup |
[-CE] [-c target-client] [-d start-directory] [-h height] [-t target-pane] [-w width] [-x position] [-y position] [command] |
tmux display-panes |
displayp |
[-bN] [-d duration] [-t target-client] [template] |
tmux find-window |
findw |
[-CiNrTZ] [-t target-pane] match-string |
tmux has-session |
has |
[-t target-session] |
tmux if-shell |
if |
[-bF] [-t target-pane] shell-command command [command] |
tmux join-pane |
joinp |
[-bdfhv] [-l size] [-s src-pane] [-t dst-pane] |
tmux kill-pane |
killp |
[-a] [-t target-pane] |
tmux kill-server |
||
tmux kill-session |
[-aC] [-t target-session] |
|
tmux kill-window |
killw |
[-a] [-t target-window] |
tmux last-pane |
lastp |
[-deZ] [-t target-window] |
tmux last-window |
last |
[-t target-session] |
tmux link-window |
linkw |
[-abdk] [-s src-window] [-t dst-window] |
tmux list-buffers |
lsb |
[-F format] [-f filter] |
tmux list-clients |
lsc |
[-F format] [-t target-session] |
tmux list-commands |
lscm |
[-F format] [command] |
tmux list-keys |
lsk |
[-1aN] [-P prefix-string] [-T key-table] [key] |
tmux list-panes |
lsp |
[-as] [-F format] [-f filter] [-t target-window] |
tmux list-sessions |
ls |
[-F format] [-f filter] |
tmux list-windows |
lsw |
[-a] [-F format] [-f filter] [-t target-session] |
tmux load-buffer |
loadb |
[-b buffer-name] [-t target-client] path |
tmux lock-client |
lockc |
[-t target-client] |
tmux lock-server |
lock |
|
tmux lock-session |
locks |
[-t target-session] |
tmux move-pane |
movep |
[-bdfhv] [-l size] [-s src-pane] [-t dst-pane] |
tmux move-window |
movew |
[-abdkr] [-s src-window] [-t dst-window] |
tmux new-session |
new |
[-AdDEPX] [-c start-directory] [-e environment] [-F format] [-f flags] [-n window-name] [-s session-name] [-t target-session] [-x width] [-y height] [command] |
tmux new-window |
neww |
[-abdkPS] [-c start-directory] [-e environment] [-F format] [-n window-name] [-t target-window] [command] |
tmux next-layout |
nextl |
[-t target-window] |
tmux next-window |
next |
[-a] [-t target-session] |
tmux paste-buffer |
pasteb |
[-dpr] [-s separator] [-b buffer-name] [-t target-pane] |
tmux pipe-pane |
pipep |
[-IOo] [-t target-pane] [command] |
tmux previous-layout |
prevl |
[-t target-window] |
tmux previous-window |
prev |
[-a] [-t target-session] |
tmux refresh-client |
refresh |
[-cDlLRSU] [-A pane:state] [-B name:what:format] [-C XxY] [-f flags] [-t target-client] [adjustment] |
tmux rename-session |
rename |
[-t target-session] new-name |
tmux rename-window |
renamew |
[-t target-window] new-name |
tmux resize-pane |
resizep |
[-DLMRTUZ] [-x width] [-y height] [-t target-pane] [adjustment] |
tmux resize-window |
resizew |
[-aADLRU] [-x width] [-y height] [-t target-window] [adjustment] |
tmux respawn-pane |
respawnp |
[-k] [-c start-directory] [-e environment] [-t target-pane] [command] |
tmux respawn-window |
respawnw |
[-k] [-c start-directory] [-e environment] [-t target-window] [command] |
tmux rotate-window |
rotatew |
[-DUZ] [-t target-window] |
tmux run-shell |
run |
[-bC] [-d delay] [-t target-pane] [shell-command] |
tmux save-buffer |
saveb |
[-a] [-b buffer-name] path |
tmux select-layout |
selectl |
[-Enop] [-t target-pane] [layout-name] |
tmux select-pane |
selectp |
[-DdeLlMmRUZ] [-T title] [-t target-pane] |
tmux select-window |
selectw |
[-lnpT] [-t target-window] |
tmux send-keys |
send |
[-FHlMRX] [-N repeat-count] [-t target-pane] key ... |
tmux send-prefix |
[-2] [-t target-pane] |
|
tmux set-buffer |
setb |
[-aw] [-b buffer-name] [-n new-buffer-name] [-t target-client] data |
tmux set-environment |
setenv |
[-Fhgru] [-t target-session] name [value] |
tmux set-hook |
[-agpRuw] [-t target-pane] hook [command] |
|
tmux set-option |
set |
[-aFgopqsuUw] [-t target-pane] option [value] |
tmux set-window |
setw |
-option [-aFgoqu] [-t target-window] option [value] |
tmux show-buffer |
showb |
[-b buffer-name] |
tmux show-environment |
showenv |
[-hgs] [-t target-session] [name] |
tmux show-hooks |
[-gpw] [-t target-pane] |
|
tmux show-messages |
showmsgs |
[-JT] [-t target-client] |
tmux show-options |
show |
[-AgHpqsvw] [-t target-pane] [option] |
tmux show-window |
showw |
-options [-gv] [-t target-window] [option] |
tmux source-file |
source |
[-Fnqv] path ... |
tmux split-window |
splitw |
[-bdefhIPvZ] [-c start-directory] [-e environment] [-F format] [-l size] [-t target-pane] [command] |
tmux start-server |
start |
|
tmux suspend-client |
suspendc |
[-t target-client] |
tmux swap-pane |
swapp |
[-dDUZ] [-s src-pane] [-t dst-pane] |
tmux swap-window |
swapw |
[-d] [-s src-window] [-t dst-window] |
tmux switch-client |
switchc |
[-ElnprZ] [-c target-client] [-t target-session] [-T key-table] |
tmux unbind-key |
unbind |
[-anq] [-T key-table] key |
tmux unlink-window |
unlinkw |
[-k] [-t target-window] |
tmux wait-for |
wait |
[-L\|-S\|-U] channel |