Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kill Attached Screen in Linux

I created a screen "myscreen" in linux and it stopped responding abruptly. I closed the terminal and tried to reopen it. "screen -ls" shows that the screen is Attached. I tried the following commands but nothing responds.

screen -r myscreen screen -D myscreen screen -D -RR myscreen screen -X -S myscreen quit 

Any help to reattach to the screen or to kill the screen is very much appreciated.

like image 808
Slowcoder Avatar asked Feb 11 '13 04:02

Slowcoder


People also ask

How do you kill a screen in Linux?

There are 2 (two) ways to leaving the screen. First, we are using “Ctrl-A” and “d” to detach the screen. Second, we can use the exit command to terminating the screen. You also can use “Ctrl-A” and “K” to kill the screen.

How do I kill a dead screen in Linux?

hostname (Attached) Remove dead screens with 'screen -wipe'. 2 Sockets in /tmp/screens/S-username. Once you've done this, you can resume the screen by entering the screen -r command. (In the above example, the dead screen isn't causing problems, but you should probably enter the screen -wipe command to get rid of it.)

What is screen command in Linux?

screen command in Linux provides the ability to launch and use multiple shell sessions from a single ssh session. When a process is started with 'screen', the process can be detached from session & then can reattach the session at a later time.


2 Answers

screen -X -S SCREENID kill 

alternatively, you can use the following command

screen -S SCREENNAME -p 0 -X quit 

You can view the list of the screen sessions by executing screen -ls

like image 176
Desta Haileselassie Hagos Avatar answered Sep 19 '22 14:09

Desta Haileselassie Hagos


Create screen from Terminal:

screen -S <screen_name> 

To see list of screens:

<screen -ls> or <screen -list> 

To go to particular screen:

<screen -x screen_name>  <screen -r screen_name> 

Inside screen


To Terminate screen:

give ctrl+d screen will get terminated 

To Detach screen:

 give <ctrl+ad>or <screen -d >screen will get detached 

To reattach screen:

screen -x <screen_name> or screen -r <screen_name> 

To kill a screen from Terminal:

<screen -X -S screen_name quit>  

or

<screen -X -S screen_name kill> 

You can use screen_name or process_id to execute commands.

like image 28
naveen nani Avatar answered Sep 17 '22 14:09

naveen nani