Tmux参考文档:
阮一峰-Tmux 使用教程
github地址
一开始只知道screen,但是screen这个工具在某些情况下无法使用,参考文章:docker中使用screen报错 /bin/sh: 1: __git_ps1: not found,所以以后只会使用Tmux。
常见使用如下:
> tmux new -s train
# 创建一个名为train的新会话
> tmux detach
# 退出当前会话,回到之前的bash中
> tmux attach -t train
# 回到train这个会话中
# tmux ls命令可以查看当前所有的 Tmux 会话。
> tmux ls
train: 1 windows (created Fri May 7 03:01:42 2021) [130x44]
# 返回之前创建的某个会话的界面中
> tmux attach -t <session-name>
# 例如 tmux attach -t train
# 注意 如果在session中使用exit,这个session就会被关闭