SecureCRT + tmux 结合使用

   推荐此组合,很适合windows下。

tmux 的官方主页: http://tmux.sourceforge.net

安装:

环境centos 6.2 x84_64

下载: wget -c http://cdnetworks-kr-2.dl.sourceforge.net/project/tmux/tmux/tmux-1.6/tmux-1.6.tar.gz

依赖包:yum -y install libevent-devel

tar xvf tmux-1.6.tar.gz

cd tmux-1.6/

./configure

make && make install

安装很是简单。

epel 项目 yum -y install tmux

必须预先安装了epel-release-6-5.noarch.rpm。

 

tmux 使用简介:

详细文档最好不过 man tmux

tmux new -s qwe

创建一个新的会话,名字为qwe

OK 请 Ctrl+d 退出,默认的Ctrl+b 估计很多朋友都不顺手,我们来简单配置得好用些,至少顺手。

默认配置文件无,自己建个。

vim ~/.tmux.conf   用户个性化

vim /etc/tmux.conf 全局

 

------------------------

打开utf8 支持

set -g status-utf8 on

setw -g utf8 on

 

 

替换默认Ctrl-b为Ctrl-s

set-option -g prefix C-s

 

 

vim 风格移动

bind k selectp -U # 选择上窗格

bind j selectp -D # 选择下窗格

bind h selectp -L # 选择左窗格

bind l selectp -R # 选择右窗格

 

替换默认的分屏热键

unbind '"'

bind - splitw -v

横向

unbind %

bind \ splitw -h

垂直

 

putty+tmux 开启鼠标功能后putty的鼠标复制无法使用

支持鼠标拖拽调整窗格大小

set-option -g mode-mouse on 启用鼠标支持

set-option -g mouse-resize-pane on 鼠标调整窗格大小

set-option -g mouse-select-pane on 鼠标选择窗格

set-option -g mouse-select-window on 鼠标选择窗口

我个人没使用鼠标调整功能,原因上面说了。

SecureCRT 的鼠标复制字符串很是好用,左键选,右键粘。

 

同上面鼠标调整功能

bind -n F9 resizep -U 1

bind -n F10 resizep -D 1

bind -n F11 resizep -L 1

bind -n F12 resizep -R 1

我用的调整热键

F9 上

F10 下

F11 左

F12 右

-------------------------------------

去掉中文说明CP进 /etc/tmux.conf

保存退出 

 

更多 man tmux

 

现在我们 tmux new -s qwe

tmux 基本和 screen 的 热键一样

ctrl-s c 在当前会话中创建窗口

ctrl-d 关闭当前窗口

ctrl-s  s 选择窗口(1个以上窗口时才可选)

ctrl-s 1..9 选择某个数字号的窗口,当然要创建了多个窗口才有的选。

很多热键都和screen 相同.新手朋友详见 man tmux

分屏功能比screen强大太多,也是推荐的原因。好处很多用了就知道,你会偷笑的。

     screen 只能上下分,不能左右。

     tmux 想怎么分就怎么分。大家体会吧,网上很多tmux介绍和设置,我就不搬运了。

有图有真相:

 

分屏