After using SSH or telnet to log on to the remote host, some time-consuming commands are executed, and if SSH or Telnet is interrupted at this time, the program or command being executed on the remote host will be forced to terminate. For example, you need to execute a remote login after a time-consuming instructions such as SVN checkout, then immediately after work, you have to shut down your computer to leave, how to do? Screen is a good solution to this problem. Screen, also known as virtual Terminal, can realize the effect of multiple virtual terminals on a physical terminal. Very practical.
Here's a general usage:
1. Create a new screen
Direct screen or screen-s xxx (XXX is the name you specified for this screen)
2. Create a new virtual terminal in screen (you will have two virtual terminals in screen now)
Ctrl+a+c (Press CTRL + A, then press C, and the following commands are the same)
3. Switch between virtual terminals
Previous Ctrl+a+p
After a ctrl+a+n
List select ctrl+a+shift+ "
4. Close a virtual terminal
Ctrl+a+k or exit
5. Hang screen (you're back to the shell that created screen after you've hung up)
Ctrl+a+d
6. Reconnect screen
SCREEN-LS lists the currently suspended screen
For example, there is a "8888.XXX (Detached)"
Then you can use screen-r 8888 or screen-r xxx to reconnect.
For the article at the beginning of the question, you should be able to solve, you connect to the remote host, do not rush to run your instructions, but first create a screen, and then run your instructions in the virtual terminal, screen, to disconnect before you hang up screen, The next time you're in, you just need to reconnect your screen, and you'll see that your instructions have been executed or are executing rather than being interrupted.
More than normal usage is sufficient, if needed more, please direct screen--help. By the way, the general distribution is not with this software, you need to install yourself, Ubuntu under the direct sudo apt-get install screen.
Introduction to Linux screen commands