CentOS安装支持组件:
1 | yum install libevent-devel ncurses-devel |
安装tmux:
1 2 3 4 5 6 | wget http: //downloads .sourceforge.net /tmux/tmux-1 .6. tar .gz tar zxvf tmux-1.6. tar .gz cd tmux-1.6 . /configure make make install |
启动新会话:
1 | tmux [new -s 会话名 -n 窗口名] |
启动新会话时执行命令:
1 2 3 | #-d 后台启动 #exec bash 当ping结束时启动bash,不然会退出tmux窗口 tmux new -s test -d "ping qq.com; bash" |
指定会话启动新窗口:
1 | tmux [neww -t 会话名 -n 窗口名] |
恢复会话:
1 | tmux at [-t 会话名] |
列出所有会话:
1 | tmux ls |
关闭会话:
1 | tmux kill-session -t 会话名 |
在 Tmux 中,按下 Tmux 前缀 ctrl+b,然后:
会话
1 2 3 | :new<回车> 启动新会话 s 列出所有会话 $ 重命名当前会话 |
贴上我的tmux配置文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | bind a send-prefix bind m command-prompt "splitw -h 'exec %%'" bind S command-prompt "neww -n %1 'ssh %1'" bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." bind k selectp -U bind j selectp -D bind h selectp -L bind l selectp -R bind K resizep -U 10 bind J resizep -D 10 bind H resizep -L 10 bind L resizep -R 10 bind ^i kill-session bind ^l last-window set -g prefix C-a set -g base-index 1 setw -g pane-base-index 1 set -g display-time 5000 set -g repeat-time 1000 set -g status-right '"#(hostname)" #(date -d "today" +"%Y/%m/%d-%H:%M")#(uptime |cut -d ',' -f 2-)' set -g status-interval 10 set -g status-right-length 100 set -g status-utf8 on set -g status-keys vi setw -g mode-mouse on set -g mouse-select-pane on set -g mouse-select-window on set -g mouse-resize-pane on set -g mode-mouse on set -g mouse-utf8 on setw -g mode-keys vi setw -g utf8 on #setw -g window-status-current-bg red |
标签:centos, screen, tmux, centos安装使用tmux