Breaking News
Home / Sys Admin / Unix / What are standard process streams?

What are standard process streams?

Unix StreamsA program, on execution may need input from the user via some input device like keyboard, mouse etc., it may also need some output medium (like screen etc.) to display or send some information messages as well as some medium to output error & other fatal information, as such a process opens three I/O connections/channels called standard input, standard output and standard error.

 program standard process streams

Standard input (stdin)
Standard input as the name implies is the data that is input to the program. The program opens up this stream and waits to reads the data if any sent to stream. As mentioned earlier not all programs require input. For example, the windows command like dir or unix command like ls program (which displays file names contained in a directory) performs its operation without any stream data input.

Unless redirected, input is expected from the text keyboard which started the program.
The file descriptor for standard input is 0 (zero).

Standard output (stdout)
Standard output as the name imples is stream opened by the program to ouput informational messages. The program writes the data using the write operation. As mentioned earlier just like read, all the programs do not generate output. For example the file rename command (variously called mv, move, ren) is silent on success.

Unless redirected, standard output is the text terminal which initiated the program.
The file descriptor for standard output is 1 (one).

Standard error (stderr)
Standard error is another output stream typically used by programs to output error messages or diagnostics. This stream independent of standard output and can be redirected separately. The usual destination is the text terminal which started the program.

It is acceptable-and normal-for standard output and standard error to be directed to the same destination, such as the text terminal. Messages appear in the same order as the program writes them, unless buffering is involved.
The file descriptor for standard error is 2 (two).


Check Also

How to list disks information in Linux?

In order to check the disk in the system we can use the List Hardware …

Advertisment ad adsense adlogger