You are currently viewing Tmux Cheat Sheet And Reference Guide

Tmux Cheat Sheet And Reference Guide

Starting and Managing Sessions:

tmux                            #Start a new session
tmux new -s myname              #Start a new session with a name
tmux a or tmux attach           #Attach to the last session
tmux a -t myname                #Attach to a named session
tmux ls                         #List all sessions
tmux kill-session -t myname     #Kill a session
tmux kill-server.               #Kill all Session

General Shortcuts:

Prefix

<prefix> - ctrl + b #ctrl+b will be considered as prefix by default

Sessions:

<prefix> :new<CR> #Create a new session
<prefix> s        #List sessions
<prefix> $        #Rename session

Windows (Tabs):

<prefix> c #Create window
<prefix> w #List windows
<prefix> n #Next window
<prefix> p #Previous window
<prefix> f #Find window
<prefix> , #Name window
<prefix> & #Kill window

Panes (Splits):

<prefix> % #Vertical split
<prefix> " #Horizontal split
<prefix> o #Swap panes
<prefix> q #Show pane numbers
<prefix> x #Kill pane
<prefix> + #Break pane into window
<prefix> - #Restore pane from window
<prefix> <Space> #Toggle between layouts
<prefix> q #(Show pane numbers, then type the key to go to that pane)
<prefix> { #Move the current pane left
<prefix> } #Move the current pane right
<prefix> z #Toggle pane zoom

Sync Panes:

Set synchronize-panes:

<prefix> :setw synchronize-panes

Set synchronize-panes off:

<prefix> :setw synchronize-panes off

Resizing Panes:

<prefix> :resize-pane -D/U/L/R [N]

Copy Mode:

Enter Copy mode:

<prefix> [

Vi mode (add to .tmux.conf):

setw -g mode-keys vi

Movement in Copy mode:

h, j, k, l, w, b, f, F, etc.

Exit Copy mode:

<Enter>

Miscellaneous:

<prefix> d #Detach
<prefix> t #Show big clock
<prefix> ? #List shortcuts
<prefix> : #Open prompt

Configurations Options (Add to .tmux.conf):

Mouse support:

set -g mouse on

Set default terminal mode:

set -g default-terminal "screen-256color"

Activity alerts:

setw -g monitor-activity on
set -g visual-activity on

Center window list:

set -g status-justify centre

Maximize and Restore Pane:

Maximize

<prefix> Up

Restore

<prefix> Down

Table of Commands

Starting and Managing Sessions

ActionCommand
Start a new sessiontmux
Start a new session with a nametmux new -s myname
Attach to the last sessiontmux a or tmux attach
Attach to a named sessiontmux a -t myname
List all sessionstmux ls
Kill a sessiontmux kill-session -t myname
Kill all tmux sessionstmux ls


General Shortcuts

ActionCommand
List all shortcuts<prefix> ?

Sessions

ActionCommand
Create a new session<prefix> :new<CR>
List sessions<prefix> s
Rename session<prefix> $

Windows (Tabs)

ActionCommand
Create window<prefix> c
List windows<prefix> w
Next window<prefix> n
Previous window<prefix> p
Find window<prefix> f
Name window<prefix> ,
Kill window<prefix> &

Panes (Splits)

ActionCommand
Vertical split<prefix> %
Horizontal split<prefix> "
Swap panes<prefix> o
Show pane numbers<prefix> q
Kill pane<prefix> x
Break pane into window<prefix> +
Restore pane from window<prefix> -
Toggle between layouts<prefix> <Space>
Show pane numbers (navigate)<prefix> q (then type the key to go to that pane)
Move current pane left<prefix> {
Move current pane right<prefix> }
Toggle pane zoom<prefix> z

Sync Panes

ActionCommand
Set synchronize-panes<prefix> :setw synchronize-panes
Set synchronize-panes off<prefix> :setw synchronize-panes off

Resizing Panes

ActionCommand
Resize panes<prefix> :resize-pane -D/U/L/R [N]

Copy Mode

ActionCommand
Enter Copy mode<prefix> [
Vi mode (add to .tmux.conf)setw -g mode-keys vi
Exit Copy mode<Enter>

Miscellaneous

ActionCommand
Detach<prefix> d
Show big clock<prefix> t
List shortcuts<prefix> ?
Open prompt<prefix> :

Configurations Options (Add to .tmux.conf)

SettingCommand
Mouse supportsetw -g mode-mouse off
set -g mouse-select-pane off
set -g mouse-resize-pane off
set -g mouse-select-window off
Set default terminal modeset -g default-terminal "screen-256color"
Activity alertssetw -g monitor-activity on
set -g visual-activity on
Center window listset -g status-justify centre

Maximize and Restore Pane

ActionCommand
Maximize<prefix> Up
Restore<prefix> Down

Leave a Reply