Server Fault is a question and answer site for system and network administrators. 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

How can I run a console command (like cp or tar, for example) without needing to keep an open SSH?

share|improve this question
See… – w00t Jan 5 '14 at 19:57
up vote 10 down vote accepted
nohup command &
share|improve this answer
You should also make sure to handle the STDIN for the command. Usually </dev/null is all you need. Without this when you exit the ssh connection you will most likely not get the prompt back on the system you initiated the connection from. Banis' -T tip below may clear this up for you too. – Aaron Bush Jul 17 '10 at 1:07

Depending on exactly what you want to do, screen may work out for you.

You can run the command with screen, screen command then detach that screen and terminate your ssh session. Whatever is running in that screen session will still run, and you can re-attach to that session later, from another terminal.

share|improve this answer

When running commands remotely with ssh the -T option will also help.

share|improve this answer

Since you don't provide a lot of detail, it is also possible that disown will do what you want.

share|improve this answer

If it is a task you anticipate repeating over and over again, you can create a cron job.

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.