如何使用 screen bash 命令解决此问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3118144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 22:15:19  来源:igfitidea点击:

How to fix up this problem with screen bash command?

bashgnu-screen

提问by httpinterpret

I accidently deleted /var/run/screen/S-root/25771.pts-0and when I try to run screen again

我不小心删除了/var/run/screen/S-root/25771.pts-0当我再次尝试运行屏幕时

screen bash ...

it reports:

它报告说:

/var/run/screen/S-root/25771.pts-0: No such file or directory

/var/run/screen/S-root/25771.pts-0: No such file or directory

How can I recover it?

我怎样才能恢复它?

采纳答案by silent

It means you are already in screen named "bash"

这意味着您已经在名为“bash”的屏幕中

Just exit it with "exit" command. And run again "screen bash"

只需使用“exit”命令退出即可。然后再次运行“screen bash”

回答by davidg

Check to see if you have the environment variable STYset:

检查您是否STY设置了环境变量:

[user@machine ~] echo $STY
25771.pts-0

If the variable is set, then you are telling screento reattach to an existing session. If that session doesn't exist, then you will see the error you are getting.

如果设置了该变量,那么您是在告诉screen重新附加到现有会话。如果该会话不存在,那么您将看到您收到的错误。

To solve this, just clear the environment variable by running:

要解决这个问题,只需运行以下命令清除环境变量:

export STY=

and try starting screenagain.

并尝试screen重新开始。

This scenario may have occurred because you previously had a screen session running (which setup the STY environment variable for you) which has now closed. For example:

发生这种情况可能是因为您之前运行了一个屏幕会话(为您设置了 STY 环境变量),而现在该会话已关闭。例如:

xterm
screen
# The following xterm will inherit the existing STY environment variable.
xterm &
# close the initial xterm, and in the new xterm run the following:
screen

The final call to screenwill give you your error, because it still has the environment variable STYfrom the original (now-gone) screensession.

最后的调用screen会给你你的错误,因为它仍然具有STY来自原始(现在已经消失)screen会话的环境变量。

回答by andcoz

IMHO if you deleted the screen socket, there is no method to recover that screen instance.

恕我直言,如果您删除了屏幕套接字,则无法恢复该屏幕实例。

You have to exit from screen and run it again.

您必须退出屏幕并再次运行它。

回答by fbs0601

If you don't find a session to exit or kill and get the same "No such file or directory" error every time you try to start screen, try "screen -wipe".

如果每次尝试启动 screen 时都找不到要退出或终止的会话并得到相同的“没有这样的文件或目录”错误,请尝试“screen -wipe”。