Original article: linuxize.com/post/how-to-use-linux-screen
sudo apt update ; sudo apt install screen
sudo yum install screen
Execute a new screen.
Valid screen with
Enter key and you are into a screen, you can execute any command with a really long time of execution. After this, you can
detach screen with
D. You will be back into SSH session, you can get back your screen with
screen -r to
reattach it if you have one screen.
Now you can check yours screens with
screen -ls and
reattach any with ID like
10835.pts-0.linuxize-desktop (Detached) with
screen -r 10835.
Of course you can exit SSH session and screen will continue to execute command in background.
There are screens on: 10835.pts-0.linuxize-desktop (Detached) 10366.pts-0.linuxize-desktop (Detached) 2 Sockets in /run/screens/S-linuxize.
screen -r 10835
To start a screen session.
cCreate a new window (with shell).
"List all windows.
0Switch to window 0 (by number).
ARename the current window.
SSplit current region horizontally into two regions.
|Split current region vertically into two regions.
tabSwitch the input focus to the next region.
Ctrl+aToggle between the current and previous windows
QClose all regions but the current one.
XClose the current region.
dDetach from the screen session, the program running in the screen session will continue to run after detach.