For people who often operate on-line, there is a kind of annoyance, is in the operation process, something left a bit, the computer automatically sleep, and then the network disconnected, this time the task will run again, very vexed.
Tmux can solve this problem. Tmux can be seen as a virtual screen, not affected by the broken network. If the network is off, just reconnect the screen, and the text on the virtual screen is still there.
Common commands for Tmux are as follows:
new-s-t session_nametmux lsControl+B d: 暂时断开连接,正在执行的任务不会退出Control+B PageUp/PageDown:上下滚屏
How to improve work efficiency with TMUX? That is to automatically open the Tmux when working on a springboard machine. My way of working is like this.
First define alias on the local computer and connect the springboard as a command:alias gate=‘ssh [email protected] ~/opentmux.sh‘
~/opentmux.sh
the content on the springboard is as follows:
#!/bin/bash# 找出未连接的屏幕1‘^[^:]+‘`# 如果找不到未连接的屏幕,就新建屏幕if"$session_name"then tmux exit# 连接现有屏幕else "$session_name" exitfi
In this way, each time you connect a springboard machine, you automatically look for the Detach status screen and then automatically attach. If all are attach, create a new window.
This way even if the network is broken, the next time connecting the Board machine, the task is still in operation. For frequent on-line operation can be unaffected by the broken network, greatly enhance the operation experience.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
On-line operation to increase productivity with tmux