Screen is super-useful because it allows you to run terminal commands without needing to have your terminal window open.
Think of a screen as a session: you can open a screen, start a script, and then detach from it. The script will keep running in the background, but you can keep doing whatever you were doing without affecting the script. More significantly, if you want to be able to step away from your terminal, or close your laptop, or let a task run overnight without needing you to be connected, use a screen.
This quick tutorial will walk you through the basic commands necessary to get a screen working without worrying about what's going on behind the scenes.
$ screen -S <NAME>
$ ruby download_the_entire_internet.rb
This will run inside the screen, so you can freely switch out of the screen if you want.
Ctrl-a d
(hold Ctrl+a and click d)
This won't affect anything running in the screen.
$ screen -ls
Like ls
in a directory, but for screens! Cool!
$ screen -Dr <NAME>
This will now bring your terminal window into a specific screen.
$ exit
from within the screen, or if you want to do it from your regular interface, you can run
$ screen -X -S <NAME> quit
If you're curious about what more you can do with screen, check out a helpful guide or (if you're brave) the documentation.