用哪一個終端複用工具?別問,問就是tmux.
tmux 的設計哲學與vim相似,也有命令模式和非命令模式.命令模式下有不少快捷鍵能夠用,非命令模式就是正常的終端操做.
基本的結構是:git
服務通常是建立會話的時候就自動建立好了,一個服務包含多個會話,一個會話能夠放置多個窗口,一個窗口能夠進行分屏產生多個的panel.github
apt-get install tmux
shell
linkvim
# 新增 $ tmux # OR $ tmux new -s <your_session_name> $ tmux new -s train -d #後臺建立,能夠在會話裏面建立多個後臺session # session 列表 $ tmux ls # 從新連線 session $ tmux a -t 0 # OR $ tmux a -t <session_name> # 刪除 session $ tmux kill-session -t 0 # OR $ tmux kill-session -t <session_name> # OR $ tmux kill-session -a # 所有 # 刪除 tmux server $ tmux kill-server # 從新命名 session $ tmux rename-session -t 0 <new_session_name>
如下全部快捷鍵均是在命令模式下使用的,根據配置文件的命令模式進入鍵不一樣,每一個人有所差別,某人爲Ctrl+b,個人爲Ctrl+jwindows
s #上下選擇並enter便可
c
數字鍵
p
n
,
h
v
o #也能夠直接鼠標控制,須要配置鼠標功能
z #再按恢復
set-option -g prefix C-j # Mouse # set-option -g -q mouse on # Easy split pane commands # bind h split-window -h bind v split-window -v unbind '"' unbind % # Status bar --------------------{{{ set -g status-bg black set -g status-fg white set-option -g status-justify centre set-option -g status-left '#[fg=cyan][#{session_name}]' set-option -g status-left-length 5 set-option -g status-right '#[fg=white,bg=default]%H:%M #[default] #[fg=blue]%Y-%m-%d%a' # panel --------------------{{{ set-option -g pane-border-fg colour27 set-option -g pane-active-border-fg colour9 set-option -g display-panes-active-colour blue set-option -g display-panes-colour brightred # }}}
在tmux 會話中使用tmux source-file ~/.tmux.conf
激活配置
重啓的tmux會自動加載配置session