Several times I have encountered a situation where I was doing remote SSH to VPS for installation and configuration suddenly the internet connection had a problem and the SSH connection was lost. Well, the previous process was not known where it was or could not continue the previous session. To solve a case like this, there is a utility program called *screen*.
By using screen, a sysadmin can create multiple terminals virtually in one screen, can switch virtual terminals, and when an SSH connection is lost, they can resume or reopen a virtual terminal that is still running.
Install screen on Debian/Ubuntu.[INPUT]
1 sudo apt install screen
Install screen on CentOS/Fedora.[INPUT]
1 2 sudo yum install screen sudo dnf install screen
For example, if you want to update, create a new screen with the name update.[INPUT]
1 screen -S update
After running the command above, it will go directly to the screen (Attached). If you want to temporarily exit the screen that is currently active (Detached), for example when the update process is running you want to do another configuration, press *CTRL + A then D*, and a message will be displayed:[INPUT]
1 [detached from 15321.update]
Create a new screen named config.[INPUT]
1 screen -S config
Display all available screens with the option *-ls*.[INPUT]
1 2 3 4 5 6 screen -ls There are screens on: 15525.config (11/07/20 08:32:17) (Attached) 15321.update (11/07/20 08:29:58) (Detached) 2 Sockets in /run/screen/S-musa.
To re-enter the update screen use the *-r* option followed by a screen name or screen id number.[INPUT]
1 2 screen -r update screen -r 15321
Permanently exiting the screen type *exit* or *CTRL + D*. A message will be displayed:[INPUT]
1 [screen is terminating]
Good luck ð