$ tmux
$ tmux new
$ tmux new-session
: new

Start a new session

$ tmux new -s mysession
: new -s mysession

Start a new session with the name mysession

$ tmux kill-ses -t mysession
$ tmux kill-session -t mysession

kill/delete session mysession

$ tmux kill-session -a

kill/delete all sessions but the current

$ tmux kill-session -a -t mysession

kill/delete all sessions but mysession

Ctrl + b $

Rename session

Ctrl + b d

Detach from session

Ctrl + b (

Move to previous session

Ctrl + b )

Move to next session

$ tmux source ~/.tmux.conf
: source-file ~/.tmux.conf

Reload tmux conf

$ tmux kill-server

Kill mtux server

$ tmux a
$ tmux at
$ tmux attach
$ tmux attach-session

Attach to last session

$ tmux a -t mysession
$ tmux at -t mysession
$ tmux attach -t mysession
$ tmux attach-session -t mysession

Attach to a session with the name mysession

$ tmux ls
$ tmux list-sessions
Ctrl + b s

Show all sessions


$ tmux new -s mysession -n mywindow

start a new session with the name mysession and window mywindow

Ctrl + b c

Create window

Ctrl + b ,

Rename current window

Ctrl + b &

Close current window

Ctrl + b p

Previous window

Ctrl + b n

Next window

Ctrl + b 0 ... 9

Select window by number

: swap-window -s 2 -t 1

Reorder window, swap window number 2 and 1


Ctrl + b ;

Toggle last active pane

Ctrl + b %

Split pane vertically

Ctrl + b "

Split pane horizontally

Ctrl + b {

Move the current pane left

Ctrl + b }

Move the current pane right

Ctrl + b up
Ctrl + b down
Ctrl + b righ
Ctrl + b left

Switch to pane to the direction

: setw synchronize-panes

Toggle synchronize-panes(send command to all panes)

Ctrl + b Spacebar

Toggle between pane layouts

Ctrl + b o

Switch to next pane

Ctrl + b q

Show pane numbers(type the number to goto that pane)

Ctrl + b z

Toggle pane zoom

Ctrl + b !

Convert pane into a window

Ctrl + b + up
Ctrl + b + down
Ctrl + b + right
Ctrl + b + left

Resize current pane

Ctrl + b x

Close pane

Copy Mode

: setw -g mode-keys vi

use vi keys in buffer

Ctrl + b [

Enter copy mode

Ctrl + b PgUp

Enter copy mode and scroll one page up


Quit mode


Go to top line


Go to bottom line


Scroll up


Scroll down


Move cursor left


Move cursor down


Move cursor up


Move cursor right


Move cursor forward one word at a time


Move cursor backward one word at a time


Search forward


Search backward


Next keyword occurance


Previous keyword occurance


Start selection


Clear selection


Copy selection

Ctrl + b ]

Paste contents of buffer_0

: show-buffer

display buffer_0 contents

: capture-pane

copy entire visible contents of pane to a buffer

: list-buffers

Show all buffers

: choose-buffer

Show all buffers and paste selected

: save-buffer buf.txt

Save buffer contents to buf.txt

: delete-buffer -b 1

delete buffer_1


Ctrl + b :

Enter command mode

: set -g OPTION

Set OPTION for all sessions

: setw -g OPTION

Set OPTION for all windows


$ tmux info

Show every session, window, pane, etc...

Ctrl + b ?

Show shortcuts

Concept of Session Window and Panel


  1. Tmux - Linux从业者必备利器
  2. Tmux Cheat Sheet & Quick Reference