Skip to Content
All memories

Screen command in Linux

 — #linux

Use screen command to create a new virtual window from a single SSH session, and run other stuff there. In the example below we’ll be installing screen and then running a Django dev server in a new virtual terminal window.

apt-get install screen
python runserver

You will see that Django server has started running. Now press Ctrl+A and then press the D key to detach from that screen. It will say:

[detached from ###.pts-0.hostname]

You can now safely logout from your terminal, log back in to your terminal, do other bits of coding in other directories, go for a vacation, do whatever you want.

To return to the screen that you have detached from

screen -r

To kill the django server now, simply press Ctrl+C like you would’ve done normally.

To terminate this current screen instead of detaching from this screen, use Ctrl+D. It will say:

[screen is terminating]

For more information about using screen check out thease articles: