我从某个地方了解到,分离的屏幕可能会被
screen -X -S [session # you want to kill] kill
可以从中获取[您要终止的会话#]
screen -ls
但这行不通。有什么问题吗?正确的方法是什么?
我从某个地方了解到,分离的屏幕可能会被
screen -X -S [session # you want to kill] kill
可以从中获取[您要终止的会话#]
screen -ls
但这行不通。有什么问题吗?正确的方法是什么?
当前回答
对我来说
exit
作品这是在屏幕会话中进行的。
其他回答
screen -wipe
应清除所有死屏会话。
要终止所有分离的屏幕会话,请在.bash_profile中包含此函数:
killd () {
for session in $(screen -ls | grep -o '[0-9]\{5\}')
do
screen -S "${session}" -X quit;
done
}
要运行它,请调用killd
将此添加到~/.bashrc:
alias cleanscreen="screen -ls | tail -n +2 | head -n -2 | awk '{print $1}'| xargs -I{} screen -S {} -X quit"
然后使用cleanscreen清理所有屏幕会话。
== 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.
列表屏幕:
screen -list
输出:
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.
终止屏幕会话:
screen -S 23536 -X quit