Sessions, windows and panes in tmux. Almost every keystroke comes after the same prefix, so the prefix is printed once per group and never again.

Sessions

Run in your shell. Every row starts with tmux.

new -s name

Start a session and give it a name you will recognise later

ls

List running sessions

attach -t name

Attach to an existing session

new -As name

Attach if it exists, otherwise create it

kill-session -t name

Stop one session and everything running in it

kill-server

Stop every session on this machine

Windows

Press Ctrl+b, then:

c

Create a window

,

Rename the current window

n p

Next window, previous window

0 … 9

Jump straight to a window by number

w

Pick a window from a list

f

Find a window by the text shown in it

&

Kill the window, after a confirmation

Panes

Press Ctrl+b, then:

%

Split left and right

"

Split top and bottom

← ↓ ↑ →

Move to the pane in that direction

o

Cycle to the next pane

q

Show pane numbers, press one to jump

z

Zoom the pane to full window, press again to restore

Space

Cycle through the built-in layouts

!

Move the pane out into its own window

x

Kill the pane, after a confirmation

Copy mode

Press Ctrl+b, then:

[

Enter copy mode and scroll back through the output

]

Paste the last copied text

/ ?

Search forwards or backwards, in copy mode

Space

Start the selection, in vi copy mode

Enter

Copy the selection and leave copy mode

q

Leave copy mode without copying

Set setw -g mode-keys vi to get the vi selection keys shown here.
Config

~/.tmux.conf. Every row starts with tmux.

source-file ~/.tmux.conf

Reload the config without restarting anything

list-keys

Print every binding, including your own

show-options -g

Print the global options in effect

# move the prefix off Ctrl-b
unbind C-b
set -g prefix C-a
bind C-a send-prefix

set -g mouse on
set -g base-index 1
Scripting

Run in your shell. Every row starts with tmux.

new -d -s build 'mvn verify'

Run a long job in a detached session and walk away

send-keys -t build 'git pull' Enter

Type a command into another session from outside

capture-pane -pt build

Print what a pane currently shows, for logs or scripts

send-keys types into a live shell, check the target with tmux ls first.

Part of the vogella tutorials. (©) 2026 vogella GmbH, see the license.