..and then still be able to return to the same session/screen after restarting the terminal machine. I've tried screen but once I restarted my computer screen -d showed no sessions. Nohup seems to be what I want, but then I lose the ability to see the output later on, other than by saving it to a file. Cannot I pretend more?
Screen should work fine. Give more details about what you are doing. Common commands:
# reattach session and if necessary detach it first. # If there is only one session, sessionname is not necessary. $ screen -rd sessionname # list available screen sessions $ screen -ls
I am not sure why you are using
$ screen -d
All this does is detach a screen session, provided there is only one. Otherwise it will ask which one you want to detach.
I also find
$ echo $TERM
useful to show whether I am actually inside a screen or not, since this is not always obvious. If in a screen, it will return
screen. If there are better ways to do this, I'd like to know about them.
I think that you were on the right way,
screen is what you want and not
nohup. As you said with
nohup you cannot
change the settings get your environment back after logging out the remote server.
screen supports that. Look in this tutorial. Basically what you need is:
ssh machine screen
exit ssh machine screen -ls 10176.blahblah (blah) (Detached) screen -r 10176