<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## tmux介紹 tmux是一個優秀的終端復用軟件,split窗口。可以在一個terminal下打開多個終端。 即使非正常掉線,也能保證當前的任務運行,這一點對于遠程SSH訪問特別有用,網絡不好的情況下仍然能保證工作現場不丟失。SSH重新連接以后,就可以直接回到原來的工作環境,不但提高了工作效率,還降低了風險,增加了安全性。 常用[tmux配置文件 .tmux.conf][1] ## tmux的基本概念 Session:連接。是一組Window的集合。 Window:單個可見窗口。類似一個標簽頁。是一組Pane的組合。 Pane:窗格。可以理解為一個分屏。 三個元素在tmux的具體展現如下圖,盜取自伯樂在線。 ![](https://ws3.sinaimg.cn/large/006tNc79gy1fospuz6zrvj30j6092400.jpg) ## tmux的安裝 一般采用網絡直接安裝的方式。 ~~~ yum install tmux sudo apt-get install tmux ~~~ ## 信息查詢 ~~~ tmux list-keys 列出所有可以的快捷鍵和其運行的 tmux 命令 tmux list-commands 列出所有的 tmux 命令及其參數 tmux info 流出所有的 session, window, pane, 運行的進程號,等。 ~~~ ## 有關Session的命令和快捷鍵 session是一個特定的終端組合。 ~~~ tmux 開啟一個新的Session tmux new -s session_name 創建一個叫做 session tmux attach -t session_name 重新開啟叫做 session tmux switch -t session_name 轉換到叫做 session tmux list-sessions / tmux ls 列出現有的所有 session tmux detach 離開當前開啟的 session tmux kill-server 關閉所有 session tmux kill-session -t 0 關閉編號為0的session; 不加-t則刪除全部session tmux source .tmux.conf 使配置在所有session即時生效 快捷鍵 操作 prefix s 查看/切換Session prefix d 離開Session prefix $ 重命名當前Session ~~~ ## 有關Window的命令和快捷鍵 session 中可以有不同的 window(但是同時只能看到一個 window)。 ~~~ tmux new-window -n window-name 創建一個新的 window tmux list-windows 列出window tmux select-window -t 0-9 根據索引轉到該 window tmux rename-window 重命名當前 window 快捷鍵 操作 prefix c 創建Window prefix & 關閉Window prefix n 切換到下一個Window prefix p 切換到上一個Window prefix Window號 切換Window號 prefix w 查看/切換Window ~~~ ## 有關Pane的快捷鍵 window 中可以有不同的 pane(可以把 window 分成不同的部分)。 ~~~ tmux split-window 將 window 垂直劃分為兩個 pane tmux split-window -h 將 window 水平劃分為兩個 pane tmux swap-pane -[UDLR] 在指定的方向交換 pane tmux select-pane -[UDLR] 在指定的方向選擇下一個 pane 快捷鍵 操作 prefix % 垂直拆分一個Pane prefix “ 水平拆分一個Pane prefix q 顯示Pane編號 prefix o 切換到下一個Pane prefix z 切換Pane的全屏 prefix Alt + 方向 調整Pane的大小 ~~~ ## tmuxinator tmuxinator是tmux的配置管理工具,解決了tmux服務器關機后session丟失問題。tmuxinator可以根據配置文件快速創建tmux的session。 ### 安裝 ~~~ yum install ruby gem install tmuxinator ~~~ ### 基礎設置 #### bash版 ~~~ #!/usr/bin/env bash _tmuxinator() { COMPREPLY=() local word word="${COMP_WORDS[COMP_CWORD]}" if [ "$COMP_CWORD" -eq 1 ]; then local commands="$(compgen -W "$(tmuxinator commands)" -- "$word")" local projects="$(compgen -W "$(tmuxinator completions start)" -- "$word")" COMPREPLY=( $commands $projects ) elif [ "$COMP_CWORD" -eq 2 ]; then local words words=("${COMP_WORDS[@]}") unset words[0] unset words[$COMP_CWORD] local completions completions=$(tmuxinator completions "${words[@]}") COMPREPLY=( $(compgen -W "$completions" -- "$word") ) fi } complete -F _tmuxinator tmuxinator mux ~~~ $HOME/.bashrc下增加下述內容: ~~~ source $HOME/.tmuxinator/.tmuxinator.bash export EDITOR=/usr/bin/vim ~~~ source $HOME/.bashrc使其生效。 #### zsh版 將下述文本保存為$HOME/.tmuxinator/.tmuxinator.zsh,提供zsh的tab鍵提示功能 ~~~ _tmuxinator() { local commands projects commands=(${(f)"$(tmuxinator commands zsh)"}) projects=(${(f)"$(tmuxinator completions start)"}) if (( CURRENT == 2 )); then _describe -t commands "tmuxinator subcommands" commands _describe -t projects "tmuxinator projects" projects elif (( CURRENT == 3)); then case $words[2] in copy|debug|delete|open|start) _arguments '*:projects:($projects)' ;; esac fi return } ~~~ $HOME/.zshrc下增加下述內容: ~~~ source $HOME/.tmuxinator/.tmuxinator.zsh export EDITOR=/usr/bin/vim ~~~ source $HOME/.zshrc使其生效。 ### 常用命令 Tmuxinator的一個工程(Project)對應tmux的一個session。 ~~~ new簡寫為n,open簡寫為o,edit簡寫為e,list簡寫為l,copy簡寫為c,delete簡寫為d。 tmuxinator n ws # 創建工程ws tmuxinator o ws # 打開工程ws的配置文件 tmuxinator e ws # 同上 tmuxinator c ws ws1 # 復制ws工程到ws1 tmuxinator d ws # 刪除ws工程 tmuxinator l # 顯示所有工程 tmuxinator ws # 開啟ws工程 ~~~ ### 配置文件 #### 配置 ~~~ name: ws # session名稱 root: ~/ # 工程根目錄,活動Pane會首先cd到此目錄 windows: - editor: # 第1個名為Editor的Window layout: main-vertical # Pane的布局 panes: # 各個Pane - vim # 第一個Pane運行vim命令 - guard # 第二個Pane運行guard命令 - server: bundle exec rails s # 第2個名為server的Window,運行命令為bundle - logs: tail -f log/development.log # 第3個名為logs的Window,運行命令為tail ~~~ #### 布局方式layout even-horizontal ![](https://ws1.sinaimg.cn/large/006tNc79gy1fotpqy8m5qj311y0lc0yt.jpg) even-vertical ![](https://ws4.sinaimg.cn/large/006tNc79gy1fotprzoefoj311y0lcgp5.jpg) main-horizontal ![](https://ws2.sinaimg.cn/large/006tNc79gy1fotpstnepgj311y0lc43f.jpg) main-vertical ![](https://ws2.sinaimg.cn/large/006tNc79gy1fotptg43xtj311y0lc459.jpg) tiled ![](https://ws1.sinaimg.cn/large/006tNc79gy1fotptwd6cjj311y0lc43w.jpg) http://blog.csdn.net/ZCF1002797280/article/details/51859524 https://www.jianshu.com/p/fd3bbdba9dc9 [1]:https://gist.coding.net/u/echohiyang/a9f1032993c54ab0b5732fe85b97d6ab/raw/ebbbcc7d7f78437c5357fbc6cb45006eed52d370/.tmux.conf
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看