Standard streams
Strandard stream allows the machine to interact with the external periferals. Hence they are file that represents streams
stored usually in the /dev (device) directory. They can handle input, output and error streams produced by the
processes i.e.
- Standard input|STDIN - file handle that your process reads to get information from you i.e. keyboard or mouse input.
- Standard output|STDOUT - your process writes conventional output to this file handle.
- Standard error|STDERR - your process writes diagnostic output to this file handle.
That's mostly by convention .
Examples
executable <inputfile.txt 2>errorfile.txt | grep nice_work
which will:
- create a process for
executable. - open
./inputfile.txtas your standard input (file handle 0). - open
./errorfile.txtas your standard error (file handle 2). - create another process for
grep. - attach the standard output of
executableto the standard input ofgrep.