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

How can I run a shell script in background?

share|improve this question
up vote 39 down vote accepted

Depending on what you are wanting, just add a & to the end of the command

script.sh &
command &

If you are running it in a terminal, and you want to then close the terminal, use nohup or disown

nohup

nohup script.sh &

disown

script &
disown

If that is not what you are after, please be more specific in your question.

share|improve this answer
    
Thank You Very Much – erkan şentürk Dec 15 '11 at 21:12
    
You are most welcome – bodhi.zazen Dec 15 '11 at 21:59
    
What if I for example need to run 2 scipts and then I want to run htop to see CPU usage, but problem is that 1st script start to create output to console and it seems prevent other actions(run second script, run htop). – mrgloom May 31 at 19:33

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.