---
tags: Unix-like
---
# tmux
[TOC]
Terminal Multiplexer,可以保存 session 、擁有多重視窗、視窗分割等等功能。
## session
每次下 tmux 指令時都會開啟一個新的 session,每個 session 各自獨立。
## window
整個終端機畫面,一個 session 裡面可以有多個 window。
## pane
一個 window 可以切成多個小區塊,每個區塊就是一個 pane。
## prefix
| Command | Result |
|---------|---------------------|
| `c` | Create a new window |
| `p` | Change to the previous window |
| `n` | Change to the next window |
| `0`-`9` | Select windows 0 to 9 |
| `"` | Split the current pane into two, top and bottom |
| `%` | Split the current pane into two, left and right |
| Space | Arrange the current window in the next preset layout |
| 方向鍵 | Change to the pane above, below, to the left, or to the right of the current pane |
| `x` | Kill the current pane |
| `&` | Kill the current window |
| `m` | Mouse mode |
| `w` | 切換 windows(可跨 session) |
| `z` | Zoom in and out |
## command
```shell
$ tmux attach
$ tmux detach
$ tmux ls
```
## 參考資料
* [tumx manual page / man](http://man.openbsd.org/OpenBSD-current/man1/tmux.1)