Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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
[USER@SERVER ~] sleep 3 &
[1] 5232
[1]+  Done                    sleep 3

How do I /dev/null these two messages?:

[1] 5232
[1]+  Done                    sleep 3

p.s.: so I need the output of the process, but not the mentioned two lines!

share|improve this question
You only get those lines when you run it interactively. You don't if you run it from a script, for example. – derobert Jan 25 '13 at 0:25
up vote 18 down vote accepted

It's not the program output, it's some useful shell information.

Anyway, those can be hided by using subshell and output redirection

( sleep 3 & ) > /dev/null 2>&1
share|improve this answer
"2>/dev/null" is the good thing, i need the output from the process – LanceBaynes Dec 10 '11 at 12:36
@LanceBaynes The process could also write something on stderr. – Chris Down Dec 10 '11 at 18:45
It's unfortunate that this defeats the retrieval of pid with $! – Ripounet Jun 8 at 14:08

In bash or zsh, you can call disown %1 to tell the shell to forget about the job. Then the shell won't print any message about that job, nor will it show it when you run jobs or ever send a SIGHUP to it. In zsh, starting the job with &! instead of & is equivalent to calling disown on it immediately.

share|improve this answer

Can't comment (yet) on @Gilles but it seems that & disown also works in bash:

sleep 3 & disown
share|improve this answer


user@host:~$ read < <( sleep 10 & echo $! )
user@host:~$ echo $REPLY

And you have hidden both the output and the PID. Note that you can still retrieve the PID from $REPLY

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.