bob*_*obo 120 command-line process jobs background-process
我不小心“停止”了我的telnet进程。现在我既不能“切换回”它,也不能杀死它(它不会响应kill 9292992929 是进程 ID。)
所以,我的问题是,如果你在 linux 命令行上有一个停止的进程,你如何切换回它,或者杀死它,而不必求助于kill -9?
ter*_*don 141
最简单的方法是运行fg将其带到前台:
$ help fg
fg: fg [job_spec]
Move job to the foreground.
Place the job identified by JOB_SPEC in the foreground, making it the
current job. If JOB_SPEC is not present, the shell's notion of the
current job is used.
Exit Status:
Status of command placed in foreground, or failure if an error occurs.
Run Code Online (Sandbox Code Playgroud)
或者,您可以运行bg以使其在后台继续:
$ help bg
bg: bg [job_spec ...]
Move jobs to the background.
Place the jobs identified by each JOB_SPEC in the background, as if they
had been started with `&'. If JOB_SPEC is not present, the shell's notion
of the current job is used.
Exit Status:
Returns success unless job control is not enabled or an error occurs.
Run Code Online (Sandbox Code Playgroud)
如果您刚刚点击了Ctrl Z,那么为了让工作返回,只需fg不带参数地运行即可。
Lui*_*uis 62
您可以使用jobs来列出挂起的进程。举个例子。从一个过程开始:
$ sleep 3000
Run Code Online (Sandbox Code Playgroud)
然后你暂停这个过程:
^Z
[1]+ Stopped sleep 3000
Run Code Online (Sandbox Code Playgroud)
您可以列出流程:
$ jobs
[1]+ Stopped sleep 3000
Run Code Online (Sandbox Code Playgroud)
并将其带回前台:
$ fg %1
sleep 3000
Run Code Online (Sandbox Code Playgroud)
的%1对应于[1]列出的jobs命令。
Gee*_*eeb 27
您应该能够通过使用kill命令从命令行向进程发送 CONTINUE 信号来重新启动挂起的进程,因此:
kill -CONT 92929
Run Code Online (Sandbox Code Playgroud)