Structure
Command
-
Start a new session
1
2tmux new -s <session_name>
tmux # 按照 0, 1, 2, ··· 编号 -
Rename a session
1
tmux rename-session -t <target_session_name> <session_new_name>
-
Detach the current session
1
tmux detach
-
Show all current sessions
1
tmux ls
-
Attach a session
1
tmux attach -t <session_name>
-
Kill a session
1
2
3tmux kill-session -t <session_name> # kill the specific session
tmux kill-session -a # kill all sessions but the current
tmux kill-session -a -t <session_name> # kill all sessions but the <session_name> -
Switch between two sessions
1
tmux switch -t <session_name> # switch to the <session_name>
-
Create a new window
1
tmux new-window -n <window_name> # create a new window named window_name
-
Select a window
1
tmux select-window -t <window_name/window_number> # swap to a specific window
-
Rename a window
1
tmux rename-window <new_name> # rename the current window
-
Split a window into two panes
1
2tmux split-window # divide the window into two top and bottom panes
tmux split-window -h # divide the window into two left and right panes -
Move cursor
1
tmux select-pane -U/-D/-L/-R # move the cursor to the top/bottom/left/right pane
-
Swap two panes
1
tmux swap-pane -U/-D # move the current pane to the top/bottom