Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 have a script name.bash. I want to run it on the server serv@domaine with ssh but I'm afraid to run it directly and close my shell and stop execution. I read that i can run my bash on the server with screen to overcome these problem. What are the commands I would use please?

share|improve this question
up vote 3 down vote accepted

If you have a modern version of ubuntu on the server, then you can use byobu, which is a more updated version of screen.

From your local:

ssh serv@domain

Then if your session drops (or you just close the terminal), you can reconnect with the ssh command and be right back where you were.

You can also set byobu to always be running, which is what I do, by typing byobu-enable.

share|improve this answer

If you aren't doing anything interactive in that script, you can just set it to run using nohup, which will tell it to continue even if the ssh session ends. this would apply only to the one script rather than screen which essentially keeps your entire login session active.

The command would be:

nohup /path/to/name.bash &

The final ampersand sets the nohup process to run in the background.

More details on the nohup command:

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.