「tmux」- terminal multiplexer

  CREATED BY JENKINSBOT

tmux,终端复用器,能够在单个终端里与多个 SHELL 进行交互;

tmux 是什么

tmux 可以让你在一个屏幕里操作多个终端(至少不用 ALT+TAB 来频繁的切换窗口)。也可以断开 tmux 与当前屏幕的绑定,断开之后依旧可以恢复连接状态(恢复到之前的状态);

当 tmux 启动时,会创建一个 session,该 session 连接了一个 window。屏幕底部的“绿行”是状态栏,显示了当前的 session 的信息,并可以用于输入交互命令;

session 是由 tmux 管理的伪终端集合。每个 session 可以连接多个 window。一个 window 占据了整个屏幕,并可以被分为多个 pane,每个 pane 都是一个独立的伪终端(man 4 pty);

任意数量的 tmux 实例可以连接到同一个 session 上,并且任意数量的 window 可能存在于同一个 session 中。如果结束了所有的 session,tmux 就退出了;

在 tmux 中,的 session 已经持久化了,如果意外断开了与服务器的连接(比如 ssh 超时)或者故意断开连接(使用‘C-b d’人为断开),可以使用tmux attach命令恢复之前的连接;

在 tmux 中,每个 client 在屏幕上显示一个 session,多个 session 由 tmux server 管理。tmux server 与 tmux client 进程分离,通过/tmp 下的 socket 进行通信;

tmux 涉及的术语有:session、windows、pane;

配置文件

~/.tmux.conf
默认的 tmux 配置文件

/etc/tmux.conf
系统范围(全局)的配置文件

tmux 启动时会执行$HOME/.profile 文件;

命令行语法

tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name] [-S socket-path] [command [flags]]

相关的程序、插件、配置

https://github.com/search?q=tmux&type=Repositories&ref=simplesearch

参考文献

Homepage:https://github.com/tmux/tmux/wiki
Manual:http://man.openbsd.org/OpenBSD-current/man1/tmux.1
https://leanpub.com/the-tao-of-tmux/read
Wikipedia / tmux: https://en.wikipedia.org/wiki/Tmux

相关书籍

《tmux 2:Productive Mouse-Free Development》