gpt4 book ai didi

linux - 通过命令行恢复停止的进程

转载 作者:IT王子 更新时间:2023-10-29 01:02:38 26 4
gpt4 key购买 nike

我在 Linux CentOS 中执行了以下 C 代码来创建一个进程。

#include <stdio.h>
#include <unistd.h>

int main ()
{
int i = 0;

while ( 1 )
{
printf ( "\nhello %d\n", i ++ );
sleep ( 2 );
}
}

我已将其编译为 hello_count。当我执行 ./hello_count 时,输出是这样的:

hello 0
hello 1
hello 2
...

直到我杀了它。我已经使用以下命令停止了执行

kill -s SIGSTOP 2956

当我做的时候

ps -e

进程 2956 ./hello_count 仍然在列表中。

是否有任何命令或任何方法可以恢复(而不是重新启动)进程 ID 为 2956 的进程?

此外,当我停止进程时,命令行显示:

[1]+ Stopped      ./hello_count

上一行中的[1]+是什么意思?

最佳答案

  • 要继续停止的进程,即恢复使用 kill -SIGCONT PID
  • Regd [1]+ 这是 bash 处理工作的方式。如需更多信息,请尝试从 bash 提示符中帮助作业

关于linux - 通过命令行恢复停止的进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10700312/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com