When we execute any program, by default, its output or error is displayed on the screen. We can redirect the text output of a program to a file using the input/output redirection operator or to another program using pipes. For this, when any command is executed, there are three standard file streams (file descriptors) created and opened by the operating system. The streams are known as standard input (stdin), standard output (stdout), and standard error (stderr).
The first stream is associated with stdin (numbered as 0) used to read input from keyboard. The second file stream is associated to stdout (numbered as 1) used by program to print output on screen, and the last file stream is stderr (numbered as 2), used by our program to print errors onscreen.
The following table list the different file descriptors (also known as channel) along...