What does “/dev/null” mean at the end of shell commands

后端 未结 5 1685
无人共我
无人共我 2020-12-14 07:12

What is the difference between the following commands?

ssh myhostname \"command1; command2;...commandn;\" 2>/dev/null
ssh myhostname \"command1; command2;         


        
相关标签:
5条回答
  • 2020-12-14 07:30

    2> means "redirect standard-error" to the given file.

    /dev/null is the null file. Anything written to it is discarded.

    Together they mean "throw away any error messages".

    0 讨论(0)
  • 2020-12-14 07:35

    1 is stdout. 2 is stderr.

    Then sometimes you find 2>&1, that means redirecting stderr to stdout.

    0 讨论(0)
  • 2020-12-14 07:39

    '/dev/null' essentially means "into the void", discarded. The 2 you mention refers to error output, where it should be directed.

    0 讨论(0)
  • 2020-12-14 07:41

    2> means sending standard error to something

    /dev/null means a bin

    0 讨论(0)
  • 2020-12-14 07:44

    1) Pipe everything on standard error to /dev/null (so ignore it and don't display it)

    2) Dev null just points to nowhere, pipe anything to that, and it disappears.

    0 讨论(0)
提交回复
热议问题