How to Create Virtual Terminal with Screen

How to Create Virtual Terminal with Screen

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

Install screen on Debian/Ubuntu.

Install screen on CentOS/Fedora.

Run screen

For example, if you want to update, create a new screen with the name 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:

Create a new screen named config.

Display all available screens with the option -ls.

To re-enter the update screen use the -r option followed by a screen name or screen id number.

Permanently exiting the screen type exit or CTRL + D. A message will be displayed:

Leave a Reply

Your email address will not be published. Required fields are marked *