Linux 使用利器 screen和tmux

來源:互聯網
上載者:User

標籤:

使用telnet或SSH遠程登入linux時,如果串連非正常中斷,重新串連時,系統將開一個新的session,無法恢複原來的session.screen命令可以解決這個問題。Screen工具是一個終端多路轉接器,在本質上,這意味著你能夠使用一個單一的終端視窗運行多終端的應用。

screen -ls

screen


還有另一個tmux也是非常的強大。

tmux可以配置自己的快速鍵,在~/.tmux.conf檔案中。


set -g prefix ^d
unbind ^b
bind d send-prefix

bind k selectp -U # 選擇上窗格
bind j selectp -D # 選擇下窗格
bind h selectp -L # 選擇左窗格
bind l selectp -R # 選擇右窗格


build D source-file ~/.tmux.layout #這個是使用快速鍵直接產生相應的layout


layout檔案為.tmux.layout

selectp -t 0    #選中第0個窗格
splitw -h -p 50  #將其分成左右兩個
selectp -t 1     #選中第一個,也就是右邊那個
splitw -v -p 50  #將其分成上下兩個,這樣就變成了圖中的布局了
selectp -t 0     #選回第一個


然後tmux進入:


Ctrl+d " - split pane horizontally
Ctrl+d % - 將當前窗格垂直劃分
Ctrl+d 方向鍵 - 在各窗格間切換
Ctrl+d,並且不要鬆開Ctrl,方向鍵 - 調整窗格大小
Ctrl+d c - (c)reate 產生一個新的視窗
Ctrl+d n - (n)ext 移動到下一個視窗
Ctrl+d p - (p)revious 移動到前一個視窗.
Ctrl+d 空格鍵 - 採用下一個內建布局 
Ctrl+d q - 顯示分隔視窗的編號 
Ctrl+d o - 跳到下一個分隔視窗 
Ctrl+d & - 確認後退出 tmux 

原文:http://blog.csdn.net/hongchangfirst/article/details/37818947

作者:hongchangfirst

hongchangfirst的首頁:http://blog.csdn.net/hongchangfirst



Linux 使用利器 screen和tmux

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.