I work with R and Python remotely over SSH using VS Code.
I sometimes want to retain R/Python variables in memory even after I disconnect from the server, and pick up the same R/Python sessions where I left off the day before.
Is there any way I could achieve this using VS Code?
The remote server is running Linux (Ubuntu).
The only way I've been able to figure out how to do this is to first open a tmux terminal and then start R from within the tmux terminal.
Install tmux on the server, then you can open a bash terminal from within vscode and type tmux new -s SESSION_NAME
Then from within that tmux session type R
Now when you want to close your laptop but keep whatever running on the server, close the tmux window with the keystroke Ctl+b then d.
Now when you want to access the session again you open a bash terminal and type tmux a -t SESSION_NAME and then you're right back where you left off
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With