Cheatsheets - tmux
Last Updated: 2023-01-10
# start new
$ tmux
# start new with session name:
$ tmux new -s foo
# list sessions
$ tmux ls
# rename:
$ tmux rename-session -t 0 foo
# attach
$ tmux a # (or at, or attach)
$ tmux attach -t 0
$ tmux a -t foo
$ tmux attach-session -t 0
# detach
$ tmux detach
# or `Ctrl-b d`
# kill
$ tmux kill-session -t myname
# kill all
$ tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill
C-b
= Ctrl-b
Sessions
- :new new session
C-b s
list sessionsC-b $
name session
Windows (tabs)
C-b c
: create a windowC-b n
: next windowC-b p
: previous windowC-b 1
: jump to window 1C-b ,
: name windowC-b w
: list windowsC-b f
: find windowC-b &
: kill windowC-b .
: move window - prompted for a new number:movew<CR>
: move window to the next unused number
Panes (splits)
C-b %
: vertical splitC-b "
: horizontal splitC-b o
: swap panesC-b q
: show pane numbersC-b x
: kill paneC-b +
: break pane into window (e.g. to select text by mouse to copy)C-b -
: restore pane from windowC-b ⍽
: space - toggle between layoutsC-b {
: Move the current pane leftC-b }
: Move the current pane rightC-b 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
Misc
C-b d
: detachC-b t
: big clockC-b ?
: list shortcutsC-b :
: prompt