#screen -S "Screenname"
Eg.:
--> To deattach the screen:
Cntrl+A then D //it will run after detach also
---> Ctrl-a followed by k: close the current windows (kill)
--> To list the screen:
screen -list
--> To reattach the screen:
screen -r ScreenID------- From screen -list
Example:
# screen -S "testscreen" // create screen name testscreen
Agent pid 21981
#/test.sh >>data.txt & //ran script test.sh to append hello and date/time in data.txt
[1] 4917
[detached]
# screen -list //list currently running screen
There is a screen on:
3015.testscreen (Detached)
1 Socket in /var/run/uscreens/S-alhatul.
screen -r ScreenID
#screen -r 3015 //reattach screen
Agent pid 21981
===data.txt ======
hello
Fri Aug 30 15:21:00 CEST 2019
hello
Fri Aug 30 15:21:02 CEST 2019
hello
Fri Aug 30 15:21:04 CEST 2019
hello
Ctrl-a followed by k:
It will terminate current screen session.
#screen -list
No Sockets found in /var/run/uscreens/S-alhatul.