网站租金可以做办公费吗,手机网站开放配,新手怎么引流推广推广引流,如何弄小程序0、常用参数
tmuxnew-sname 新建名为name的会话#xff08;无-s参数则默认以数字命名#xff09; #xff08;常用#xff09;
tmux a 恢复上一次的会话 #xff08;常用#xff09;
tmux a-tname 恢复#xff08;attach#xff09;名为name的会话 name 新建名为name的会话无-s参数则默认以数字命名 常用
tmux a 恢复上一次的会话 常用
tmux a-tname 恢复attach名为name的会话 常用
tmux ls 列出所有会话 常用
tmux kill-session-tname 关闭名为name的会话 常用
tmux kill-server 关闭所有会话 常用1、创建 tmux
在新创建的 tmux 终端运行exit命令直接退出当前 tmux 会话;返回登录的终端。
如下命令指定创建的 tmux 会话名:
tmux new -s bgscripts
tmux new -s 会话名称2、查看后台运行的 tmux 终端会话列表
运行tmux ls查看当前后台活跃的 tmux 会话
[rootlocalhost ~]# tmux ls
0: 1 windows (created Tue May 9 21:36:45 2023) [80x24]
1: 1 windows (created Tue May 9 21:38:36 2023) [80x24]
2: 1 windows (created Tue May 9 21:38:41 2023) [80x24]
bgscripts: 1 windows (created Tue May 9 21:44:18 2023) [80x24]3、进入指定的 tmux 会话
使用如下命令可以进入指定的 tmux 的会话
tmux attach [-t target-session]
其中 target-session 可以是 tmux 对应的编号也可以是 tmux 对应的会话名。使用 tmux 对应的会话编号
[rootlocalhost ~]# tmux attach -t 1
使用 tmux 会话名
[rootlocalhost ~]# tmux attach -t bgscripts4、分离会话
tmux attach到某个终端后 可以使用ctrlbd或者在终端输入tmux detach分离会话。
5、会话切换
tmux attach连接到某个会话后可以使用tmux switch [-t target-session]切换到指定的 tmux 会话。
[rootlocalhost ~]# tmux ls
0: 1 windows (created Tue May 9 22:03:26 2023) [123x33]
1: 1 windows (created Tue May 9 22:03:31 2023) [123x33]
2: 1 windows (created Tue May 9 22:03:36 2023) [123x33]#连接到会话2
[rootlocalhost ~]# tmux attach -t 2在会话 2 终端执行tmux ls 可以看到显示当前attached的会话为 1
[rootlocalhost ~]# tmux ls
0: 1 windows (created Tue May 9 22:03:26 2023) [123x33]
1: 1 windows (created Tue May 9 22:03:31 2023) [123x33]
2: 1 windows (created Tue May 9 22:03:36 2023) [123x33] (attached)#切换到会话1
[rootlocalhost ~]# tmux switch -t 1在会话 1 终端执行tmux ls
[rootlocalhost ~]# tmux ls
0: 1 windows (created Tue May 9 22:03:26 2023) [123x33]
1: 1 windows (created Tue May 9 22:03:31 2023) [123x33] (attached)
2: 1 windows (created Tue May 9 22:03:36 2023) [123x33]
可以看到显示当前attached的会话为 16、会话重命名
命令tmux rename-session [-toldsession newsession]重命名会话名
[rootlocalhost ~]# tmux rename-session -t1 sess1
[rootlocalhost ~]# tmux ls
0: 1 windows (created Tue May 9 22:03:26 2023) [123x33]
2: 1 windows (created Tue May 9 22:03:36 2023) [123x33]
sess1: 2 windows (created Tue May 9 22:03:31 2023) [123x33] (attached)
tmux 也提供ctrlb$重命名当前 attach 的会话7、销毁会话
在创建会话的时候提及可以在 tmux 会话里面直接使用exit退出会话tmux 提供如下命令销毁会话
tmux kill-session [-a] [-t target-session]
参数-a只保留一个终端其他全部 kill;[rootlocalhost ~]# tmux ls
2: 1 windows (created Tue May 9 21:38:41 2023) [123x33]
4: 1 windows (created Tue May 9 21:56:25 2023) [123x33]
5: 1 windows (created Tue May 9 21:56:32 2023) [123x33]
[rootlocalhost ~]# tmux kill-session -a
[rootlocalhost ~]# tmux ls
5: 1 windows (created Tue May 9 21:56:32 2023) [123x33]
-t杀死指定的 session[rootlocalhost ~]# tmux kill-session -t 5
[rootlocalhost ~]# tmux ls
failed to connect to servertmux kill-server可以直接杀死所有会话和窗口
[rootlocalhost ~]# tmux ls
0: 1 windows (created Tue May 9 22:03:26 2023) [123x33]
2newsession: 2 windows (created Tue May 9 22:03:36 2023) [123x33]
sess1: 2 windows (created Tue May 9 22:03:31 2023) [123x33]
[rootlocalhost ~]# tmux kill-server
[rootlocalhost ~]# tmux ls
failed to connect to server
同样-t可以指定会话名。7、tmux 窗口管理
tmux 创建新窗口 在当前 tmux 会话tmux new-window创建一个新的窗口
tmux new-window [-n windowsname]创建一个名为 windowsname 的窗口可以通过ctrlbnumber选择对应的窗口。