What is tmux?

tmux is a program which runs in a terminal and allows multiple other terminal programs to be run inside it. Each program inside tmux gets its own terminal managed by tmux, which can be accessed from the single terminal where tmux is running - this called multiplexing and tmux is a terminal multiplexer.

What is Sessions, Windows, and Panes

  • Sessions: A session is a container for one or more windows in a terminal multiplexer like tmux or screen.
  • Windows: A window is a single terminal screen within a session, which can run its own shell or process.
  • Panes: A pane is a split view within a window that allows multiple terminal areas to be visible and active simultaneously.

Sessions

tmux Session Management Commands

ActionCommandNotes
Start Sessiontmux tmux new tmux new-sessionStarts a new session
Kill Current Session:kill-sessionKills the session you’re currently in
Kill Specific Sessiontmux kill-session -t <session-name>Replace <session-name> with the target session
Kill All Except Currenttmux kill-session -aKills all sessions except the one you’re attached to
Kill All Except Specifictmux kill-session -a -t <session-name>Keeps only the specified session
Detach SessionCTRL + b, then dDetach from session and return to shell
Rename SessionCTRL + b, then $Rename the current session
List Sessionstmux ls tmux list-sessionsLists all active sessions

Windows

ActionCommandNotes
Create New WindowCTRL + b, then cCreates a new window
Rename Current WindowCTRL + b, then ,Renames the current window
Close Current WindowCTRL + b, then &Kills the current window
List WindowsCTRL + b, then wShows all windows
Next / Previous WindowCTRL + b, then n / pNavigate between windows
Select Window by NumberCTRL + b, then 09Switch to specific window

Panes

ActionCommandNotes
Split HorizontallyCTRL + b, then % :split-window -hHorizontal split
Split VerticallyCTRL + b, then " :split-window -vVertical split
Switch PanesCTRL + b, then Arrow KeysMove between panes using arrow keys
Next PaneCTRL + b, then oCycles to the next pane
Swap Panes Left / RightCTRL + b, then { or }Move pane position within layout
Close Current PaneCTRL + b, then xCloses the pane
Toggle LayoutsCTRL + b, then SpacebarSwitch between different pane arrangements