This is a simple one. For some reason, every time I use the screen command in terminal, I forget the commands.
There are probably lots of cool reasons to use screen but I use it to run a script over a longish period. The advantage of screen is I can start the script in the screen instance and detach from it. I can close my laptop and return later to my terminal, open my screen and check the progress of the script. Also, you can run multiple instances of a script as each screen has its own process.
So the basic commands I use and tend to forget are…
Create a screen with a label so you know what it’s for:
screen -S 'run-long-script1'
Detach from the screen:
Ctrl + a + d
Kill the screen:
Check what screens you have created:
Open a screen that you have already created:
screen -r 'run-long-script1'
Access the extensive screen manual:
Found this guide helpful from thegeekstuff.