Nov 8, 2018

How to kill a background job in Linux

If you have multiple background ground jobs, and would like to one of them, execute jobs command which will show the background job id and command.

In the following example, kill %2 will kill the job#2.

$ jobs

[1] my-job-1.sh &

[2]- my-job-2 &

[3]+ Done nautilus .

$ kill %2