Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resume a stopped process through command line

I've executed the following C code in Linux CentOS to create a process.

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

    int main ()
    {
          int i = 0;

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

I've compiled it to hello_count. When I do ./hello_count, The output is like this:

hello 0
hello 1
hello 2
...

till I kill it. I've stopped the execution using the following command

kill -s SIGSTOP 2956

When I do

ps -e

the process 2956 ./hello_count is still listed.

Is there any command or any method to resume (not to restart) the process having process id 2956?

Also, when I stop the process, the command line shows:

[1]+ Stopped      ./hello_count

What does the [1]+ in the above line mean?

like image 549
Ajish Alfred Avatar asked Jan 26 '26 08:01

Ajish Alfred


1 Answers

  • To continue a stopped process, that is resume use kill -SIGCONT PID
  • Regd [1]+ that is bash way of handling jobs. For further information try help jobs from bash prompt.
like image 88
tuxuday Avatar answered Jan 28 '26 21:01

tuxuday



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!