Quick GNU Screen Howto

In Linux, I use screen to start continuous processes on my headless server, so that processes will keep going even though I log out. Here’s a quick how to.

[sigg3@gamer ~]$ ssh sigg3@192.168.1.12
sigg3@sheeva:~$ screen

Screen welcome screen (just hit ENTER)

sigg3@sheeva:~$ nano \\ replace with your program here

type some stuff in nano

CTRL+a d \\ e.g. Detach from screen session

[detached from 2276.pts-0.sheeva] \\ your program is still running
sigg3@sheeva:~$
sigg3@sheeva:~$ logout
Connection to 192.168.1.12 closed.
[sigg3@gamer ~]$ ssh sigg3@192.168.1.12
sigg3@sheeva:~$ screen -ls \\ list running sessions
There are screens on:
2776.pts-0.sheeva (11/27/2013 04:17:01 PM) (Detached)
2170.pts-0.sheeva (11/26/2013 07:08:28 PM) (Detached)
2 Sockets in /var/run/screen/S-sigg3.
sigg3@sheeva:~$ screen -r 2776.pts-0.sheeva \\ re-attach to screen

Type more stuff and exit nano

sigg3@sheeva:~$ screen -ls
There are screens on:
2776.pts-0.sheeva (11/27/2013 04:17:00 PM) (Attached)
2170.pts-0.sheeva (11/26/2013 07:08:27 PM) (Detached)
2 Sockets in /var/run/screen/S-sigg3.
sigg3@sheeva:~$
CTRL+a k \\ e.g. Kill the screen session I'm in
[really kill this window? y/n] y
[screen is terminating]
sigg3@sheeva:~$
sigg3@sheeva:~$ screen -ls
There is a screen on:
2170.pts-0.sheeva (11/26/2013 07:08:28 PM) (Detached)
1 Socket in /var/run/screen/S-sigg3.

sigg3@sheeva:~$ logout
Connection to 192.168.1.12 closed.
[sigg3@gamer ~]$ echo "That's all, folks"
That's all, folks

For more screen commands, see the man page for screen

One thought on “Quick GNU Screen Howto

Leave a Reply

Your email address will not be published. Required fields are marked *


× six = 6

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>