The screen command is used to run more than one virtual console - for example, if we connect to a shell account using putty, instead of running it multiple times we can use the screen command.
In my opinion, however, the most interesting feature of the screen program is the ability to detach the program from the console. It then becomes a daemon. We can log out of the system, and the programs running inside it will keep running. To create a new session, just type the screen command in the terminal. This gives us access to a shell that at first glance seems unchanged, but in this article I'll focus on running programs that will keep running after we log out. For this we type the command screen application.
Example:
screen wget ftp://ftp.netroedge.com/pub/lm-sensors/lm_sensors-2.10.7.tar.gz.
At this point we've started the download in a virtual console. With the key combination Ctrl + a d we suspend the program in the background (the text [detached] will appear) and now we can log out normally while wget keeps running. When we want to log back into the detached session we type screen -r. Once the download (wget) finishes, screen also stops running. We can run more sessions, detaching from the current one and creating new ones. However, when we want to connect to any of them, we need to know its PID. After typing screen -ls we'll see a list of suspended shells and their PIDs. A more convenient way to run more than one console is to give them names by which we'll refer to them later.
screen -S session_name application. Then we can easily reconnect to it by simply typing screen -r session_name.