How to suspend and resume processes
In the bash terminal I can hit Control+Z to suspend any running process… then I can type
fg to resume the process.
Is it possible to suspend a process if I only have it’s PID? And if so, what command should I use?
I’m looking for something like:
and then to resume it with
You can use
kill to stop the process.
For a ‘polite’ stop to the process (prefer this for normal use), send
kill -TSTP [pid]
For a ‘hard’ stop, send
kill -STOP [pid]
Note that if the process you are trying to stop by PID is in your shell’s job table, it may remain visible there, but terminated, until the process is
To resume execution of the process, sent
kill -CONT [pid]