问题描述
我在Linux下以交互模式运行R,并且错误地键入了一个需要永远运行的命令.我通常使用 + 停止它.但这并不总是有效.当它不起作用时,还有另一种方法吗?
I'm running R in interactive mode under Linux and mistakenly typed in a command that takes forever to run. I usually stop it using + . But it doesn't work all the time. When it doesn't work, is there another way?
我不想杀死R会话以重新开始.
I don't want to kill the R session to start over either.
推荐答案
我遇到了您提到的问题.当R能够意识到哦,这个家伙/女孩要我停止运行该特定命令时, + 将起作用.但是,R通常无法做到这一点.因此,您必须运行 + (请注意,这是一个反斜杠,而不是正斜杠).这告诉Linux嘿,R不听我的话,您可以停止运行R吗?".
I have had the problem you mention. + will work when R is able to realize "Oh, this guy/gal wants me to stop running that particular command." However, often R cannot do that. So you have to run + (note that it's a backslash, not a forward slash). This tells Linux "Hey, R is not listening to me, can you stop running R?".
首先尝试 + ,因为如果可以,您仍然可以进行R会话.如果它不起作用,并且您执行 + ,则会丢失R会话,但至少会停止该过程.
Try + first, because if it works you will still have your R session. If it doesn't work, and you do + you will lose your R session, but at least it stops the process.
如果这也不起作用,那么我建议您通过运行pus aux
在killall R
或kill -9 [PID]
中找到PID.
If that doesn't work either, then I would suggest a killall R
or a kill -9 [PID]
where you find the PID by running pus aux
.
这篇关于除了Ctrl + C,如何在Linux中停止正在运行的R命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!