Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List running Jupyter notebooks and tokens

How do you check the login tokens for all running jupyter notebook instances?

Example: you have a notebook running in tmux or screen permanently, and login in remotely through ssh. Sometimes, particularly if you're logging in after a long time, the token is requested again in order to access the notebook session. How do you get hold of the token without having to kill and restart the notebook session with a new token?

like image 901
christopherlovell Avatar asked Oct 03 '17 18:10

christopherlovell


People also ask

How do I check my jupyter notebook token?

Show activity on this post. Just right click on the jupyter notebook logo in the currently running server, you probably have a server running already, then click on copy link, then paste the link in a text editor, maybe MS word, you will see the token in the link, copy and paste where token is required. It will work.

How do I know if Jupyter is running?

Your first Jupyter Notebook will open in new tab — each notebook uses its own tab because you can open multiple notebooks simultaneously. If you switch back to the dashboard, you will see the new file Untitled. ipynb and you should see some green text that tells you your notebook is running.

How do I close all Jupyter notebooks?

After all of your notebooks are closed and shut down, you can end your Jupyter Notebook session by clicking on the QUIT button at the top right of the dashboard. You can now close the browswer tab for Jupyter Notebook . If desired, you can also close your terminal by typing the command exit and hitting Enter .

How do I check my jupyter notebook memory?

The jupyter-resource-usage extension is part of the default installation, and tells you how much memory your user is using right now, and what the memory limit for your user is. It is shown in the top right corner of the notebook interface.


1 Answers

UPDATE

You can now just run jupyter notebook list in the terminal to get the running jupyter sessions with tokens.

enter image description here

Take care that you are within the right environment (conda, virtualenv etc.) otherwise the sessions will list without the associated tokens. Eg: The above reference screenshot is from the conda environment.

Old answer:

Run ipython and enter the following:

> ipython [1] : system("jupyter" "notebook" "list") Out[1]:  ['Currently running servers:','http://localhost:8895/token=067470c5ddsadc54153ghfjd817d15b5d5f5341e56b0dsad78a :: /u/user/dir'] 

If the notebook is running on a remote server, you will have to login in to that server first before running ipython.

like image 54
christopherlovell Avatar answered Nov 09 '22 22:11

christopherlovell