代替screen的好工具tmux
2012年01月13日 发表评论
以前一直用screen进行终端的管理。但是screen有各种各样的问题。最近发现了一个好工具叫tmux,全称是Terminal Multiplexer
我常用的几个功能如下:
1. 共享屏幕,这个screen其实也可以做,但是比较复杂,而在tmux中2个人连同一个连接就可以搞定了。
2. 日志记录,screen中的日志一直不知道如何快捷的导出,而tmux却很容易的记录,不过它记录的是屏幕显示,有时内容就过显多了。
3. 分割屏幕,有时候在同一个终端中一边看日志,一般看系统负载。screen只能水平分割,而tmux中可以自由的分割。
4. 自定义配置文件,下面这个就是我的配置文件。把默认了Ctrl+b改成了Ctrl+a,这样更适合以前用惯screen的我习惯了。以及一些高亮和快捷方式的更改
# Global settings # Set prefix to ^a (like screen) # go to start of line will be C-a C-a set-option -g prefix C-a unbind-key C-b bind-key C-a send-prefix # Reload key bind r source-file ~/.tmux.conf set -g history-limit 10000 # THEME set -g status-bg black set -g status-fg white set -g status-interval 60 set -g status-left-length 30 set -g status-left '#[fg=green](#S) #(whoami)@#H#[default]' set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=blue]%H:%M:%S#[default]' # Key Bind set -g bell-action any setw -g mode-keys vi setw -g xterm-keys on # open a man page in new window bind-key / command-prompt "split-window -h 'exec man %%'" # log output bind-key H pipe-pane 'cat >>$HOME/tmux-#W.log' ; display-message 'Started logging to $HOME/tmux-#W.log' bind-key h pipe-pane ; display-message 'Ended logging to $HOME/tmux-#W.log' # quick view of processes bind-key "~" split-window -h "exec top" unbind % bind | split-window -v unbind '"' bind - split-window -h bind-key H pipe-pane 'cat >>$HOME/tmux-#W.log' ; display-message 'Started logging to $HOME/tmux-#W.log' bind-key h pipe-pane ; display-message 'Ended logging to $HOME/tmux-#W.log' setw -g utf8 on set -g mouse-select-pane on set -g status-utf8 on # window title set-option -g set-titles on set-option -g set-titles-string '#S:#I.#P #W' # window number,program name,active (or not) set-window-option -g automatic-rename on # auto name # Highlight active window # active window title colors setw -g window-status-current-fg black setw -g window-status-current-bg red #setw -g window-status-current-attr bright setw -g window-status-current-attr underscore # clock set-window-option -g clock-mode-colour cyan set-window-option -g clock-mode-style 24
###########################################
Best regards
Timo Seven
blog:http://www.timoseven.com
twitter: http://twitter.com/zauc
Linux System Admin & MySQL DBA



我的豆瓣
google分享
我的书签
最新评论