Tmux Cheatsheet

Master the terminal multiplexer. Navigate sessions, windows, and panes like a pro.

Global Prefix

Ctrl + b

Press these first for most commands

Sessions

  • New session tmux new -s name
  • Attach session tmux a -t name
  • List sessions tmux ls
  • Kill session tmux kill-sess -t name
  • Detach
    prefix + d
  • Rename current
    prefix + $
  • Switch session
    prefix + s

Windows (Tabs)

  • New window
    prefix + c
  • Next / Prev
    prefix + n / p
  • Go to window 0-9
    prefix + 0-9
  • Rename window
    prefix + ,
  • Close window
    prefix + &
  • List windows
    prefix + w
  • Find window
    prefix + f

Panes (Splits)

  • Split Vertical
    prefix + %
  • Split Horizontal
    prefix + "
  • Navigate panes
    prefix + Arrows
  • Toggle Fullscreen
    prefix + z
  • Close pane
    prefix + x
  • Cycle layouts
    prefix + Space
  • Show pane numbers
    prefix + q

Copy Mode & Misc

  • Enter Copy Mode
    (Allows scrolling output)
    prefix + [
  • Quit Copy Mode
    q
  • Reload Config tmux source ~/.tmux.conf
  • Command Prompt
    prefix + :

Typical Use Patterns

1. The "Fire & Forget"

Perfect for running long scripts on remote servers without fear of SSH disconnections.

# 1. Start a named session

$ tmux new -s deploy

# 2. Start your 5-hour task

$ ./massive_db_migration.sh

# 3. Detach and close SSH

prefix + d

# 4. Later, re-attach

$ tmux a -t deploy

2. The "IDE Split"

The classic web developer setup: Editor on the left, server and git on the right.

# 1. Open editor taking full screen

$ nvim index.js

# 2. Split vertically (Right panel)

prefix + %

# 3. Split right panel horizontally

prefix + "

# 4. Run server top right, git bottom

prefix + Arrows to move

3. The Context Switcher

Juggling multiple projects? Keep each project in its own self-contained session.

# 1. Start Client project

$ tmux new -s ClientApp

# 2. Detach prefix + d

# 3. Start API project

$ tmux new -s API

# 4. Pop open the session switcher UI

# visually jump between projects

prefix + s