tmux工具

  1. 一、安装tmux
  2. 二、常用命令
  3. 三、tmuxp
    1. 安装
    2. tmux插件 tmux-resurrect
    3. 使用
  4. 四、常用快捷键-待整理

一、安装tmux

1
brew install tmux

Oh_my_tmux地址:

https://github.com/gpakosz/.tmux

1
2
3
4
# ~/.tmux.conf 的配置

# 开启 鼠标模式
set -g mouse on

image-20220416212135602

二、常用命令

http://louiszhai.github.io/2017/09/30/tmux/

1
2
3
4
5
6
7
8
9
tmux new -s <title>

tmux ls

tmux a -t <title>

tmux kill-server

tmux kill-session -t <title>

三、tmuxp

安装

https://github.com/tmux-python/tmuxp

https://tmuxp.git-pull.com/

1
2
3
4
5
pip install --user tmuxp
# or
brew install tmuxp
# or
sudo apt install tmuxp
1
2
3
4
5
6
7
8
9
10
11
12
13
session_name: 4-pane-split
windows:
- window_name: dev window
layout: tiled
shell_command_before:
- cd ~/ # run as a first command in all panes
panes:
- shell_command: # pane no. 1
- cd /var/log # run multiple commands in this pane
- ls -al | grep \.log
- echo second pane # pane no. 2
- echo third pane # pane no. 3
- echo forth pane # pane no. 4
1
tmuxp load ./mysession.yaml

tmux插件 tmux-resurrect

1
2
3
4
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect' # <-- 这个是新添加的

重启 tmux 之后, 输入 prefix + I, 就会自动安装 plugin

使用

tmux-resurrect 的使用非常简单, 默认的保存和恢复 session 的快捷键如下:

  • prefix + Ctrl-s Save
  • prefix + Ctrl-r Restore

四、常用快捷键-待整理


转载请注明来源,欢迎指出任何有错误或不够清晰的表达。可以邮件至 xiyugee@qq.com