• azimir
    link
    fedilink
    English
    arrow-up
    5
    ·
    5 小时前

    They are file handles. All three are opened by default for all new processes.

    STDIN is number 0 STDOUT is number 1 STDERR is number 2

    By default STDIN is connected to a buffer which keyboard chars are put in by the OS.

    STDOUT is a buffer read by your terminal emulator to be drawn on the screen if it’s a GUI. A raw terminal does the same, but without the windows manager layer in the middle. Essentially, the virtual terminal is reading the STDIO buffer and rendering the characters to it’s GUI windows for you.

    STDERR is the same as STDIO, but is usually only used for error messages, but they’re displayed via a different file handles so they can be captured and redirected separately from STDIO.

    • bruhbeans
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 小时前

      Thank you. Article kept referring to them as “streams” which is meaningless in the context of Linux. Writing this article without describing or even mentioning file handles is a disservice.