# 创建一个名为t1的tmux会话,默认初始编号为0 $ tmux new -s t1 # 临时退出当前会话,即分离会话 $ tmux detach # 或使用crtl+b d # 再创建一个新的会话t2和t3 $ tmux new -s t2 $ tmux new -s t3 # 查看当前tmux所有会话 $ tmux ls t1: 4 windows ( created Thu Oct 28 18:09:28 2021 ) [189x42] t2: 1 windows ( created Thu Oct 28 18:12:42 2021 ) [189x42] t3: 1 windows ( created Thu Oct 28 18:14:33 2021 ) [189x42] # 杀死会话t3 $ tmux kill-session -t t3 $ tmux ls t1: 4 windows ( created Thu Oct 28 18:09:28 2021 ) [189x42] t2: 1 windows ( created Thu Oct 28 18:12:42 2021 ) [189x42] # 切入会话t1 $tmux attach-session -t t1 # 从t1会话切换到t2 $tmux switch-client -t t2 # 重命名会话 $ tmux ls t2: 1 windows ( created Thu Oct 28 18:25:57 2021 ) [189x42] t3: 1 windows ( created Thu Oct 28 18:26:02 2021 ) [189x42] $ tmux rename-session -t t2 t4 no current client $ tmux ls t3: 1 windows ( created Thu Oct 28 18:26:02 2021 ) [189x42] t4: 1 windows ( created Thu Oct 28 18:25:57 2021 ) [189x42]