A process has two standard file descriptors:

  • stdin, which numeric value is 0, and it’s used to read the user input.
  • stdout, which numeric value is 1, and it’s used to write information on the terminal window.

Redirecting the input from the stdin to a file can be done with the < operator; while replacing the output from the terminal windows (stdout) to a file can be done with the > operator.

Pipes work in the same way, replacing the stdin/stdout with read/write descriptors of the pipe itself.


tags: operating-systems