first, run jupyter notebook list to get jupyter used port-number.
then,run lsof -n -i4TCP:[port-number]to get PID, The PID is the second field in the output.
finally, run kill -9 [PID]to kill this process.
This works for me when running a jupyter notebook server in the background.
nohup jupyter notebook --allow-root > error.log &
Stop the nohup jupyter notebook is simple.
First, find the pid of jupyter:
ps -ef| grep juypter
e.g output like:
root 11417 2897 2 16:00 pts/0 00:04:29 /path/to/jupyter-notebook
Then kill the process:
kill -9 11417
You can also simplify this by storing the pid with:
nohup jupyter notebook --allow-root > error.log & echo $!> pid.txt
i.e, you can stop the notebook with:
kill -9 $(cat pid.txt)
reference:
https://github.com/jupyter/notebook/issues/2844
https://stackoverflow.com/questions/47331050/how-to-run-jupyter-notebook-in-the-background-no-need-to-keep-one-terminal-f/51030781