tmux的使用

常见操作

目标操作 操作 (中文) 键盘快捷键 (默认前缀 Ctrl + b + 键) 命令 (在 Shell 中运行)
会话 (Session) 操作
创建 ==创建一个新的 Session 并附着== 无 (或直接运行 tmux) tmux new -s <名称>
分离 从当前 Session 分离(保持后台运行) d tmux detach
附着 附着到最近或指定的 Session tmux attach -t <名称>
列表 列出所有正在运行的 Session。==方向键上下移动选中session后按回车,进入对应session。== s tmux ls
删除 ==删除session==/kill session tmux kill-session -t $SESSION_NMAE
窗口 (Window) 操作
新建 ==在当前 Session 中新建一个 Window== c tmux new-window -n <名称>
切换 切换到下一个 Window n tmux next-window
切换 切换到上一个 Window p tmux previous-window
切换 ==切换到指定编号的 Window== 09 tmux select-window -t <编号>
重命名 ==重命名当前 Window== , tmux rename-window <新名称>
关闭 ==关闭当前 Window==/kill window & tmux kill-window
窗格 (Pane) 操作
水平分割 ==将当前 Pane 水平分割(上下)== " (双引号) tmux split-window
垂直分割 ==将当前 Pane 垂直分割(左右)== % (百分号) tmux split-window -h
切换 切换到下一个 Pane o tmux select-pane -t :.+
移动 ==移动到上下左右的 Pane== Arrow Keys (方向键) tmux select-pane -<方向>
最大化/恢复 ==最大化或恢复当前 Pane== z tmux zoom-pane
删除 ==删除当前pane==/kill pane x

配置文件

vi ~/.tmux.conf
set -g mouse on //添加鼠标支持