Tmux 使用笔记

来源:互联网 发布:大型网络游排行榜2016 编辑:程序博客网 时间:2024/06/05 11:03

命令行

tmux new[-session] -s name -d新建会话(-d 是否在后台)tmux new -s name -n windowname新建会话及窗口tmux at[tach] -t session重新连接(-t 后接会话名称)tmux ls显示保存的会话tmux kill-session -t session删除会话

tmux 命令

输入 tmux 命令的两种方式

  1. Pre : [command]
  2. 在另一个终端,输入 tmux [command] -t sessionname
choose-buffer显示所有buffer的内容并粘贴list-buffer显示所有buffersave-buffer -a -b N output将N号buffer的内容输出(-a 表示添加内容)show-buffer -b N显示N号bufferset-buffer -b N data将N号buffer的内容重置capture-pane将当前面板的内容抓取至0号buffer中swap-pane -s sp -t tp交换sp和tpbreak-pane将面板变成窗口join-pane -s Sess:S.p -t TSess:T.p将Sess会话中S窗口中的p面板(比如0:1.1)合并至T窗口中的面板new-window -n name “shell command”新建窗口并执行命令move-window -r -s Sess:w -t Sess:w在会话间移动窗口

快捷键绑定

注意 :部分非默认绑定,需结合下节的配置文件使用。

Pre [/ESCAPE进入复制模式Pre [N] ]/p复制buffer内的内容Pre =选择并粘贴bufferPre (前一个会话Pre )后一个会话Pre c新建窗口Pre ,改变窗口的名字Pre $改变会话的名字Pre x前一个窗口Pre n后一个窗口Pre C-h/C-l前后窗口Pre [0-9]选择窗口Pre f搜索窗口Pre w列出所有窗口并选择Pre .移动窗口到新的编号Pre &退出窗口Pre Alt-[1-5]切换面板的布局Pre Space切换面板布局Pre C-o顺序轮换面板Pre M-o逆序轮换面板Pre {/}上/下交换面板(swap-pane -U/-D)Pre o切换当前面板Pre l/r/u/d切换当前面板Pre C-l/r/u/d改变面板大小Pre L/R/U/D改变面板大小Pre q显示面板编号并选择Pre !将面板改为窗口Pre %竖排新建面板Pre “横排新建面板Pre z关闭面板

参考配置文件

# setw == set-window-option# set -s server option# set -g global option# bind == bind-key# add manpage highlightset -g default-terminal "screen-it"set -g prefix C-s# get out of delay timeset -sg escape-time 1# repeat-timeset -g repeat-time 1000# let window/pane begin at 1set -g base-index 1set -g pane-base-index 1setw -g mode-keys vi# status-barset -g status-utf8 onset -g status-left-length 40set -g status-left "#[fg=black]Session: #S #[fg=blue]#I #[fg=red]#P"set -g status-right "#[fg=black]%d %b %R"set -g status-justify centre# mouseset -g mode-mouse onset -g mouse-resize-pane onset -g mouse-select-pane onset -g mouse-select-window on# keybindsunbind C-bbind C-s send-prefixbind r source-file ~/.tmux.conf \; display "Reloaded!"# windowsbind -r C-h select-window -t :-bind -r C-l select-window -t :+bind x last-window# panesbind | split-window -hbind -r h select-pane -Lbind -r j select-pane -Dbind -r k select-pane -Ubind -r l select-pane -Rbind -r H resize-pane -L 5bind -r J resize-pane -D 5bind -r K resize-pane -U 5bind -r L resize-pane -R 5bind z kill-pane# copy and pastebind Escape copy-modebind p paste-bufferbind -t vi-copy 'v' begin-selectionbind -t vi-copy 'y' copy-selection# toggle log panebind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"

参考

  1. Tmux: Productive Mouse-Free Development
  2. TMUX: The Terminal Multiplexer (Part 1)
  3. TMux: The Terminal Multiplexer (Part 2)
  4. 使用 Tmux
from: http://mindonmind.github.io/notes/linux/tmux.html
0 0
原创粉丝点击