Home tmade.de

Home Wiki


With “screen” you can run a shell in background (for e. g. running scripts), but when shell terminates, screen still runs!

You can start screen by executing



screen -S some-session-name

Optional: Start logging (each command executed in screen will be written to a file such as “screenlog.0” in the home directory of the screen executing user):

ctrl + a H

Detach from running screen:

ctrl + ad

List all screen-sessions:

screen -ls

If there´s just one screen running attach:

screen -r

If there´s are several screen running and you want to attach to:

1. execute:

screen -ls

Example output:

root@demo-host:~# screen -ls
There are screens on:
        15893.pts-0.demo-host  (05/27/2016 03:46:27 PM)        (Detached)
        1864.pts-0.demo-host   (05/27/2016 12:27:05 PM)        (Detached)
2 Sockets in /var/run/screen/S-root.

2. execute:

screen -r 1864.pts-0.demo-host


screen -r -S 1864.pts-0.demo-host

Terminate all screen-sessions:

screen -X quit

Terminate single screen-session:

screen -X -S ID quit


screen -X -S 1864.pts-0.demo-host quit

Attach to an already attached session (e. g. after network disconnect):

screen -rd
screen -r -d 30608
linux/screen.txt · Last modified: 2020/10/22 16:52 by tmade
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki