跳至主要內容
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

請將尖括號內的任何內容替換為你自己的數值。指令均源自官方文件,且範例均在所示版本上實際執行。