跳转到主要内容
kitlocal.dev

tmux 命令速查表

本地运行

100% 在你的浏览器中处理。输入和输出绝不会离开你的设备。

通俗易懂的 tmux 终端复用器命令指南:会话、窗口、分屏窗格、同步输入、复制模式以及基于 tmux 3.6 的脚本控制。

工作原理

tmux uses a three-level hierarchy: a persistent server holds sessions (projects), each session holds windows (tabs), and each window splits into panes. Detaching leaves the session running in the background so you can reconnect later; inside tmux, most key bindings start with the prefix Ctrl-b followed by one key.

生存指南

最先需要掌握的少数几个命令。

40 条命令

键盘快捷键/聚焦搜索框JK移动选择C复制选中命令F收藏选中项Esc清空搜索

Manage sessions (shell)

Sessions survive SSH disconnects and terminal restarts. Name every project session so attaching is effortless.

官方文档:tmux sessions
  • 基础必备

    Create and attach to a named tmux session.

    tmux new -s <name>

    构建命令

    tmux new -s <name>

    输入的值将按原样插入。若包含空格或特殊字符,请自行添加引号。

    适用场景

    Names the session so you can return to the exact workspace after disconnecting or closing your terminal.

    命令解析

    new
    alias for new-session
    -s <name>
    session name

    示例

    Starts a session named api.

    tmux new -s api

    替代命令

    • tmux new-session -s <name>

    另请参见

Windows (tabs)

Windows act like full-screen tabs inside a session. Each appears in the bottom status bar.

官方文档:Windows and panes

Split & navigate panes

Split one window into multiple panes to edit code beside logs or a test runner.

官方文档:Pane commands

Scrollback & copy mode

tmux holds its own scrollback buffer per pane. Enter copy mode to scroll, search logs and copy without leaving the keyboard.

官方文档:Copy mode

Commands & configuration

Customize prefix, mouse support and reload ~/.tmux.conf without restarting running sessions.

官方文档:Configuration & options

在 KitLocal 工具中试用

术语表
Prefix
The shortcut pressed before a tmux command key. Default is Ctrl-b (release both keys before pressing the next key).
Session
A named workspace containing one or more windows that stays alive on the tmux server after you detach.
Window
A full-screen view inside a session (similar to a browser tab), numbered starting at 0 by default.
Pane
One rectangular terminal split inside a window, running its own shell.
Copy mode
A scrollback and selection mode entered with Ctrl-b [ so you can scroll up and copy text without a mouse.

核对时间:2026年11月15日 · 核对版本:tmux 3.6

来源: tmux manual page (man7.org) · tmux GitHub wiki

请将尖括号内的内容替换为你自己的实际值。所有命令均来自官方文档,示例均在标明版本上实测运行。