Tmux Commands Cheat Sheet - Terminal Multiplexer Guide

Master Tmux with this comprehensive cheat sheet. Learn essential commands for managing terminal sessions, windows, and panes. Enhance your productivity with this quick reference guide.

Tmux Commands Cheat Sheet

Tmux is a powerful terminal multiplexer that allows you to manage multiple terminal sessions, windows, and panes within a single terminal window. This cheat sheet provides essential Tmux commands to enhance your command-line productivity.

Tmux Session Management

Manage your Tmux sessions efficiently with these commands.

# Start a new session:
tmux

# Start a new named session:
tmux new-session -s name

# List existing sessions:
tmux ls

# Attach to the most recently used session:
tmux attach-session

# Attach to a named session:
tmux attach-session -t name

Tmux Window Management

Organize your workflow with Tmux windows (tabs).

#  windows (tabs)
# ---
#  c  create window
#  w  list windows
#  n  next window
#  p  previous window
#  f  find window
#  ,  name window
#  &  kill window

Tmux Pane Management

Split your terminal into multiple panes for parallel tasks.

#  panes (splits)
# ---
#  %  vertical split
#  "  horizontal split
#  M-1 select-layout even-horizontal
#  M-2 select-layout even-vertical
#
#  →  go to the left (right, top, bottom) panel
#  C-→  resize panel to the left (right, top, bottom) panel
#  o  swap panes
#  q  show pane numbers (type the key to go to the pane)
#  x  kill pane
#  +  break pane into window (e.g. to select text by mouse to copy)
#  -  restore pane from window
#  ⍽  (space) toggle between layouts
#  {  (Move the current pane left)
#  }  (Move the current pane right)
#  z  toggle pane zoom

Tmux Session Switching

Easily switch between your active Tmux sessions.

#  sessions
# ---
#  )  switch to next session
#  (  switch to previous session

Tmux Miscellaneous Commands

Useful general commands for Tmux operations.

#  misc
# ---
#  d  detach
#  t  big clock
#  ?  list shortcuts
#  :  prompt

Tmux Copy Mode (Copymode)

Navigate and copy text within Tmux panes.

#  copy mode (copymode)
# ---
#  [  go into copy mode
#  ]  paste into the current window
#
#     setw -g mode-keys vi  # to switch into vi mode
#
#  Function                Vi             Emacs
#  -----------------------------------------------
#  Back to indentation     ^              M-m
#  Start selection         Space          C-space
#  Clear selection         Escape         C-g
#  Copy selection          Enter          M-w
#  Cursor down             j              Down
#  Cursor left             h              Left
#  Cursor right            l              Right
#  Cursor to bottom line   L
#  Cursor to middle line   M              M-r
#  Cursor to top line      H              M-R
#  Cursor up               k              Up
#  Delete entire line      d              C-u
#  Delete to end of line   D              C-k
#  End of line             $              C-e
#  Goto line               :              g
#  Half page down          C-d            M-Down
#  Half page up            C-u            M-Up
#  Next page               C-f            Page down
#  Next word               w              M-f
#  Paste buffer            p              C-y
#  Previous page           C-b            Page up
#  Previous word           b              M-b
#  Quit mode               q              Escape
#  Scroll down             C-Down or J    C-Down
#  Scroll up               C-Up or K      C-Up
#  Search again            n              n
#  Search backward         ?              C-r
#  Search forward          /              C-s
#  Start of line           0              C-a
#  Start selection         Space          C-Space
#  Transpose chars                        C-t

Tmux Layouts

Quickly switch between predefined window layouts.

#  layout
# ---
#  alt-1  select-layout even-horizontal
#  alt-2  select-layout even-vertical

External Resources