Sessions

A single collection of pseudo-terminals under the management of Tmux. Once you kill the last session, Tmux exits. Each session is persistent and will survive accidental disconnection (such as SSH connection timeout) or intentional detaching by the user.In the example above, the session comprises panes 0:bash, 1:bash, and 2:bash. The current pane is 2:bash, marked by an asterisk *. Here, the cursor is active, and you can type into the pane. The other pane in the same window is 1:bash, marked by a hyphen -.

New Sessions

COMMAND

DESCRIPTION

tmux tmux new tmux new-session

Create new session from CLI

Ctrl+b :new

Create new session from inside Tmux

tmux new -s sess0

Create new session named sess0

Ctrl+b :new sess0

Create new session sess0 from inside Tmux

tmux new -s foo -c ~/Desktop/

Set a preferred directory for a new tmux session


List Sessions

COMMAND

DESCRIPTION

tmux ls tmux list-sessions

Show all sessions

Ctrl+b s

Show all sessions from inside Tmux


Attach Sessions

COMMAND

DESCRIPTION

tmux a tmux at tmux attach tmux attach-session

Attach to the most recently created session

tmux a -t s0

Attach to session s0


Terminate Sessions

COMMAND

DESCRIPTION

tmux kill-ses tmux kill-session

Kill last active session

tmux kill-ses -t s0

Kill session named s0

tmux kill-ses -a

Kill all sessions except the current one

tmux kill-ses -a -t s0

Kill all sessions except s0


Operations

Key BindingDescription

Ctrl + B -> $

Rename Session

Ctrl + B -> d

Detach from Session

Ctrl + B -> w

Session and Window Preview

Ctrl + B -> (

Move to Previous Session

Ctrl + B -> )

Move to Next Session

Last updated