# 1 新建会话
alias tnew="tmux new -s "
# 2 分离会话(ctrl+a d)
alias tdetach="tmux detach"
# 3 列出会话(ctrl+a s)
alias tlist="tmux ls"
# 4 接入会话
alias tattach="tmux attach -t "
# 5 杀死指定会话
alias tkill="tmux kill-session -t "
# 6 杀死全部会话
alias tkillall="tmux kill-server"
# 7 切换会话
alias tswitch="tmux switch -t "
# 8 重命名会话(ctrl+a $)
alias trename="tmux rename-session -t "
# 9 窗口上下划分窗格
alias tsplitud="tmux split-window"
# 10 窗口左右划分窗格
alias tsplitlr="tmux split-window -h"
# 11 光标到上方窗格
alias tmoveu="tmux select-pane -U"
# 12 光标到下方窗格
alias tmoved="tmux select-pane -D"
# 13 光标到上方窗格
alias tmovel="tmux select-pane -L"
# 14 光标到上方窗格
alias tmover="tmux select-pane -R"
# 15 交换窗格位置(当前窗格上移)
alias tswapu="tmux swap-pane -U"
# 16 交换窗格位置(当前窗格下移)
alias tswapd="tmux swap-pane -D"




alias tnew="tmux new -s "
alias tdetach="tmux detach"
alias tlist="tmux ls"
alias tattach="tmux attach -t "
alias tkill="tmux kill-session -t "
alias tkillall="tmux kill-server"
alias tswitch="tmux switch -t "
alias trename="tmux rename-session -t "
alias tsplitud="tmux split-window"
alias tsplitlr="tmux split-window -h"
alias tmoveu="tmux select-pane -U"
alias tmoved="tmux select-pane -D"
alias tmovel="tmux select-pane -L"
alias tmover="tmux select-pane -R"
alias tswapu="tmux swap-pane -U"
alias tswapd="tmux swap-pane -D"

配置

# add config file
echo "  " >  ~/.tmux.conf
cat>~/.tmux.conf<<EOF
# Send prefix
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix


# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window

# Mouse mode
set -g mouse on


# Set easier window split keys
bind-key v split-window -h
bind-key h split-window -v

# Easy config reload
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
EOF

tmux source ~/.tmux.conf