Terminating a shell script running in the background

Here is the best solution for killing “nohup procces” running in the background. Suppose that you have already started a process with nohup from terminal and want to kill it.

nohup bash script.sh &

After that list running processes in the background;

jobs
[1]+ Running    nohup bash script.sh &

Then kill listed process,

kill %1
jobs
[1]+ Terminated nohup bash script.sh &

For a more detailed solution, please click here.