tmux基本操做

安裝和移除:vim

// 安裝
sudo apt-get install tmux

// 移除
sudo apt-get remove tmux

經常使用命令:session

tmux [new -s 會話名 -n 窗口名]   //啓動新會話

tmux at [-t 會話名]   //恢復會話
 tmux ls    //列出全部會話

tmux kill-session -t 會話名  //關閉會話

 

組合件Ctrl+B使用 :佈局

會話:ui

:new<回車>   啓動新會話
s           列出全部會話 $           重命名當前會話

 

窗口(標籤頁)spa

c    //建立新窗口
w  // 列出全部窗口
n   // 後一個窗口
p   // 前一個窗口
f    // 查找窗口
,    // 重命名當前窗口
&    // 關閉當前窗口

=========================================code

=========================================blog

重點:窗格(分割窗口)rem

%   // 垂直分割
"   // 水平分割
o   // 交換窗格
x    // 關閉窗格// 左邊這個符號表明空格鍵 - 切換佈局
q    // 顯示每一個窗格是第幾個,當數字出現的時候按數字幾就選中第幾個窗格
{    // 與上一個窗格交換位置
}   // 與下一個窗格交換位置
z   // 切換窗格最大化/最小化

 其餘:get

//複製模式
Ctrl+b [
//空格標記複製開始,回車結束複製。
//粘貼最後一個緩衝區內容
Ctrl+b ]
//選擇性粘貼緩衝區
Ctrl+b =
//列出緩衝區目標
Ctrl+b :list-buffer
//查看緩衝區內容
Ctrl+b :show-buffer
//vi模式
Ctrl+b :set mode-keys vi
//顯示時間
Ctrl+b t
//快捷鍵幫助
Ctrl+b ? (Ctrl+b :list-keys)
//tmux內置命令幫助
Ctrl+b :list-commands

// 啓動鼠標滾輪
set -g mouse on

複製粘貼設置:emacs

// 1. 創建配置文件
touch ~/.tmux.conf
// 2. 修改配置文件
vim ~/.tmux.conf

添加: set -g mode-keys vi

// --------------------------------

// 3. 使用該配置文件
tmux                        // 啓動tmux
Ctrl+b :                    // 進入命令模式
source-file  ~/.tmux.conf  //輸入下面的指令,讓修改當即生效

複製粘貼:

Ctrl+b   [          //進入複製模式
空格+方向鍵      //選擇
回車                  //  確認
Ctrl+b  ]           //粘貼
參考上表移動鼠標到要複製的區域,移動鼠標時可用vim的搜索功能"/","?" n 查找下一個

tmux複製模式的命令表:

       Function                  vi             emacs
       Back to indentation       ^              M-m
       Clear selection           Escape         C-g
       Copy selection            Enter          M-w
       Cursor down               j              Down
       Cursor left               h              Left
       Cursor right              l              Right
       Cursor to bottom line     L
       Cursor to middle line     M              M-r
       Cursor to top line        H              M-R
       Cursor up                 k              Up
       Delete entire line        d              C-u
       Delete to end of line     D              C-k
       End of line               $              C-e
       Goto line                 :              g
       Half page down            C-d            M-Down
       Half page up              C-u            M-Up
       Next page                 C-f            Page down
       Next word                 w              M-f
       Paste buffer              p              C-y
       Previous page             C-b            Page up
       Previous word             b              M-b
       Quit mode                 q              Escape
       Scroll down               C-Down or J    C-Down
       Scroll up                 C-Up or K      C-Up
       Search again              n              n
       Search backward           ?              C-r
       Search forward            /               C-s
       Start of line             0              C-a
       Start selection           Space          C-Space
       Transpose chars                          C-t

 快捷鍵前綴修改:

set -g prefix C-a #
unbind C-b # C-b即Ctrl+b鍵,unbind意味着解除綁定
bind C-a send-prefix # 綁定Ctrl+a爲新的指令前綴

# 從tmux v1.6版起,支持設置第二個指令前綴
set-option -g prefix2 ` # 設置一個不經常使用的`鍵做爲指令前綴,按鍵更快些

Ctrl+b :                    // 進入命令模式
source-file  ~/.tmux.conf  //輸入下面的指令,讓修改當即生效
相關文章
相關標籤/搜索