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

If I run a command in the background with &, like this:

sleep 2 &

when the command finishes, I get "Done". How I can avoid seeing the "Done" message ?

share|improve this question

migrated from Jul 4 '11 at 3:45

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 11 down vote accepted

Run the command in a subshell:

(sleep 2 &)
share|improve this answer
please note that by using this, you loose control of the jobs inside caller shell (jobs will show nothing). –  mighq Jul 6 at 9:44

Execute the shell built-in:

$ set +m

This works by turning off "monitor mode" so the shell doesn't report terminating background jobs.

Although running the command in a subshell like:

$ (sleep 2&)

...will also disable the message, the only reason it works is because monitor mode is enabled by default only for interactive shells. That is, the subshell avoid the message by running an extra shell that has an automatic "set +m".

share|improve this answer
One should note, that this output is not performed by the sleep. Its the bash shell that just informs you about the finished background job. –  flolo Jul 4 '11 at 3:34

I'd like to clarify the two earlier answers. If what you want is never to see the Done message from any commands in your shell, set +m is the way to go. Just put it in your .profile and/or .bashrc and be done. Note however, that if you type this:

set +m
sleep 2 &
set -m

and the sleep ends after the final set -m, you will still get the done message.

If you want to disable the message for a single command invocation, the subshell technique (sleep 2 &) is the way to go.

In all honesty, I only knew about set +m, so +1 to Wooble for enlightening me. However, it is worth noting that which of the two solutions you want depends on what you are trying to do.

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.