Skip to main content

Overview

Windows are the primary containers within a tmux session. Each session has one or more windows, and windows may be linked to multiple sessions. Windows are made up of one or more panes.

new-window

Alias: neww
new-window [-abdkPS] [-c start-directory] [-e environment] [-F format] 
           [-n window-name] [-t target-window] [shell-command [argument ...]]
Create a new window.
-a
flag
Insert the new window at the next index after the specified target-window, moving windows up if necessary.
-b
flag
Insert the new window at the next index before the specified target-window.
-d
flag
Do not make the new window the current window.
-k
flag
If the target window exists, destroy it before creating the new window.
-P
flag
Print information about the new window after it has been created. Default format is #{session_name}:#{window_index} but can be changed with -F.
-S
flag
Set synchronized-panes on for the new window.
-c
string
Specify the working directory for the new window.
-e
string
Set an environment variable for the new window in the form VARIABLE=value. May be specified multiple times.
-F
string
Format for output when -P is used.
-n
string
Name for the new window.
-t
string
The target window position. If it doesn’t exist, the new window is created at the next free index.
shell-command
string
Shell command to execute in the new window. If not specified, the default command is used.

kill-window

Alias: killw
kill-window [-a] [-t target-window]
Destroy the given window.
-a
flag
Kill all windows except the specified one.
-t
string
The target window to destroy.

select-window

Alias: selectw
select-window [-lnpT] [-t target-window]
Select a window. Makes the window the current window in the session.
-l
flag
Select the last (previously selected) window.
-n
flag
Select the next window.
-p
flag
Select the previous window.
-T
flag
If the window is already the current window, select the last window.
-t
string
The target window to select.

list-windows

Alias: lsw
list-windows [-a] [-r] [-F format] [-f filter] [-O sort-order] [-t target-session]
List windows. By default, lists windows in the current session.
-a
flag
List all windows across all sessions.
-r
flag
Reverse the sort order.
-F
string
Specify the format of each line.
-f
string
Only show windows for which the filter is true.
-O
string
Specify sort order: index, name, creation (time), or activity (time).
-t
string
List windows in the target session.

rename-window

Alias: renamew
rename-window [-t target-window] new-name
Rename the window to new-name.
-t
string
The target window to rename.
new-name
string
required
The new name for the window.

move-window

Alias: movew
move-window [-abdkr] [-s src-window] [-t dst-window]
Move or link a window to another location.
-a
flag
Move the window to the next index after dst-window.
-b
flag
Move the window to the next index before dst-window.
-d
flag
Do not make the moved window the current window.
-k
flag
If dst-window exists, destroy it before moving or linking.
-r
flag
Renumber windows in the session in sequential order.
-s
string
The source window to move.
-t
string
The destination window position.
Alias: linkw
link-window [-abdk] [-s src-window] [-t dst-window]
Link a window from one session into another. Links create a window that appears in multiple sessions.
-a
flag
Link the window at the next index after dst-window.
-b
flag
Link the window at the next index before dst-window.
-d
flag
Do not make the linked window the current window.
-k
flag
If dst-window exists, destroy it before linking.
-s
string
The source window to link.
-t
string
The destination window position.
Alias: unlinkw
unlink-window [-k] [-t target-window]
Unlink a window from the current session. If the window is only linked to one session, it is destroyed.
-k
flag
Kill the window if it is only present in one session.
-t
string
The target window to unlink.

swap-window

Alias: swapw
swap-window [-d] [-s src-window] [-t dst-window]
Swap two windows.
-d
flag
Do not make the swapped window the current window.
-s
string
The source window.
-t
string
The destination window.

rotate-window

Alias: rotatew
rotate-window [-DUZ] [-t target-window]
Rotate the panes in the window. All panes are moved around one position.
-D
flag
Rotate downward (the last pane becomes the first).
-U
flag
Rotate upward (the first pane becomes the last).
-Z
flag
Keep the window zoomed if it was zoomed.
-t
string
The target window.

respawn-window

Alias: respawnw
respawn-window [-c start-directory] [-e environment] [-k] [-t target-window] 
               [shell-command [argument ...]]
Reactivate a window where the command has exited.
-c
string
Specify the working directory for the command.
-e
string
Set an environment variable in the form VARIABLE=value. May be specified multiple times.
-k
flag
Kill the existing command if it is still running.
-t
string
The target window to respawn.
shell-command
string
Shell command to execute. If not specified, the command used when the window was created is reused.

find-window

Alias: findw
find-window [-iCNrTZ] [-t target-pane] match-string
Search for windows with names, titles, or visible content matching match-string.
-i
flag
Ignore case when matching.
-C
flag
Match only visible window contents.
-N
flag
Match only window names.
-r
flag
Match match-string as a regular expression.
-T
flag
Match only window titles.
-Z
flag
Zoom the pane.
-t
string
The target pane for displaying results.
match-string
string
required
The string or pattern to search for.

last-window

Alias: last
last-window [-t target-session]
Select the last (previously selected) window.
-t
string
The target session.

next-window

Alias: next
next-window [-a] [-t target-session]
Select the next window in the session.
-a
flag
Move to the next window with an alert (bell, activity, or silence).
-t
string
The target session.

previous-window

Alias: prev
previous-window [-a] [-t target-session]
Select the previous window in the session.
-a
flag
Move to the previous window with an alert.
-t
string
The target session.

Build docs developers (and LLMs) love