Issue
Often we run jupyter notebook
to pop up a page in browser to use notebook. However, the terminal opening the server remains there. Is there a way that we can close that terminal with server running in the back ?
Solution
You can put the process into the background by using jupyter notebook --no-browser & disown
. You can close the terminal afterwards and the process will still be running.
If you're using zsh
you can also use a shorter version that does the same: jupyter notebook --no-browser &!
.
To kill the process you can use pgrep jupyter
to find the PID of the process and then kill 1234
, replacing 1234 with the PID you just found.
Explanation
The --no-browser
flag makes jupyter not open the browser automatically, it also works without this flag.
The &
puts it into the background of the currently running shell.
The disown
then removes the job from the background of the currently running shell and makes it run independently of the shell so that you may close it.
In the zsh
version the &!
is a built-in function that does the same as & disown
.
Answered By - pgrosslicht
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.