jupyter access from another computer code example

Example: jupyter on remote server

0. [remote] move to the desired folder (root of the future jupyter server)

1. [remote] [optional] create a screen for the server,
   so you can close the remote terminal and jupyter will keep running

   screen -S jupyter

2. [remote] start jupyter, with no browser, on port RRRR

   jupyter notebook --no-browser --port=RRRR

3. [remote] look at the output and take note of the token in
   http://localhost:RRRR/?token=07994b9f01b2bb2ff3bd6a0fdef2c1294863165c7ba9c6b4

4. [remote] [optional] detatch from screen
   
   Ctrl+A, D

5. [local] on terminal, connect local port LLLL to remote port RRRR

   ssh -NfL localhost:LLLL:localhost:RRRR [email protected]
   (type password for [email protected])

6. [local]
   open browser on page "localhost:LLLL"
   you will see the login page for jupyter
   type the token from step 3.

NOTES:
If possible RRRR = LLLL = 8888, makes everything easier
Do NOT close the local terminal until you are done
Local terminal might disconnect the ports some times: just repeat step 5.
[optional] Remember to exit the screen on remote once you are done