![GNOME-Terminal:在远程计算机上创建新的终端选项卡](https://linux22.com/image/24164/GNOME-Terminal%EF%BC%9A%E5%9C%A8%E8%BF%9C%E7%A8%8B%E8%AE%A1%E7%AE%97%E6%9C%BA%E4%B8%8A%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E7%BB%88%E7%AB%AF%E9%80%89%E9%A1%B9%E5%8D%A1.png)
在通过 ssh 连接的远程计算机上工作时,有没有办法在 GNOME 终端中打开新的终端选项卡?
答案1
tmux(或 screen,较旧的替代品)非常适合于此。
tmux 允许您进行水平和垂直分割。
您可能想要自定义 tmux,例如,大多数人喜欢 cmd-a 而不是 cmd-b 作为“前缀”键。
我使用以下 ~/.tmuf.conf 文件设置来使其更好地工作:
# mdd tmux settings
bind r source-file ~/.tmux.conf \; display "Reloaded!" # Reload with ctrl-r
set -g prefix C-a # prefix from ctrl-b to ctrl-a
unbind C-b # allow ctrl-b for other things
set -sg escape-time 1 # quicker responses
bind C-a send-prefix # Pass on ctrl-a for other apps
set -g base-index 1 # Numbering of windows
setw -g pane-base-index 1 # Numbering of Panes
# bind | split-window -h # Split panes horizontal
bind \ split-window -h # Split panes horizontal
bind - split-window -v # Split panes vertically
bind h select-pane -L # Switch to Pane Left
bind j select-pane -D # Switch to Pane Down
bind k select-pane -U # Switch to Pane Up
bind l select-pane -R # Switch to Pane Right
bind -r C-h select-window -t :- # Quick Pane Selection
bind -r C-l select-window -t :+ # Quick Pane Selection
bind -r H resize-pane -L 5 # Switch to Pane Left
bind -r J resize-pane -D 5 # Switch to Pane Down
bind -r K resize-pane -U 5 # Switch to Pane Up
bind -r L resize-pane -R 5 # Switch to Pane Right
setw -g mode-mouse off # Mouse Off
set -g mouse-select-pane off # Mouse Off
set -g mouse-resize-pane off # Mouse Off
set -g mouse-select-window off # Mouse Off
#set -g default-terminal "screen-256color"
setw -g monitor-activity on # Activity Alerts
set -g visual-activity on
set -g status-fg white # Status line Colors
set -g status-bg black
setw -g window-status-fg cyan # Window list color
setw -g window-status-bg default
setw -g window-status-attr dim
setw -g window-status-current-fg white # Active Window Color
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
set -g pane-border-fg green # Pane colors
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-bg yellow
set -g message-fg white # Command/Message Line.
set -g message-bg black
set -g message-attr bright
set -g status-left-length 40 # Status Line, left side
set -g status-left "#[fg=white]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-utf8 on # Status Line, right side
set -g status-right "-------"
set -g status-interval 60 # frequency of status line updates
set -g status-justify centre # center window list
setw -g mode-keys vi # vi keys to move
unbind v # Open panes in same directory as tmux-panes script
unbind n
bind v send-keys " ~/tmux-panes -h" C-m
bind n send-keys " ~/tmux-panes -v" C-m
unbind Up # Maximizing and Minimizing...
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# Make keys for copy mode be like vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
我还设置了以下别名(在我的 ~/.bash_aliases 文件中),以便我在滚动和复制文本之间切换:
alias tof='tmux set -g mode-mouse off'
alias ton='tmux set -g mode-mouse on'