tmux常用命令

tmux是一个终端屏幕管理工具,tmux可以从一个屏幕创建,访问和控制多个终端。tmux可能会与屏幕分离,并继续在后台运行,然后再重新连接。

命令

$ tmux
  -u        # UTF8 mode
  -S ~/.tmux.socket

会话

$ tmux new
$ tmux new -s session_name

$ tmux attach # Default session
$ tmux attach -s session_name

$ tmux switch -t session_name

$ tmux ls     # List sessions

$ tmux detach

Windows

$ tmux new-window

Help

C-b ?

Scrolling

C-b [       # Enter scroll mode then press up and down

Copy/paste

C-b [       # 1. Enter scroll mode first.
Space       # 2. Start selecting and move around.
Enter       # 3. Press enter to copy.
C-b ]       # Paste

Panes

C-b %       # vert
C-b "       # horiz
C-b hkjl    # navigation
C-b HJKL    # resize
C-b o       # next window
C-b x       # close pane

C-b { or }  # move windows around

Windows

C-b c       # New window
C-b 1       # Go to window 1
C-b n       # Go to next window
C-b p       # Go to previous window
C-b w       # List all window

Detach/attach

C-b d       # Detach
C-b ( )     # Switch through sessions
$ tmux attach

显示时间

C-b t    # Time
细说各种开发语言的Heredoc
git diff 命令