Notes

Getting started with Tmux

Windows, Panes and Sessions. Keyboard shortcuts, and how to configure custom key bindings

Edit on GitHub


Workflow
2 minutes
1# Debian
2sudo apt install -y tmux
3
4# macOS
5brew 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)
  • ctrl+b, then :kill-server to kill tmux entirely

Sessions

ActionsKey bindings
Create a named sessiontmux new -s SESSION_NAME
name/rename current session<prefix> $
detach from session<prefix> d or tmux detach
list all tmux sessionstmux ls
connect to the detached sessiontmux a or tmux attach or tmux attach -d

Windows

ActionsKey bindings
create a new window<prefix> c
close windowexit
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

ActionsKey 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