Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to start an IPython session via ssh and log back in later?

I work on a machine per ssh where I run ipython for interactive work. Can I start a long-running Python function from IPython, sever the ssh connection and log back in later into the IPython session to observe the result?

like image 784
clstaudt Avatar asked Feb 14 '23 21:02

clstaudt


1 Answers

Yes. Use screen, tmux (superior), or similar software. Both use the concept of sessions that you attach to and detach from.

With tmux:

  1. Run tmux and then ipython.
  2. When you're finished, <Ctrl+b> d to detach. You're back in the normal shell.
  3. When you come back, tmux attach will take you back to ipython.

Using screen, the commands are screen, <Ctrl+a> <Ctrl+d> and screen -r.

like image 194
slezica Avatar answered Mar 05 '23 17:03

slezica