This post provides instructions on how to check whether a Jupyter server is running from command line and kill if needed.
Normally, you can kill a Jupyter server from the same terminal window where you launched your Jupyter notebook by hit CTRL + C, then type yes, to shut down the kernels of Your jupyter notebook.
But, there are situations where you want to know whether a Jupyter-notebook running on your remote server, but the Jupyter notebook was started on another desktop (e.g., your office desktop), (and now you are working at home from your laptop, and want to check whether the notebook is still running).
After you login to your Server where you Jupyter notebook was installed and running, you can use the following command to list runing notebooks.
$ jupyter notebook list
You will see a list of running notebooks in the terminal, if you have several running ones.
You can use the following command to kill specific notebook (identified by the port it runs the jupyter) that you would like to stop.
$ jupyter notebook stop 8888
P.S.:
Each server should start on a new port. jupyter notebook list
is reading a set of data files – each notebook server you run writes a file when it starts up, and attempts to remove it when it shuts down. If you see different listed servers on the same port, that means some of them exited without successful removal of the file when it created (for example, unexpected shut down of the notebook would cause this happens).
References:
https://github.com/jupyter/notebook/issues/1950
https://github.com/jupyter/notebook/issues/2844