Skip to content

Instantly share code, notes, and snippets.

@wulymammoth
Last active February 13, 2026 20:22
Show Gist options
  • Select an option

  • Save wulymammoth/04d171e2e28649922a00e33f9c8ee43b to your computer and use it in GitHub Desktop.

Select an option

Save wulymammoth/04d171e2e28649922a00e33f9c8ee43b to your computer and use it in GitHub Desktop.
tmux cheatsheet

tmux

movement

  • vim-like movement:

    <c-b> [

save and restore tmux environment

  • save

    <c-b> <c-s>
  • restore

    <c-b> <c-r>

operations

  • prefix shortcut (like vim's leader when inside a tmux session)

    <c-b>
  • tmux prompt (like command-mode in vim)

    :

sessions

  • attach to last created session

    tmux a #
  • attach session

    tmux attach-session -t [session #]
    tmux attach-session -t [session-name]
  • detach from session

    <c-b> d
  • start new session

    tmux new -s [session-name]
  • end session

    exit
  • kill (all) sessions

    tmux kill-server
  • kill session

    tmux kill-session -t [session-name]
  • list sessions

    <c-b> s
    tmux ls
  • name a session

    tmux new -s [session name]
  • rename a session (NOTE: can omit name of session as last session will be used if not specified)

    <c-b> $
    tmux rename-session [-t session-name] [new-session-name]
  • switch to last session

    <c-b> L
  • switch to prev/next session

    <c-b> (
    
    <c-b> )
  • view sessions

    tmux ls
  • view/check sessions

    <c-b> s

windows

(similar to tabs in a terminal emulator (e.g. iTerm2))

  • redistribute window indices

    <c-b> move-window -r
  • list windows

    <c-b> w
  • create window

    <c-b> c
  • close window

    <c-b> &
  • find text in (open) windows (searches all sessions)

    <c-b> f [text]
  • last window (move to)

    <c-b> l (L)
  • move window (move to index)

    <c-b> . <#>
  • swap window

    <c-b> :swap-window -t +/-<number>
    
    # swap window 3 and 1
    <c-b> :swap-window -s 3 -t 1
  • name window

    <c-b> ,
  • select window

    <c-b> [window-#]
  • switching windows (previous / next)

    <c-b> p / n

panes

  • equalize all panes

    <c-b> option-1
  • toggle (switch) active pane

    <c-b> ;
  • close (current) pane

    <c-b> x
  • move pane (left/right)

    <c-b> { / }
  • split horizontally

    <c-b> "
  • split vertically

    <c-b> %
  • navigating panes

    <c-b> [direction (arrow)]
  • resizing (up / down / left / right)

    resize-pane [-U | -D | -L | -R] [# of lines to expand]
  • zooming into a pane (maximize)

    <c-b> z

pane | layouts

rotate

<c-b> <space>

select layout

<c-b> select-layout / selectl <even-horizontal | even-vertical | main-horizontal | main-vertical | tiled>

predefined layouts

  • switch to even-horizontal layout:

    <c-b> <meta/option-1>
  • switch to even-vertical layout:

    <c-b> <meta/option-2>
  • switch to main-horizontal layout:

    <c-b> <meta/option-3>
  • switch to main-vertical layout:

    <c-b> <meta/option-4>
  • switch to tiled layout:

    <c-b> <meta/option-5>
  • switch to the next layout:

    <c-b> <meta/option-space>

automated development environment creation

  • tmuxp

customization

  • ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment