This question already has an answer here:

I have Matlab running in a Linux session for almost 2 days, and afraid to lose the computations if my network connection fails. Will moving Matlab to the background and starting 'screen' be the answer for that?

marked as duplicate by Gilles, jasonwryan, slm Apr 1 '15 at 22:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Actually this question is more similar to the one I asked, as it deals with already-started processes. – Aviv Apr 2 '15 at 9:10

No, starting a screen session after a process is started will not help. What you can try is just putting the process in the background. On my Linux (Mint 17) I tried it with another shell and put 'sleep 100000` in the background.

Then I logged off the session and started a new one. The sleep 100000 process was still running and the parent became process 1 (the init process).

Steps were:

sleep 100000


bg 1

ps -ef |grep sleep
testuser   7482  7320  0 14:44 pts/11   00:00:00 sleep 10000000



ps -ef |grep sleep
testuser   7482     1  0 14:44 ?        00:00:00 sleep 10000000

Other systems like Solaris has the nohup command which allows you to specify a pid to immune to hangups.

  • The process is indeed still running, but you can't reconnect to it (STDIN/STDOUT). I needed to reconnect to the Matlab session. – Aviv Apr 2 '15 at 9:18
  • Use reptyr [-s] pid in that case, as @Anthon suggested, to reconnect the file descriptors. – Lambert Apr 2 '15 at 18:49

No. Your Matlab output will not magically appear in the screen session for that you need to first start screen then start the matlab session within it. The same holds true for tmux.

If you want to reconnect the stdin/out of this running process to another you can try reptyr

Not the answer you're looking for? Browse other questions tagged or ask your own question.