[英]How to terminate an ssh command that was ran from a remote host?
I ran an ssh command doing the following: ssh user@remote "my command &"
.我运行了一个 ssh 命令,执行以下操作:
ssh user@remote "my command &"
。 Now the process seems to be running in the background, but I cannot find it, and I want to end it.现在该进程似乎在后台运行,但我找不到它,我想结束它。 I've used netstat, but cannot find the process.
我用过netstat,但找不到进程。
I suggest some methods我建议一些方法
sudo killall ssh
It may not be the best method to use this method, it is better to filter first and then close it使用这种方法可能不是最好的方法,最好先过滤然后关闭它
or或者
ps -o pid,cmd | grep ssh
kill -QUIT (pid)
To stop a program, send the QUIT signal.要停止程序,请发送 QUIT 信号。
Didn't you expect it to run in the background?你没想到它会在后台运行吗? Thats what the
&
does.这就是
&
的作用。 You can use ps af
to show all of the processes running under your username.您可以使用
ps af
显示在您的用户名下运行的所有进程。 You can then kill
it by PID.然后你可以通过 PID
kill
它。
Thanks everybody.谢谢大家。 I found the process doing
ps aux
.我发现了执行
ps aux
的过程。 For some reason, the port that it was using wasn't being display in netstat.由于某种原因,它使用的端口没有显示在 netstat 中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.