Updated: 2020-06-29


If you want scrollback support, try iterm + tmux + mosh:

Create or edit ~/.tmux.conf on the server and add the following commands:

set-option -g mouse on
set -g history-limit 30000


start new:


start new with session name:

tmux new -s myname


tmux a  #  (or at, or attach)

attach to named:

tmux a -t myname

list sessions:

tmux ls

kill session:

tmux kill-session -t myname

Kill all the tmux sessions:

tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill


In tmux, hit the prefix ctrl+b and then:


:new<CR>  new session
s  list sessions
$  name session

Windows (tabs)

c           new window
,           name window
w           list windows
f           find window
&           kill window
.           move window - prompted for a new number
:movew<CR>  move window to the next unused number

Panes (splits)

%  vertical split
"  horizontal split

o  swap panes
q  show pane numbers
x  kill pane
+  break pane into window (e.g. to select text by mouse to copy)
-  restore pane from window
⍽  space - toggle between layouts

{ Move the current pane left
} Move the current pane right
z toggle pane zoom

Resize Panes

:resize-pane -D (Resizes the current pane down)
:resize-pane -U (Resizes the current pane upward)
:resize-pane -L (Resizes the current pane left)
:resize-pane -R (Resizes the current pane right)
:resize-pane -D 20 (Resizes the current pane down by 20 cells)
:resize-pane -U 20 (Resizes the current pane upward by 20 cells)
:resize-pane -L 20 (Resizes the current pane left by 20 cells)
:resize-pane -R 20 (Resizes the current pane right by 20 cells)
:resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells)
:resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells)

Window/pane surgery

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


d  detach
t  big clock
?  list shortcuts
:  prompt

Other Cheatsheets: