# How to enable (and use) persistent remote connection with VSCode/tmux?

**URL:** <https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926>\
**Category:** VS Code\
**Tags:** question, ssh\
**Created:** [February 22, 2022, 5:46pm UTC](https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926 "2022-02-22T17:46:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [February 22, 2022, 5:46pm UTC](https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926/1 "2022-02-22T17:46:12Z")

</div>

Hello I am following [the doc](https://www.julia-vscode.org/docs/dev/userguide/remote/) on running VSCode using Julia on a remote server, and all is working smoothly except I can’t keep the session permanent.  
I have installed on the server (Ubuntu 20.04) tmux and set the option Persistent session: enabled on the remote window of VSCode but the session seems to be lost when I disconnect and reconnect.  
Am I supposed to do something after I reconnect to the server to get back the detached session ?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/f/3f43ff4264410be319fbab650b894ec99f888130.png)

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [February 22, 2022, 5:49pm UTC](https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926/2 "2022-02-22T17:49:54Z")

</div>

ok, I think I got it… in VSCode remote I opened a normal terminal and typed `tmux attach`.  
The workspace was still empty, but is was enough to evaluate a single command to get it back in full, thank you!

If this is the way it is supposed to work, you could add a note on the documentation, as this last passage is missing…

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [February 22, 2022, 8:25pm UTC](https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926/3 "2022-02-22T20:25:57Z")

</div>

> [@sylvaticus](#):
>
> Am I supposed to do something after I reconnect to the server to get back the detached session ?

Just open a new REPL session again, as per usual – we’ll automatically attach to the tmux session originally started.

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [February 23, 2022, 5:28am UTC](https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926/4 "2022-02-23T05:28:08Z")

</div>

Ah, thanks. Just to be sure, to “open a new Julia REPL session” normally I just start evaluating something in the file and Julia “starts”, are there other ways to start/reconnect Julia REPL to existing sessions ?  
Also, sometimes I need to kill Julia and restart it. If I do it (`CTRL+d`) in the remote “persistent” session I get a message “Pane is dead” and then I need to open a new bash terminal and type `tmux kill-server`.  
Is this the way to do it ?  
Finally, if I try to scroll the persistent terminal panel, instead of the old terminal lines I get the current prompt changing to the history of commands. Again, is there a way to get it scrolling like in the local terminal ?  
Thank you

BDW, this is cool! Even better than using R-Studio server on a browser, very different approach…

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [February 23, 2022, 8:22am UTC](https://discourse.julialang.org/t/how-to-enable-and-use-persistent-remote-connection-with-vscode-tmux/76926/5 "2022-02-23T08:22:38Z")

</div>

> [@sylvaticus](#):
>
> Just to be sure, to “open a new Julia REPL session” normally I just start evaluating something in the file and Julia “starts”, are there other ways to start/reconnect Julia REPL to existing sessions ?

Just do whatever you do normally, all methods to open a new REPL should reconnect automatically.

> [@sylvaticus](#):
>
> Also, sometimes I need to kill Julia and restart it. If I do it ( `CTRL+d` ) in the remote “persistent” session I get a message “Pane is dead” and then I need to open a new bash terminal and type `tmux kill-server` .  
> Is this the way to do it ?

`Alt-J Alt-K` will kill the Julia process and ask you whether you want the tmux session to close as well. Otherwise you should be able to close the dead pane with `Ctrl-B X Y` too.

> [@sylvaticus](#):
>
> Finally, if I try to scroll the persistent terminal panel, instead of the old terminal lines I get the current prompt changing to the history of commands. Again, is there a way to get it scrolling like in the local terminal ?

Enable mouse mode in tmux by putting `set -g mouse on` into your ~/.tmux.conf.
