Kill disconnect screen session [closed]

Dowiedziałem się, że gdzieś odłączony ekran może zostać zabity przez

Screen-X-S [session # you want to kill] kill

Gdzie [session # you want to kill] można dostać z

Screen-ls .

Ale to nie działa. Coś nie tak? Jaki jest właściwy sposób?

Author: Vadim Kotov, 2009-10-02

11 answers

"kill" zabije tylko jedno okno ekranu. Aby "zabić" całą sesję, użyj quit.

Przykład

$ screen -X -S [session # you want to kill] quit
 993
Author: innaM,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-01-24 18:11:53

Możesz usunąć odłączoną sesję, która nie odpowiada w ramach sesji ekranu, wykonując następujące czynności.

  1. Wpisz screen -list, aby zidentyfikować odłączoną sesję ekranu.

    ~$ screen -list  
        There are screens on:  
             20751.Melvin_Peter_V42  (Detached)  
    

    Uwaga: 20751.Melvin_Peter_V42 to identyfikator sesji.

  2. Dołącz do oddzielnej sesji ekranu

    screen -r 20751.Melvin_Peter_V42
  3. Po połączeniu z sesją naciśnij Ctrl + a następnie wpisz :quit

 451
Author: Melvin Peter,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-03-03 19:47:07

Ekrany listy:

screen -list

Wyjście:

There is a screen on:
23536.pts-0.wdzee       (10/04/2012 08:40:45 AM)        (Detached)
1 Socket in /var/run/screen/S-root.

Kill screen session:

screen -S 23536 -X quit
 118
Author: nilloc,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-10 12:43:38

Łatwiej jest zabić sesję, gdy podano jakąś wymowną nazwę:

//Creation:
screen -S some_name proc
// Kill detached session
screen -S some_name -X quit
 107
Author: Hitman_99,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-09-30 13:09:46

Możesz po prostu przejść do miejsca, w którym znajduje się sesja ekranowa i uruchomić:

 screen -ls

Co daje

 There is a screen on:
         26727.pts-0.devxxx      (Attached)
 1 Socket in /tmp/uscreens/S-xxx. <------ this is where the session is.

I po prostu usuń:

  1. cd /tmp/uscreens/S-xxx
  2. ls
  3. 26727.pts-0.devxxx
  4. rm 26727.pts-0.devxxx
  5. ls

Katalog uscreens nie będzie już zawierał pliku 26727.pts-0.devxxx. Teraz aby się upewnić wpisz to:

screen -ls

I powinieneś dostać:

Nie znaleziono gniazd w /tmp / uscreens / S-xxx.

 40
Author: rc2012,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-03-03 19:49:56
screen -wipe

Powinien wyczyścić wszystkie dead sesje ekranowe.

 24
Author: Vishv Jeet,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-02-12 23:30:14

Dla mnie prosty

exit
Działa. To jest z sesji ekranu.
 18
Author: Nick Desaulniers,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-10-18 04:52:11

Dodaj to do swojego ~/.bashrc:

alias cleanscreen="screen -ls | tail -n +2 | head -n -2 | awk '{print $1}'| xargs -I{} screen -S {} -X quit"

Następnie użyj cleanscreen, aby wyczyścić całą sesję ekranu.

 17
Author: user2115803,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-03-03 19:50:02

Aby zabić wszystkie odłączone sesje ekranowe, Włącz tę funkcję w swoim .bash_profile:

killd () {
for session in $(screen -ls | grep -o '[0-9]\{5\}')
do
screen -S "${session}" -X quit;
done
}

Aby go uruchomić, zadzwoń killd

 15
Author: Rose Perrone,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-21 21:02:52
== ISSUE THIS COMMAND
[xxx@devxxx ~]$ screen -ls


== SCREEN RESPONDS
There are screens on:
        23487.pts-0.devxxx      (Detached)
        26727.pts-0.devxxx      (Attached)
2 Sockets in /tmp/uscreens/S-xxx.


== NOW KILL THE ONE YOU DONT WANT
[xxx@devxxx ~]$ screen -X -S 23487.pts-0.devxxx kill


== WANT PROOF?
[xxx@devxxx ~]$ screen -ls
There is a screen on:
        26727.pts-0.devxxx      (Attached)
1 Socket in /tmp/uscreens/S-xxx.
 7
Author: duggi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-06-30 16:14:03

Alternatywnie, podczas sesji na ekranie wystarczy wpisać exit

Spowoduje to przerwanie sesji powłoki zainicjowanej przez ekran, co skutecznie zakończy sesję ekranu, na której jesteś.

Nie trzeba przejmować się identyfikatorem sesji ekranu itp.

 5
Author: dat789,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-03-02 11:21:37