终止分离的屏幕会话
杀死分离的屏幕,
screen -X -S [session # you want to kill] kill
我从某处了解到,可以通过从[您想要杀死的会话#]获得的位置来
screen -ls
但这不起作用。有什么问题吗?正确的方法是什么?
I learned from somewhere a detached screen can be killed by
screen -X -S [session # you want to kill] kill
where [session # you want to kill] can be gotten from
screen -ls
But this doesn't work. Anything wrong? What's the correct way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
“kill”只会杀死一个屏幕窗口。要“终止”整个会话,请使用
quit
。示例
对于死会话使用:
$ 屏幕-擦拭
"kill" will only kill one screen window. To "kill" the complete session, use
quit
.Example
For dead sessions use:
$ screen -wipe
您可以通过执行以下操作来终止在屏幕会话中没有响应的分离会话。
输入
screen -list
来识别分离的屏幕会话。附加到分离的屏幕会话
连接到会话后,按 Ctrl + A,然后输入
:quit
You can kill a detached session which is not responding within the screen session by doing the following.
Type
screen -list
to identify the detached screen session.Note:
20751.Melvin_Peter_V42
is your session id.Get attached to the detached screen session
Once connected to the session press Ctrl + A then type
:quit
列出屏幕:
输出:
终止屏幕会话:
List screens:
Output:
Kill screen session:
当给出一些有意义的名称时,终止会话会更容易:
It's easier to kill a session, when some meaningful name is given:
您可以转到屏幕会话所在的位置并运行:
这会导致
并删除它:
uscreens
目录不会有 < code>26727.pts-0.devxxx 文件不再存在。现在确保只需输入:screen -ls
,您应该得到:
You can just go to the place where the screen session is housed and run:
which results in
And just remove it:
The
uscreens
directory will not have the26727.pts-0.devxxx
file in it anymore. Now to make sure just type this:screen -ls
and you should get:
应清理所有死屏幕会话。
Should clean all dead screen sessions.
将其添加到您的
~/.bashrc
中:然后使用
cleanscreen
清理所有屏幕会话。add this to your
~/.bashrc
:Then use
cleanscreen
to clean all screen session.对我来说一个简单的
作品。这是来自屏幕会话内的。
For me a simple
works. This is from within the screen session.
要终止所有分离的屏幕会话,请将此函数包含在您的.bash_profile中:
要运行它,请调用
killd
To kill all detached screen sessions, include this function in your .bash_profile:
to run it, call
killd
或者,在屏幕会话中,您只需键入 exit
这将终止屏幕启动的 shell 会话,从而有效地终止您所在的屏幕会话。
无需担心屏幕会话 ID 等。
Alternatively, while in your screen session all you have to do is type exit
This will kill the shell session initiated by the screen, which effectively terminates the screen session you are on.
No need to bother with screen session id, etc.