Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i am working on a Linux box (via ssh), which is currently completing a very time-consuming task. How can I go to sleep (close my local terminal windows) without interrupting the execution of that task?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

If you forgot to use nohup or screen, and you are using bash as your shell, do the following:

  • CTRL-Z (temporarily suspends the process)
  • bg (puts the process into the background)
  • disown (prevents the process from quitting when you disconnect the ssh session/close the window)

Not as useful as screen (especially when the process outputs something), but nice to use when a process unexpectedly takes a long time.

share|improve this answer
    
please feel voted up :) ... i would like to vote you up but I don't have the rep for that :( –  niklasfi Jul 21 '10 at 9:44

The best way would be to use screen to create a detatchable screen run your command then detach, you can then close the original session without issue. The oldschool way would be to use nohup and send it to the background i.e. nohup <command> <args> &

share|improve this answer
    
screen is definitely the way to go. After detaching the screen, you can reattach it and continue to watch the progress of your task. You can also have multiple windows in a screen, to watch multiple processes. –  Weboide Jul 20 '10 at 23:38
    
+1 for screen, amazing tool –  natxo asenjo Jul 21 '10 at 10:11

Your Answer

 
discard

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.