bashbackgroundstdoutdev-null

Bash: Silence a process put into background


If I run a application using the bash and I put it into the background via

If now the process is printing to stdout the shell prints this output. This output is not interesting for me and I do not like my shell to be polluted with it.

Is there a way to redirect the output form this process to /dev/null

I could have achieved the very same by directly starting the application in background with (./application &> /dev/null)&, but my application is already running and I would not like to quit it and restart it.


Solution

  • One option is:

    1. Bringing the job to the foreground (see Job control).
    2. Redirecting ouput (see below).
    3. Sending to the backgrouond again.

    How to redirect output of an already running process

    https://superuser.com/questions/473240/redirect-stdout-while-a-process-is-running-what-is-that-process-sending-to-d

    Redirect STDERR / STDOUT of a process AFTER it's been started, using command line?

    https://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/