2

I am attempting to redirect all output of a program (Steam) to /dev/null so it doesn't show up in the terminal.

Here's what I've tried: steam & > /dev/null 2>/dev/null and steam & > /dev/null 2>&1

Neither of which suppress it's messages whatsoever (as far as I can tell.)

My understanding is that & detaches the process from the terminal, and > redirects input/output, with the default/blank > being stdout and 2> being stderr. Are there more outputs than those two? Why am I still seeing output if I'm redirecting all of it away?

4

Try:

steam 2>&1 > /dev/null &

2>&1 redirects stderr to stdin, and > /dev/null redirects stdin to /dev/null.

The & to background the process was misplaced. It must go at the end of the line. If placed after steam but before >, nothing from steam will be redirected, though the process will properly background.

  • Can you explain why this should work? – Seth Mar 28 '13 at 4:05
  • @Seth: 2>&1 redirects stderr to stdin, and > /dev/null redirects stdin to /dev/null. – Adobe Mar 28 '13 at 4:06
  • That works perfectly. My best guess as to what I was doing wrong was redirecting the output of the "&" command, since it was placed right after the command (as opposed to at the end, which backgrounds it and redirects properly.) – Gary Mar 28 '13 at 4:07
  • 1
    @Adobe You should edit that into your question :) – Seth Mar 28 '13 at 4:10

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.