How to use GNU Screen

How to use GNU Screen

Basic usage

Single terminal

To launch screen, just run


Then run all of your commands like stata -b do filename. When you want to “minimize” the terminal, just press Ctrl+A followed by the D key.

You can then safely log out of ssh without killing the precess that you ran.


When ssh back into the server, you can check back on the process by running

screen -r

This will reopen the terminal that you just closed.

Using tabs

You can create a new tab inside of a screen by pressing Ctrl+A followed by the C key. You will then have a tab 0 and a tab 1.

You can swap between tabs by pressing Ctrl+A followed by Shift+’ (actually Shift+").

You can close a tab by pressing Ctrl+D or just running exit.

Managing multiple screens

You can create a second screen by running


you can list all open screens by running

screen -list
There are screens on:	(Detached)	(Detached)	(Detached)
3 Sockets in /var/run/screen/S-user.

You can specify which screen you want to connect to using the name from the list.

screen -r

The pid (the number part) is also sufficient

screen -r 2044

You can close a screen using Ctrl+D