cheatsheet

[!NOTE|label:references:]

files

FILES
DESCRIPTION

~/.tmux.conf

$XDG_CONFIG_HOME/tmux/tmux.conf

~/.config/tmux/tmux.conf

Default tmux configuration file.

/opt/homebrew/etc/tmux.conf

System-wide configuration file.

alias

COMMAND
ALIAS

attach-session

attach, at, a

detach-client

detach

has-session

has

list-clients

lsc

list-commands

lscm

list-sessions

ls

lock-client

lockc

lock-session

locks

new-session

new

refresh-client

refresh

rename-session

rename

show-messages

showmsgs

source-file

source

start-server

start

suspend-client

suspend

switch-client

switchc

sessions

linux commands

COMMAND
DESCRIPTION

tmux

start a new session

tmux new-session

start a new session

tmux new

start a new session

tmux new -s <name>

start a new session with a name

tmux new-session -A -s <name>

start a new session or attach to an existing session named mysession

tmux new -s <name> -n <window>

start a new session with a name and a window

tmux new-session -d -s <name> '<command>'

start a new session with a name and a command

tmux list-sessions

list all sessions

tmux ls

list all sessions

tmux kill-session -t <name>

kill/delete a session

tmux kill-ses -t <name>

kill/delete a session

tmux kill-session -a

kill/delete all sessions but the current

tmux kill-session -a -t <name>

kill/delete all sessions but the

tmux attach-session

attach to the last session

tmux attach

attach to the last session

tmux at

attach to the last session

tmux a

attach to the last session

tmux attach-session -t <name>

attach to a session

tmux attach -t <name>

attach to a session

tmux at -t <name>

attach to a session

tmux a -t <name>

attach to a session

tmux commands

COMMAND
DESCRIPTION

:new

start a new session

:new -s <name>

start a new session with a name

:kill-session

kill a session

:attach -d

detach others on the session (Maximize window by detach other clients)

shortcuts

SHORTCUTS
DESCRIPTION

ctrl + b $

rename the current session.

ctrl + b d

detach from the current session.

ctrl + b s

list all sessions.

ctrl + b w

session and window preview

ctrl + b (

move to previous session

ctrl + b )

move to next session

windows

shortcuts for windows

SHORTCUTS
DESCRIPTION

ctrl + b c

create a new window

ctrl + b ,

rename the current window

ctrl + b &

close the current window

ctrl + b w

list windows

ctrl + b p

preview window

ctrl + b n

next window

ctrl + b 0..9

switch to window 0..9

ctrl + b l

toggle between last two windows

tmux commands for windows

COMMAND
DESCRIPTION

:swap-window -s <src> -t <dst>

swap window with window

:swap-window -t -1

swap window with the previous one

:move-window -s src_ses:win -t target_ses:win

move window from src_ses to target_ses

:movew -s foo:0 -t bar:9

move window 0 from session foo to 9 in session bar

:movew -s 0:0 -t 1:9

move window 0 from session 0 to 9 in session 1

:move-window -s src_session:src_window

reposition window in the current session

:movew -s 0:9

reposition window 9 to the current session

:move-window -r

renumber windows to remove gap in the sequence

:movew -r

renumber windows to remove gap in the sequence

panes

shortcuts for panes

SHORTCUTS
DESCRIPTION

ctrl + b ;

toggle last active pane

ctrl + b %

split pane vertically

ctrl + b "

split pane horizontally

ctrl + b {

move pane left

ctrl + b }

move pane right

ctrl + b

move pane up

ctrl + b

move pane left

ctrl + b

move pane right

ctrl + b

toggle between pane layouts

ctrl + b o

move to the next pane

ctrl + b q

show pane numbers

ctrl + b q 0..9

swith/select the pane number

ctrl + b z

toggle pane zoom

ctrl + b !

convert pannel into a window

ctrl + b +

resize current pane width

ctrl + b ctrl +

resize current pane width

ctrl + b +

resize current pane width

ctrl + b ctrl +

resize current pane width

ctrl + b +

resize current pane height

ctrl + b ctrl +

resize current pane height

ctrl + b +

resize current pane height

ctrl + b ctrl +

resize current pane height

ctrl + b x

close/kill the current pane

tmux commands for panes

COMMAND
DESCRIPTION

:split-window -h

== ctrl + b % split the current pane with a vertical line to create a horizontal layout

:split-window -v

== ctrl + b " split the current pane with a horizontal line to create a vertical layout

:join-pane -s 2 -t 1

join two windows as panes (merge window 2 to window 1 as panes)

:joinp -s 2.1 -t 1.0

move pane from one window to another (move pane 1 from window 2 to pane after 0 of window 1)

