Skip to content

Tmux CLI

New session

Start a new session

shell
$ tmux

Start a new named session

shell
$ tmux new -s myname

Show all sessions

shell
$ tmux ls

Attach session

Attach to last session

shell
$ tmux a

Attach to named

shell
$ tmux a -t myname

Kill session

Kill a session by name

shell
$ tmux kill-ses -t myname

Kill sessions but the current

shell
$ tmux kill-ses -a

Kill sessions but 'myname'

shell
$ tmux kill-ses -a -t myname

Tmux help

shell
$ tmux info

Config

Reload config

shell
$ tmux source-file ~/.tmu­x.conf

Show config

shell
$ tmux show-options -g

Copy Mode

CommandDescription
Ctrl+b [Enter copy mode
<Space>Start selection
EnterCopy selection
qQuit copy mode
Ctrl+b ]Paste contents of buffer_0

Mainly works like selecting text in Vim

Tmux shortcuts

Getting started

ShortcutsDescription
Ctrl+b ?List all shortcuts


Show every session, window, pane, etc.

shell
$ tmux info

Panes (Splits)

ShortcutsDescription
Ctrl+b " / %Split Horiz/Vert
Ctrl+b !Pane -> Window
Ctrl+b xKill pane
Ctrl+b <Arrow>Navigate panes
Ctrl+b <Space>Toggle layouts
Ctrl+b { / }Move to Left/Right
Ctrl+b oGoto next panes
Ctrl+b ztoggle full-screen
Ctrl+b ;Toggle Last pane
Ctrl+b qShow numbers
Ctrl+b q 0...9Goto # pane

Window (Tabs)

--
Ctrl+b cCreate window
Ctrl+b p / nPrevious/Next window
Ctrl+b " / %Split Horiz/Vert
Ctrl+b wList window
Ctrl+b ,Rename window
Ctrl+b fFind window
Ctrl+b lLast window
Ctrl+b .Move window
Ctrl+b &Close window
Ctrl+b 0...9Goto # window

Session (Set of Windows)

--
Ctrl+b dDetach from session
Ctrl+b sShow all sessions
Ctrl+b $Rename session
Ctrl+b ( / )Previous/Next session

Tmux Command Mode

Usage

CommandDescription
Ctrl+b :Enter command mode

Resizing

CommandDescription
resize-pane -D 20Resize down
resize-pane -U 20Resize up
resize-pane -L 20Resize left
resize-pane -R 20Resize right

Listing

CommandDescription
list-keysAll commands
list-panesAll panes
list-windowsAll Windows

Copying

CommandDescription
list-buffersList all buffers
show-bufferShow #0 contents
capture-paneCopy of pane
choose-bufferShow and paste
save-buffer a.txtSave to file
delete-buffer -b 1Delete buffer 1

Setting

CommandDescription
set -g OPTIONSet for all sessions
setw -g OPTIONSet for all windows
setw -g mode-keys viEnable vi-mode
set -g prefix C-aSet prefix

Misc

CommandDescription
swap-pane -s 3 -t 1Swap pane
swap-window -t -1Move to left
setw synchronize-panesSync Panes
join-pane -t :#Join pane