tmux 常用命令

software

tmux 是一个终端复用软件,类似 GNU/Screen

基本命令

tmux new -s session 创建名称为 session 的会话

tmux ls 会话列表

tmux kill-session -t session 注销名称为 session 的会话

tmux a -t  session 进入名称为 session 的会话

tmux a  进入默认第一个会话

会话内部命令

<leader>  为命令前置按键,默认为  <Ctrl + B>

即在执行任何命令前,需要先按下 <Ctrl + B>

释放后再按其他键,可通过修改 ~/.tmux.conf 配置来自定义前置按键

<leader> +  ?   命令清单

<leader> + c        新建 window

<leader> + &      关闭 window

<leader> + n      下一个 window

<leader> + p       前一个 window

<leader> + ,       修改 window 名称

<leader> + d       退出当前会话

<leader> + $num    切换第 $num 个 window

<leader> +  “    纵向切割当前 window,变为左右2个pane

<leader> +  %    横向切割当前 window, 变为上下2个pane

<leader> +  :source-file ~/.tmux.conf    重载 tmux 配置

待翻译:

<leader>+ C-z Suspend the current client
<leader>+ Space Select next layout
<leader>+ ! Break pane to a new window
<leader>+ # List all paste buffers
<leader>+ $ Rename current session
<leader>+ &amp; Kill current window
<leader>+ ' Prompt for window index to select
<leader>+ ( Switch to previous client
<leader>+ ) Switch to next client
<leader>+ , Rename current window
<leader>+ . Move the current window
<leader>+ / Describe key binding
<leader>+ 0 Select window 0
<leader>+ 1 Select window 1
<leader>+ 2 Select window 2
<leader>+ 3 Select window 3
<leader>+ 4 Select window 4
<leader>+ 5 Select window 5
<leader>+ 6 Select window 6
<leader>+ 7 Select window 7
<leader>+ 8 Select window 8
<leader>+ 9 Select window 9
<leader>+ : Prompt for a command
<leader>+ ; Move to the previously active pane
<leader>+ = Choose a paste buffer from a list
<leader>+ ? List key bindings
<leader>+ C Customize options
<leader>+ D Choose a client from a list
<leader>+ E Spread panes out evenly
<leader>+ L Switch to the last client
<leader>+ M Clear the marked pane
<leader>+ [ Enter copy mode
<leader>+ ] Paste the most recent paste buffer
<leader>+ c Create a new window
<leader>+ d Detach the current client
<leader>+ f Search for a pane
<leader>+ i Display window information
<leader>+ n Select the next window
<leader>+ o Select the next pane
<leader>+ p Select the previous window
<leader>+  q       Display pane numbers
<leader>+  s       Choose a session from a list     
<leader>+  t       Show a clock             
<leader>+  w       Choose a window from a list
<leader>+  x       Kill the active pane 
<leader>+  z       Zoom the active pane   
<leader>+  {       Swap the active pane with the pane above
<leader>+  }       Swap the active pane with the pane below
<leader>+  ~       Show messages  
<leader>+  DC      Reset so the visible part of the window follows the cursor
<leader>+  PPage   Enter copy mode and scroll up
<leader>+  Up      Select the pane above the active pane
<leader>+  Down    Select the pane below the active pane
<leader>+  Left    Select the pane to the left of the active pane
<leader>+  Right   Select the pane to the right of the active pane
<leader>+  M-1     Set the even-horizontal layout
<leader>+  M-2     Set the even-vertical layout
<leader>+  M-3     Set the main-horizontal layout
<leader>+  M-4     Set the main-vertical layout      
<leader>+  M-5     Select the tiled layout          
<leader>+  M-n     Select the next window with an alert
<leader>+  M-o     Rotate through the panes in reverse
<leader>+  M-p     Select the previous window with an alert
<leader>+  M-Up    Resize the pane up by 5
<leader>+  M-Down  Resize the pane down by 5
<leader>+  M-Left  Resize the pane left by 5
<leader>+  M-Right Resize the pane right by 5
<leader>+  C-Up    Resize the pane up                
<leader>+  C-Down  Resize the pane down
<leader>+  C-Left  Resize the pane left     
<leader>+  C-Right Resize the pane right
<leader>+  S-Up    Move the visible part of the window up
<leader>+  S-Down  Move the visible part of the window down
<leader>+  S-Left  Move the visible part of the window left
<leader>+  S-Right Move the visible part of the window right

配置文件路径:~/.tmux.conf

推荐配置  https://github.com/gpakosz/.tmux

推荐状态栏 statusline 插件 https://github.com/powerline/powerline

推荐插件管理器  https://github.com/tmux-plugins/tpm

cheatsheet  https://tmuxcheatsheet.com/

tmux Guide https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html