← 返回命令列表

Linux command

tmux 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start a new session

tmux

Start a named session

tmux new -s [session_name]

List sessions

tmux ls

Attach to last session

tmux attach

Attach to named session

tmux attach -t [session_name]

Kill a session

tmux kill-session -t [session_name]

Detach from session

Ctrl-b d

Create new window

Ctrl-b c

Split pane horizontally

Ctrl-b "

Split pane vertically

Ctrl-b %

说明

tmux (terminal multiplexer) enables multiple terminal sessions within a single window. Sessions persist when disconnected, allowing users to detach and reattach later, making it essential for remote work. A tmux session contains windows (like tabs), and windows contain panes (splits). The prefix key (default Ctrl-b) followed by a command key triggers actions. Configuration is stored in ~/.tmux.conf. tmux is widely used for remote server administration, pair programming, and managing complex terminal workflows. Sessions survive SSH disconnections, preventing work loss.

参数

new -s _name_
Create new session.
attach -t _target_
Attach to existing session.
ls, list-sessions
List sessions.
kill-session -t _target_
Kill a session.
kill-server
Kill tmux server and all sessions.
detach
Detach from session.
send-keys
Send keys to a pane.
source-file _file_
Load configuration file.
swap-window -s _src_ -t _dst_
Swap two windows.
resize-pane -UDLR _amount_
Resize pane in given direction.
-f _file_
Specify alternative configuration file.
-L _socket-name_
Use named socket (allows independent servers).
-S _socket-path_
Specify full path to server socket.

FAQ

What is the tmux command used for?

tmux (terminal multiplexer) enables multiple terminal sessions within a single window. Sessions persist when disconnected, allowing users to detach and reattach later, making it essential for remote work. A tmux session contains windows (like tabs), and windows contain panes (splits). The prefix key (default Ctrl-b) followed by a command key triggers actions. Configuration is stored in ~/.tmux.conf. tmux is widely used for remote server administration, pair programming, and managing complex terminal workflows. Sessions survive SSH disconnections, preventing work loss.

How do I run a basic tmux example?

Run `tmux` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new -s _name_ do in tmux?

Create new session.