Coder Perfect

In Linux, you can disable the attached screen.

Problem

In Linux, I built a screen called “myscreen,” and it immediately ceased responding. I tried to reopen the terminal after closing it. The screen is Attached, as shown by “screen -ls.” I tried the following commands, but they didn’t work.

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

Any assistance in reattaching to the screen or killing the screen would be greatly appreciated.

Asked by Slowcoder

Solution #1

screen -X -S SCREENID kill

Alternatively, you can use the command shown below.

screen -S SCREENNAME -p 0 -X quit

By typing screen -ls, you can get a list of all active screen sessions.

Answered by Desta Haileselassie Hagos

Solution #2

Create a screen using the Terminal:

screen -S <screen_name>

To see a list of screens, click here.

<screen -ls> or <screen -list>

To get to a specific screen, type:

<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 exit Terminal and kill a screen, type:

<screen -X -S screen_name quit> 

or

<screen -X -S screen_name kill>

You can run commands with screen name or process id.

Answered by naveen nani

Solution #3

This worked quite well for me. Get the screen id by going to:

screen -r

or

screen -ls

then kill the screen with the command kill -9 screenID>. When it becomes a dead screen, use screen -wipe to remove it.

Answered by TheWiz

Solution #4

From Screen User’s Manual ;

screen -d -r "screenName"

Reattach a session after detaching it if necessary.

Answered by Cugomastik

Solution #5

You could write a function that terminates all active sessions. Kill all detached screen sessions is a good place to start.

to list all active sessions use screen -r

When the sessions are presented, select the one you want with your mouse and copy it. similar to this

screen -r

Answered by andreskwan

Post is based on https://stackoverflow.com/questions/14806051/kill-attached-screen-in-linux