Show Menu

tmux the terminal multiplexer Cheat Sheet by

Still work in progress, comments welcome.inspired by http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/also interesting: https://github.com/aziz/tmuxinator
linux     shortcuts     unix     terminal     tmux     openbsd     bsd

General

Control-a
prefix key (default C-b)
:
intera­ctive dialog (promt)
d
detach session
tmux restore
restore session
: source­-file ~/.tmu­x.conf
reload .tmux.conf
t
big clock
?
list bindings

Session handling

tmux
start new
tmux new -s myname
start new with name
tmux a -t
reattach session (or at, or attach)
tmux a -t myname
reattach named session
tmux ls
list sessions
tmux kill-s­ession -t myname
kill named session
:new
new session
s
list sessions
$
name session
tmux kill-s­erver
kill server and all sessions

custom­izing tmux

set-option -g prefix C-a
rebind the Ctrl-b prefix to Ctrl-a
-g for global => every window
bind-key C-a last-w­indow
switch to last active window
To use hit Ctrl-a twice
unbind %
Remove default split binding
bind | split-­window -h
bind vertical splitting to |
bind – split-­window -v
bind horizontal splitting to -
set -g status-bg black
set -g status-fg white
set -g status­-left ‘#[fg=­gre­en]#H’
beginning of statusbar hostname in green
set-wi­ndo­w-o­ption -g window­-st­atu­s-c­urr­ent-bg red
current window shown in red
set -g status­-right ‘#[fg=­yel­low­]#(­uptime | cut -d “,” -f 2-)’
number of users and load average for computer
setw -g monito­r-a­ctivity on
highlight window with new activity
set -g visual­-ac­tivity on
show info on new activity
setw -g automa­tic­-rename on
set window title to current command
 

Basic Window Handling

c
new window
,
rename window
n
next window
p
previous window
l
previously selected window
w
list all windows
[0-9]
move to window number [0-9]
f [window name]
find window
: list-w­indows
list windows
&
kill window
.
move window

Advanced Window Handling

move-w­indow [ −d] [ −s src-wi­ndow] [ −t dst-wi­ndow]
swap-w­indow [ -d] [ -s src-wi­ndow] [ -t dst-wi­ndow]

Pane Window Handling

:joinp -s :2
move window 2 into a new pane in the current window
:joinp -t :1
move the current pane into a new pane in window 1

Vim like commands

bind s split-­window -v
splitting
bind v split-­window -h
splitting
bind h select­-pane -L
motion keys
bind j select­-pane -D
motion keys
bind k select­-pane -U
motion keys
bind l select­-pane -R
motion keys
setw -g mode-keys vi
vim motion keys while in copy mode
bind - resize­-pane -D 1
resize pane down by 1
bind + resize­-pane -U 1
resize pane up by 1
bind < resize­-pane -L 1
resize pane to left by 1
bind > resize­-pane -R 1
resize pane to right by 1
 

Basic Pane Handling

v
split vertically
: split-­window
split horizo­ntally
o
go to next pane (down-­pane)
q
show pane number, press number to go to
{
move current pane left
}
move current pane right
x
kill pane

Advanced Pane Handling

<sp­ace>
toggle through layouts
break-pane
take a pane and make own window
-d
focus stays
resize­-pane
resize pane down
(20)
by 20 cells
  
-U (20)
resize up (by 20 cells)
  
-L (20)
resize left (by 20 cells)
  
-R (20)
resize right (by 20 cells)
  
-t 2 20
pane with id 2 down by 20
  
...

tmux info

?
list bindings
Set pane title
printf '\033]­2;%­s\0­33\\' 'title goes here'

Download the tmux the terminal multiplexer Cheat Sheet

2 Pages
//media.cheatography.com/storage/thumb/bechtold_tmux-the-terminal-multiplexer.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

Like this cheat sheet? Check out our sponsors!

Readable.io is a collection of tools to make your writing better. More readable content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!

Click Here To Get Started!

 

Comments

Bruno Bruno, 08:56 14 Feb 14

Most important key is missing: Ctrl-b

bechtold bechtold, 23:59 27 Apr 14

Under customizing you see, that I bound it to Control-b. I thought this is so basic, one should know at least this. But I add it now. Thx

Tom Tom, 08:33 24 Nov 14

Hi you propably forgot the most important:
C-b :setw synchronize-panes
..which allows you to type simultaneously in different panes.
/Tom

bechtold bechtold, 12:21 4 Sep 15

Good thing, I will try and then add this. But so far I have not hat the situation where I needed this :-)

foobar foobar, 10:43 12 May 15

Why is this cheatsheet divided into 2 pages, when it could fit in 1?

bechtold bechtold, 12:22 4 Sep 15

I have no clue. I don't think that I have influence on this. This seems to be pdf-generation-magic.

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Xterm Keyboard Shortcuts
          Awesome Window Manager 3.x Cheat Sheet