I am using my laptop via shell terminal to log on school’s server to run a Matlab session. The session will take about 10 hours and I want to close my laptop, go home, have dinner, and re-engage the shell terminal to check the progress of my Matlab session.
From this link I know I should use nohup nohup
to keep my terminal alive,
but I meet the following problem. Here is a screenshot of my shell after I start
running Matlab session:
where a = cv000_29590
is the respond from the Matlab. It should keep running
until cv999999
and take about 10 hours.
The problem is, this shell is not interactive anymore. I can’t enter anymore
commands, that is, I have no where to enter nohup
commend to keep my SSH
session alive.
It's not really possible after you've already started a session. But for new sessions you can do the following:
Add the following to the top of your
.bash_profile
:Put the following content into
.screenrc
:These are mostly my own customizations of screen. The most important of which is that I set the screen escape character to
CTRL-b
instead of the defaultCTRL-a
so I can still useCTRL-a
in bash to go to the beginning of a line.Use
CTRL-b c
to create shells in new windows (or just typenew
at the bash prompt to use the function). And useCTRL-b d
to detach your session and leave it running. Next time you login, you'll be reattached to your session and everything will be as it was. UseCTRL-b n
to cycle through the windows you've created. If you don't want to multiple windows, you don't have to, just use the ability to leave a session running and reattach later.