If you are running Jupyter Notebook on your local Mac/Windows device and you want to make sure that you did close the application gracefully, then here are a few ways to do it.
Option 1: Using the Menu Option
This is the the best and the ideal way to close a Notebook application.
Simply go to Menu: File and select Shut Down at the bottom.

You will get an alert asking if you really want o shutdown JupyterLab.

Once you click on "Shut Down" button, you will notice that the Command Line/Terminal that was running the Notebook server gets closed and so does the Browser tab.
Option 2: Using Command "jupyter notebook stop"
Open a new instance of your Terminal (CMD if on Windows) and run the below command.
jupyter notebook stop
You will notice that the Jupyter Notebook Server has stopped with logs as,
[I 2023-07-26 03:53:25.476 ServerApp] Shutting down on /api/shutdown request.
[I 2023-07-26 03:53:25.476 ServerApp] Shutting down 6 extensions
Option 3: The Quickest way - Control + C Twice
This is the quickest way to terminate a Notebook server, by pressing Control + C twice on the console.
^C[I 2023-07-26 03:55:33.181 ServerApp] interrupted
[I 2023-07-26 03:55:33.182 ServerApp] Serving notebooks from local directory: /Users/c2ctechtv
0 active kernels
Jupyter Server 2.7.0 is running at:
http://localhost:8888/tree?token=9dc1b9a830102024b31a2e78069f69469185eb19b9eb2223
http://127.0.0.1:8888/tree?token=9dc1b9a830102024b31a2e78069f69469185eb19b9eb2223
Shutdown this Jupyter server (y/[n])? y
[C 2023-07-26 03:55:34.759 ServerApp] Shutdown confirmed
[I 2023-07-26 03:55:34.761 ServerApp] Shutting down 6 extensions
When you press Control + C once you will see a message on console "Shutdown this Jupyter server (y/[n])" if you press Control + C again or type y will shutdown the server.

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!