Getting started with Tmux
March 28, 2017
code
# Debian
sudo apt install -y tmux
# macOS
brew install tmux
tmuxopen tmuxexitorCtrl+Dto 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 bindingsctrl+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-serverto kill tmux entirely
Sessions
| Actions | Key bindings |
|---|---|
| Create a named session | tmux new -s SESSION_NAME |
| name/rename current session | <prefix> $ |
| detach from session | <prefix> d or tmux detach |
| list all tmux sessions | tmux ls |
| 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 |