# Tmux

Gist Youtube tutorial

cheatsheet img
cheatsheet img

# session management

tmux ls # or tmux list-sessions)
tmux new -s session-name
# Ctrl-b d Detach from session
tmux attach -t [session name]
tmux kill-session -t session-name
  • Ctrl-b c Create new window
  • Ctrl-b d Detach current client
  • Ctrl-b l Move to previously selected window
  • Ctrl-b n Move to the next window
  • Ctrl-b p Move to the previous window
  • Ctrl-b & Kill the current window
  • Ctrl-b , Rename the current window
  • Ctrl-b q Show pane numbers (used to switch between panes)
  • Ctrl-b o Switch to the next pane
  • Ctrl-b ? List all keybindings

# moving between windows

  • Ctrl-b n (Move to the next window)
  • Ctrl-b p (Move to the previous window)
  • Ctrl-b l (Move to the previously selected window)
  • Ctrl-b w (List all windows / window numbers)
  • Ctrl-b window number (Move to the specified window number, the default bindings are from 0 -- 9)

# Tiling commands

  • Ctrl-b % (Split the window vertically)
  • CTRL-b " (Split window horizontally)
  • Ctrl-b o (Goto next pane)
  • Ctrl-b q (Show pane numbers, when the numbers show up type the key to go to that pane)
  • Ctrl-b { (Move the current pane left)
  • Ctrl-b } (Move the current pane right)

# copy text

  • Ctrl+b, Enter copy mode.
  • Move to start/end of text to highlight.
  • Ctrl space
  • Start highlighting text (on Arch Linux). When I've compiled tmux from source on OSX and other Linux's, just Space on its own usually works. Selected text changes the colours, so you'll know if the command worked.
  • Move to opposite end of text to copy.
  • Alt+w Copies selected text into tmux clipboard. (On Mac use Esc+w.)
  • Move cursor to opposite tmux pane, or completely different tmux window. Put the cursor where you want to paste the text you just copied.
  • Ctrl+b, Paste copied text from tmux clipboard.

# Pane resizing

:resize-pane -D (Resizes the current pane down by one cell)
:resize-pane -R (Resizes the current pane right by one cell)
:resize-pane -U (Resizes the current pane upward by one cell)
:resize-pane -L (Resizes the current pane left by one cell)
:resize-pane -U 10 (Resizes the current pane upward by ten cells)
:resize-pane -R 10 (Resizes the current pane right by ten cells)
:resize-pane -D 10 (Resizes the current pane down by ten cells)
:resize-pane -L 10 (Resizes the current pane left by ten cells)