#screen -S "Screenname"
Eg.:
#screen -S "testscreen"
--> 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
--> 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
Now we are running small test script in "testscreen".
#/test.sh >>data.txt & //ran script test.sh to append hello and date/time in data.txt
[1] 4917
#/test.sh >>data.txt & //ran script test.sh to append hello and date/time in data.txt
[1] 4917
Cntrl+A then D //it will detach
[detached]
# screen -list //list currently running screen
There is a screen on:
3015.testscreen (Detached)
1 Socket in /var/run/uscreens/S-alhatul.
[detached]
# screen -list //list currently running screen
There is a screen on:
3015.testscreen (Detached)
1 Socket in /var/run/uscreens/S-alhatul.
Reattch screen using following command
screen -r ScreenID
#screen -r 3015 //reattach screen
Agent pid 21981
screen -r ScreenID
#screen -r 3015 //reattach screen
Agent pid 21981
output of screen command
Output of test.sh
===data.txt ======
===data.txt ======
#cat 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
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.
No comments:
Post a Comment