Score:0

Ubuntu 20.04 Terminal Using the Screen Command

bd flag

I've been using the "screen" linux command on an AWS EC2 instance to keep code running 24/7. Recently I tried the command in my ubuntu terminal and found that if I make a screen, run a program, and close the screen properly, the code will continue running even if I turn off WiFi, turn off my computer, etc. I was very surprised by this because I thought the code ran locally in a terminal so would stop running if I did something like this.

Does anyone know how this works? I figure it must be running on ubuntu's servers, but I find that surprising that they wouldn't charge me for that, while AWS does charge.

Sadra Naddaf avatar
de flag
Please describe further where you are running the code? do you open a terminal and just run the screen command? without running `ssh `? Could you please confirm that the username and PC name just before the blinker in the terminal matches your local computer? It is not possible that you turn off a computer and the computer keeps working. So, I believe you are running the command on a remote computer and somehow you are not aware of it.
bd flag
Hey, thanks for the response. You're right, I tried shutting down again and it cut off the screen. It must be running locally and I thought for some reason I had shut down. Thanks for the help!
Sadra Naddaf avatar
de flag
I posted the answer with more details in the answer section; feel free to mark it as an answer. @d22fish
Score:0
de flag

The concept of the screen is to prevent losing access to a session and to prevent code from stopping if the terminal window gets closed/ssh connection drops.

In your case, If the code is running after a reconnect; you are definitely connected to a remote computer. By any shutdown/reboot, all the programs including screen will be stopped, and you have to re-run after startup.

tmux is a more advanced version of screen with a lot more features. I recommend checking out its features and switching if the features suit your type of work.

As of now tmux might be not pre-installed on your distribution; the installation is as easy as:

sudo apt install tmux

or

yum install tmux
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.