Skip to content

Instantly share code, notes, and snippets.

@ttsubono
Last active January 26, 2018 12:16
Show Gist options
  • Save ttsubono/6cc4bb887f53523af11f355d5e3d734f to your computer and use it in GitHub Desktop.
Save ttsubono/6cc4bb887f53523af11f355d5e3d734f to your computer and use it in GitHub Desktop.
tmux cheatsheet

Basic

Start

tmux                          Create a new session
tmux new -s <name>            Create a new session with name
tmux new -As <name>           Create a new session with name or attach if the name exists
tmux ls                       List sessions
tmux a                        Attach last session
tmux a -t <name>              Attach a session with name
tmux kill-session -a          Kill all sessions but last
tmux kill-session -at <name>  Kill all sessions but name
tmux kill-session -t <name>   Kill a session with name
tmux rename <name>            Rename last session
tmux rename -t <old> <new>    Rename a session with name

End

d Detach client

Sessions (change)

s Select session
( Attach previous session
) Attach next session

Windows

c Create window
, Rename window
& Kill window

Windows (move)

w Choose window interactively
n Move to next window
p Move to previous window
l Move to previously selected window
0 Select window by number (0..9)
f Find window

Windows (reorder)

:swapw -t +1               Swap with right
:swapw -t -1               Swap with left
:swapw -s <Num1> -t <Num2> Swap window number Num1 and Num2

Panes

% Split vertically
" Split horizontally
k Kill pane

Panes (move)

o Move to next pane
↑ Move to above pane
↓ Move to below pane
← Move to left pane
→ Move to right pane

Panes (arrange)

{     Swap pane with previous
}     Swap pane with next
C-o   Rotate panes forwards
space Arrange with next preset layout
M-↑   Extend to above (5)
M-↓   Extend to below (5)
M-←   Extend to left (5)
M-→   Extend to right (5)

Copy mode

[ Enter
q Quit

Help

? List keys

tpm

I  Install plugins in .tmux.conf
U  Update plugins
Alt-u  Uninstall plugin  

tmux-resurrect plugin

C-s  Save sessions 
C-r  Restore sessions

tmux-yank plugin

y  Copy line to clipboard
y  Copy PWD to clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment