Predictive Hacks

How to Close the Running Jupyter Notebook Servers

When you work on a server, let’s say the EC2, and you launch a Jupyter notebook, the notebook server will be running unless you close it from the GUI clicking on the “QUIT” button.

The first thing that we need to get the running jupyter notebook servers. We can get a list of the running servers by running the following command:

jupyter notebook list

And we get:

(base) ds@domain ~$ jupyter notebook list
Currently running servers:
http://domain.va.xxx.com:8888/?token=f5fc2d2342e8ab4122dc4d4ce37944a9a8ff7209c8bd45ff :: /home/ds
http://domain.va.xxx.com:8888/?token=a215b1a15c676cf8caf9513009cdf1e1f5fa862a50994f43 :: /home/ds
http://domain.va.xxx.com:8888/?token=1cb296d7f493f06ae4d747282d149e2456d448a6c64cde24 :: /home/ds
http://domain.va.xxx.com:8888/?token=b6842a1237837e69ccd09a1d5d1c0384d49ebcc26a88cc83 :: /home/ds
http://domain.va.xxx.com:8888/?token=5af6678b695b12caa8317e66b9de9ff975ec0236eaaf6237 :: /home/ds
http://domain.va.xxx.com:8888/?token=c7ed89b2e740a5bf84288f788c548b5e73f5e65b177ed9a6 :: /home/ds
http://domain.va.xxx.com:8888/?token=dc3be5b8572973a92c2ba37aa9a0ffcd15aa24da1906baa6 :: /home/ds
http://domain.va.xxx.com:8888/?token=7f4201adbd961641a1069661440c289690262ea1b62225b5 :: /home/ds
http://domain.va.xxx.com:8889/?token=9f9c4167629ce0ff95f5015f4db5bbc1fa31d9aa7de08c89 :: /home/ds
http://domain.va.xxx.com:8888/?token=2bccfe59fddd95585f18263fac103083d4b2241e897accd3 :: /home/ds
 

You can easily open any running server by copy-paste the URL address to your browser.

We can close all the running servers by running the command:

pkill jupyter

Or

pkill -9 jupyter

Since the running notebooks can belong to different users, if you want to close only the ones that you own you can run:

pkill -u `id -u` jupyter

Another approach could be to copy-paste the URL address and then close the server with QUIT button.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Python

Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.

Python

Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s