:setw synchronize-panes

toggle synchronize panes (send command to all panes)

copy mode

shortcuts for copy mode

SHORTCUTS
DESCRIPTION

ctrl + b [

enter copy mode

ctrl + b PgUp

enter copy mode and scroll up one page up

q

quit copy mode

g

go to the top of the buffer

G

go to the bottom of the buffer

scroll up one line

scroll down one line

k

move cursor up

j

move cursor down

h

move cursor left

l

move cursor right

w

move cursor forward one worda at a time

b

move cursor backward one word at a time

/

search forward

?

search backward

n

next keyword occurrence

N

previous keyword occurrence

start selection

esc

clear selection

copy selection to clipboard

ctrl + b ]

paste selection

tmux commands for copy mode

COMMAND
DESCRIPTION

:setw -g mode-keys vi

set vi mode keys for copy mode

:show-buffer

show the buffer content

:capture-pane

copy entire visible contents of pane to a buffer

:list-buffers

list all buffers

:choose-buffer

choose a buffer to paste

:save-buffer <file>

save buffer to a file

:delete-buffer -b 1

delete buffer 1

misc

shortcuts for misc

SHORTCUTS
DESCRIPTION

ctrl + b :

enter command mode

tmux commands for misc

COMMAND
DESCRIPTION

:set -g OPTION

set OPTION for all sessions

:setw -g OPTION

set OPTION for all windows

:set mouse on

enable mouse mode

help

linux commands for help

COMMAND
DESCRIPTION

$ tmux list-keys

list key bindings ( shortcuts )

$ tmux info

show every session, window, panes, etc ...

$ tmux show -g

show global options

$ tmux show-options -g

show global options

tmux commands for help

COMMAND
DESCRIPTION

:list-keys

list key bindings ( shortcuts )

shortcuts for help

SHORTCUTS
DESCRIPTION

ctrl + b ?

show help

VARIABLE NAME
REPLACED WITH

alternate_on

If pane is in alternate screen

alternate_saved_x

Saved cursor X in alternate screen

alternate_saved_y

Saved cursor Y in alternate screen

buffer_sample

First 50 characters from the specified buffer

buffer_size

Size of the specified buffer in bytes

client_activity

Integer time client last had activity

client_activity_string

String time client last had activity

client_created

Integer time client created

client_created_string

String time client created

client_cwd

Working directory of client

client_height

Height of client

client_last_session

Name of the client's last session

client_prefix

1 if prefix key has been pressed

client_readonly

1 if client is readonly

client_session

Name of the client's session

client_termname

Terminal name of client

client_tty

Pseudo terminal of client

client_utf8

1 if client supports utf8

client_width

Width of client

cursor_flag

Pane cursor flag

cursor_x

Cursor X position in pane

cursor_y

Cursor Y position in pane

history_bytes

Number of bytes in window history

history_limit

Maximum window history lines

history_size

Size of history in bytes

host

Hostname of local host

insert_flag

Pane insert flag

keypad_cursor_flag

Pane keypad cursor flag

keypad_flag

Pane keypad flag

line

Line number in the list

mouse_any_flag

Pane mouse any flag

mouse_button_flag

Pane mouse button flag

mouse_standard_flag

Pane mouse standard flag

mouse_utf8_flag

Pane mouse UTF-8 flag

pane_active

1 if active pane

pane_current_command

Current command if available

pane_current_path

Current path if available

pane_dead

1 if pane is dead

pane_height

Height of pane

pane_id

Unique pane ID

pane_in_mode

If pane is in a mode

pane_index

Index of pane

pane_pid

PID of first process in pane

pane_start_command

Command pane started with

pane_start_path

Path pane started with

pane_tabs

Pane tab positions

pane_title

Title of pane

pane_tty

Pseudo terminal of pane

pane_width

Width of pane

saved_cursor_x

Saved cursor X in pane

saved_cursor_y

Saved cursor Y in pane

scroll_region_lower

Bottom of scroll region in pane

scroll_region_upper

Top of scroll region in pane

session_attached

1 if session attached

session_created

Integer time session created

session_created_string

String time session created

session_group

Number of session group

session_grouped

1 if session in a group

session_height

Height of session

session_id

Unique session ID

session_name

Name of session

session_width

Width of session

session_windows

Number of windows in session

window_active

1 if window active

window_find_matches

Matched data from the find-window command if available

window_flags

Window flags

window_height

Height of window

window_id

Unique window ID

window_index

Index of window

window_layout

Window layout description

window_name

Name of window

window_panes

Number of panes in window

window_width

Width of window

wrap_flag

Pane wrap flag

Last updated