How can I kill all stopped jobs?
When I try to exit from my Linux server I get the message:
There are stopped jobs.
: Is there a single command to kill these?
To quickly kill all the stopped jobs under the bash, enter:
kill -9 `jobs -ps`
jobs -ps
lists the process IDs (-p
) of the stopped (-s
) jobs.kill -9 `jobs -ps`
sends SIGKILL signals to all of them.
Try typing this:
kill -9 $(jobs -p)
The accepted answer would kill all jobs (which is sufficient in this case) and not merely the stopped ones. Should you want to kill only the Stopped ones, run:
kill $(jobs -l | grep Stopped | cut -d' ' -f3)