This is a card in Dave's Virtual Box of Cards.

tmux cheatsheet

Created: 2022-03-03 Updated: 2022-07-27 (Split off from "Learning tmux" card)

tmux in general

Basic usage

In order of importance (for me):

  • The tmux prefix for all shortcuts: ctrl+b

  • Shortcut help: <prefix> ? then q to exit help

  • Split window:

    • <prefix> % splits left/right

    • <prefix> " splits top/bottom

  • Move cursor to split: <prefix> up/down/left/right (arrow keys)

  • Name session so I known what I’m re-attaching to later: <prefix> $

  • Detach from session <prefix> d (remains running in background)

  • List sessions (at CLI, outside of tmux): $ tmux ls

  • Attach to session: $ tmux attach -t foo (will probably alias this)

  • Create window: <prefix> c (same as GNU screen)

  • Switch to "next" window: <prefix> n

  • "Zoom" a split (so I can copy text from terminal) <prefix> z

    • Toggle Zoom back off by using shortcut again.

By the way, whoever thought to describe the split options as "left/right" and "top/bottom" has my blessing! Awesome descriptive-naming! (I’m saving this example.)

Advanced usage

  • Copy mode (scrollable buffer): <prefix> [ (same as GNU screen)

    • Arrow keys or pgup/pgdn, etc. to move around buffer

    • q to exit copy mode (no need for prefix, just q)

  • Resize a split: <prefix> alt+up/down/left/right (arrow keys)