Tmux/zh-cn

(terminal multiplexer) 是一款终端复用类程序，它允许在单个终端（或窗口）中，管理多个分离的会话，窗口及面板. 可以从屏幕上分离并继续在后台运行，然后重新连接. 熟悉GNU Screen 的用户可能会发现tmux是另一个很好的选择.

Emerge
安装 :

配置
标准方式安装不会安装全局或用户配置文件. 示例在 文件中提供，可以复制到全局位置或用户位置，并使用文本编辑器根据需要进行编辑.

程序包示例
要查看配置文件列表，请运行以下命令：

然后使用将其中一个文件移动到全局位置（将影响所有用户）或用户的主目录下.

Wiki 示例
以下是文件的示例：

插件
可以使用几个plugins. 请参阅以下各节以了解可用选项.

tmux-mem-cpu-load
是一个小程序，旨在监视状态行中的系统活动. 有关安装过程的更多详细信息，请参见Tmux/plugins/tmux-mem-cpu-load子文章.

Tmux 复活
persists environments across system restarts. See the resurrect sub-article for more details on the installation process.

按键绑定
tmux can be controlled from an attached client by using a key combination of a prefix key stroke (+ by default) followed by a command key.

After pressing + the following key combinations can be used:

General

 * = List all key bindings.
 * = Detach the current client.
 * = Enter the tmux command prompt.

Creating and managing windows

 * = Create a new window
 * = Change to the next window.
 * = Change to the previous window.
 * = Move to the previously selected window.
 * = Select windows 0 to 9.
 * = Prompt for a window index to select. Then enter a number or title to switch to that window.
 * = Rename the current window.
 * = Choose the current window interactively.
 * , then type list-windows = Display the list of windows.

Creating and managing panes

 * = Split the current pane into two, top and bottom.
 * = Split the current pane into two, left and right.
 * = Select the next pane in the current window.
 * = Move to the previously active pane.
 * {{Key|{}} = Swap the current pane with the previous pane.
 * {{Key| } }} = Swap the current pane with the next pane.
 * + = Rotate the panes in the current window forwards.
 * + to + = Arrange panes in one of the five preset layouts: even-horizontal, even-vertical, main-horizontal, main-vertical, or tiled.
 * = Kill the current pane.
 * = Break the current pane out of the window.

Copy, paste, and scroll operations
The keys available depend on whether emacs (default) or vi mode is selected. The mode-keys option can be set in for vi mode.


 * = Enter copy mode to copy text or view the history.
 * = Paste the most recently copied buffer of text.
 * = List all paste buffers.
 * = Delete the most recently copied buffer of text.

Start session
Once started creates a socket for the session in

can be started with the following command:

Or, to give the session a name on start up, run:

Listing sessions
List sessions to see existing session information:

When listing sessions the name of the session should appear as the first item in the session information line. It is possible to see from the output above the session was created without a name, hence the session is to be referenced as.

Another way to list sessions is by typing out the long  argument.

The exact same output as the previous list command is displayed.

Renaming a session
Simply using to start a session will not provide the session with a nice, human readable name.

If the default session name is not descriptive enough ( does not tend to describe much), then a session can be renamed. Suppose Larry the cow started without specifying a session name on start up. He begins working on compiling a new version of Portage, and wants to change the session name to reflect his current task. To change the session name he would first assume control of by pressing the magic key stroke: +, then  which will drop focus into the  control line. By default the line should turn yellow. Once there he would issue:

Where  is the existing (default) session name and   is the desired new name for the session. To rename when detached from a session issue:

Resuming a session
After the session is detached, all the active terminals remain active and so do commands that did not finish yet. To resume a session use.

Or use the long way of attaching to an existing session:

Daemon-like operation
To start a command in a session without attaching to the session (like a daemon) use   followed by the command to execute in quotes:

另请参阅

 * Screen - An alternative to tmux.

外部资源

 * An excellent primer.
 * The Tao of tmux, ebook by Tony Narlock, creator of libtmux and tmuxp.