Home tmade.de

Home Wiki

SCREEN

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

or

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

If you are running screen as root-user you can activate the logging in any path/ folder. If you running the logging as non-root, you have to make sure to have write-permissions in the running path! The logging-file “screenlog.0” will be written in the path you started the screen-session.

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

or

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

Terminate all screen-sessions:

screen -X quit

Terminate single screen-session:

screen -X -S ID quit

Example:

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: 2024/01/05 11:38 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