I accidentally “stopped” my telnet process. Now I can neither “switch back” into it, nor can I kill it (it won’t respond to kill 92929, where 92929 is the processid.)
So, my question is, if you have a stopped process on linux command line, how do you switch back into it, or kill it, without having to resort to kill -9?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The easiest way is to run fg to bring it to the foreground:
$ 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.
Alternatively, you can run bg to have it continue in the background:
$ 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.
If you have just hit Ctrl Z, then to bring the job back just run fg with no arguments.
Method 2
You can use jobs to list the suspended process. Take the example. Start with a process:
$ sleep 3000
Then you suspend the process:
^Z [1]+ Stopped sleep 3000
You can list the process:
$ jobs [1]+ Stopped sleep 3000
and bring it back to the foreground:
$ fg %1 sleep 3000
The %1 corresponds to the [1] listed with the jobs command.
Method 3
You should be able to re-start a suspended process by using the kill command to send the process the CONTINUE signal, from the command-line, thus:
kill -CONT 92929
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0