Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ssh from my MacBook to a remote Linux and started a lengthy script (import 2000000+ lines of csv text records into MySQL). Too bad I have to take away my MacBook one hour later.

How can I keep the script running when I unplug my MacBook?

share|improve this question
up vote 1 down vote accepted

Use nohup and run your process in the background. Run your process like this:

nohup command &

To nohup running processes: press ctrl+z, enter "bg" and enter "disown"

share|improve this answer
for my case, I have already started the script, is there something I can do now? Thanks – ohho Oct 13 '10 at 4:51
Found a solution on nohup wikipedia. To nohup running processes: press ctrl+z, enter "bg" and enter "disown". – ohho Oct 13 '10 at 4:58

nohup is fine, but spartian. screen is powerful. Let's do:


type Control-A, then d. This will detach the screen session. You'll see the detached session with:

screen -ls

To reattach a session:

screen -r

See also this screen presentation

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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