Remote Server Cheatsheet
Jupyter Notebook
-
Login your remote server.
ssh username@server
-
Create a remote Jupyter notebook on the server.
jupyter notebook --no-browser --port=8080
Alternatively, you can define a macro in your configuration file
.bashrc
on the remote server.function nb(){ jupyter notebook --no-browser --port=8080 }
-
Open a new local terminal and connect to the remote Jupyter notebook
ssh -L 8080:localhost:8080 username@server
-
Open https://localhost:8080 in your browser.
SSH
It is quite tedious to repeat above commands every time. Here’s how you can configure your own SSH profile to make it easier to connect to your remote server:
-
Add the following profile to your
.ssh/config
file.Host myhost Hostname server User username Port myport LocalForward 8080 localhost:8080
-
Connect and listen to the remote server simply through
ssh myhost
.
Tmux
Tmux is a “terminal multiplexer”, it enables a number of terminals (or windows) to be accessed and controlled from a single terminal.
- Install Tmux Plugin Manager and Tmux Resurrect.
-
Start a new session with the name mysession.
tmux new -s mysession
- Save a session by
Ctrl-b + Ctrl-s
and restore a session byCtrl-b + Crtl-r
. -
Show all sessions.
tmux list-session
-
Kill session mysession.
tmux kill-session -t mysession