When I run a process in the background the process ID gets displayed in the command prompt. For example:

$ gvim 1 &

[3] 9584

Now when I run another process the state of the previous one also gets displayed. For example:

$ gvim 2 &

[4] 9500

[3]   Done                    gvimBackground 1 

Is there any way I can suppress displaying the current PID and the data related to previous processes?


Put your entire command, including the &, in parentheses:

 (prompt)$ gvim 1 &
[3] 9584
 (prompt)$ some other command
[3] Done gvimBackground 1
 (prompt)$ (gvim 1 &)
                                                                <– (silence)


It's not so much that the status of other jobs are reported when you start a new one, but that changes of status are by default only reported before a prompt is displayed. So in your case, it's reported at the first opportunity, that is at the prompt displayed after you start your second job.

You can make the job reporting synchronous by issuing:

set -b

In that case, reports on completion or suspension... of background jobs is done as soon as it happens and you don't have to wait for the next prompt.

If you don't want to be notified of the completion of a job, as @Scott says you can start it as a job of a subshell (job &), or disown it using the disown command (or with zsh, start it as job &!) but note that it means you can't put it back in foreground or kill it using a job number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.