back to Today I Learned page

Linux Screen - The Basics

posted at 24-01-2023

I always need to Google how to use a screen in Linux, every time I need to run parallel scripts or whenever I need to leave a process running for a long time, that's why I decided to add here what I always use and then I won't need to Google it again.

A simple explanation about Linux Screen:

Screen or GNU Screen is a terminal multiplexer. In other words, it means that you can start a screen session and then open any number of windows (virtual terminals) inside that session (this is a quote from Linuxize, in this link you can see how to install and so many other commands, tricks and so on, I'll only state here the commands that I use)

screen -ls - List all screens

screen -S name_of_the_screen - Create a new Screen with the given name

CTRL A + D - Detach from a screen

screen -r 123.name_of_the_screen - Reattach to the given screen (the screen needs to be detached)

screen -D 123.name_of_the_screen - Detach an attached screen