Tmux Cheat Sheet

Structure

Command

  1. Start a new session

    1
    2
    tmux new -s <session_name>
    tmux # 按照 0, 1, 2, ··· 编号
  2. Rename a session

    1
    tmux rename-session -t <target_session_name> <session_new_name>
  3. Detach the current session

    1
    tmux detach
  4. Show all current sessions

    1
    tmux ls
  5. Attach a session

    1
    tmux attach -t <session_name>
  6. Kill a session

    1
    2
    3
    tmux 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>
  7. Switch between two sessions

    1
    tmux switch -t <session_name> # switch to the <session_name>
  8. Create a new window

    1
    tmux new-window -n <window_name> # create a new window named window_name
  9. Select a window

    1
    tmux select-window -t <window_name/window_number> # swap to a specific window
  10. Rename a window

    1
    tmux rename-window <new_name> # rename the current window
  11. Split a window into two panes

    1
    2
    tmux split-window # divide the window into two top and bottom panes
    tmux split-window -h # divide the window into two left and right panes
  12. Move cursor

    1
    tmux select-pane -U/-D/-L/-R # move the cursor to the top/bottom/left/right pane
  13. Swap two panes

    1
    tmux swap-pane -U/-D # move the current pane to the top/bottom

Reference

[1] Tmux 快捷键 & 速查表 & 简明教程

[2] Tmux Cheat Sheet & Quick Reference