Getting started with Tmux

# Debian
sudo apt install -y tmux

# macOS
brew install tmux
  • tmux open tmux
  • exit or Ctrl+D to close a pane, exit tmux

tmux is controlled by a key combination of a prefix key, ‘C-b’ Ctrl-b by default, followed by a command key.

  • ctrl+B, then ? to open a list of all key bindings
  • ctrl+B, then % to open a new pane (horizontal)
  • ctrl+B, then " (double-quote) to open a pane (vertical)
  • ctrl+B, then arrow key (left/right/up/down) to move between panes (horizontal)

Sessions

Actions Key bindings
list all tmux sessions tmux ls
name/rename current session <prefix> $
detach session <prefix> d or tmux detach
connect to the detached session tmux a or tmux attach or tmux attach -d

Windows

Actions Key bindings
create a new window <prefix> c
close window exit
kill all windows <prefix> &
switch to next window <prefix> n
switch to prev window <prefix> p
switch to window using index <prefix> 0-9

Panes

Actions Key bindings
kill current pane <prefix> x
close pane <prefix> D or exit
split horizontally <prefix> "
split vertically <prefix> %
move to pane <prefix> arrow-key
zoom in/out on active pane <prefix> z