Tmux终端复用器下载安装及配置文件(超好用)

1.Tmux简介

tmux是一款非常好用的终端复用软件,曾经的你是不是还在为开n个终端而烦恼呢,有了tmux就可以实现多终端显示在一个桌面上,分屏丝滑,当然还有其他功能,比如保护现场等等就不具体介绍了。

2.安装步骤

Linux安装:

sudo apt-get install tmux

3.配置文件

切回家目录
cd ~
打开一个tmux的配置文件,命名为“ .tmux.conf ”
vim .tmux.conf
拷贝配置文件:
unbind  C-b
set-option -g prefix C-x
bind-key C-x send-prefix

# paste
bind p paste-buffer

# split panes using | and -
bind-key = split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on

# don't rename windows automatically
set-option -g allow-rename off

######################
### DESIGN CHANGES ###
######################

## Status bar design

set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2

# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "


# Info on left (I don't have a session display for now)
set -g status-left ''


# The modes {
setw -g clock-mode-colour colour135
# }

# The statusbar {

#set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137

# set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# }

# manpage highlight {
set -g default-terminal "xterm"
# }

bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -T copy-mode-vi    C-WheelUpPane   send-keys -X halfpage-up
bind -T copy-mode-vi    C-WheelDownPane send-keys -X halfpage-down
bind -T copy-mode-emacs C-WheelUpPane   send-keys -X halfpage-up
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down

# To copy, left click and drag to highlight text in yellow,
# once you release left click yellow text will disappear and will automatically be available in clibboard
# # Use vim keybindings in copy mode
setw -g mode-keys vi
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
输入:wq保存文件并退出
命令行输入tmux,进入tmux

按“ctrl + x” 松开后立刻按冒号 “ :”,进入tmux的命令行界面,而后输入下列命令并回车,使得刚才配置的文件生效:

source-file  ~/.tmux.conf
然后输入exit退出tmux,再次进入即可生效

4.快捷键说明

tmux想要进行操作,首先要按ctrl+x松开之后再按相应的健才能生效。

ctrl+x “+” —— 左右分屏

在这里插入图片描述

ctrl+x “-” —— 上下分屏

在这里插入图片描述

切屏:(支持鼠标进行切换)

ctrl + x "⬆️/⬇️/⬅️/➡️”

面板大小调整:

支持鼠标操作,按住边框拖动即可调整大小,非常方便
在这里插入图片描述

好啦,基本上只需要掌握以上功能就可以愉快使用啦。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值