What are stdin, stdout, and stderr?

Answer

Every Linux process has three default file descriptors (FDs): stdin (FD 0) — standard input, the default source of input (keyboard by default). stdout (FD 1) — standard output, where normal output goes (terminal by default). stderr (FD 2) — standard error, where error messages go (also terminal by default but separate from stdout). This separation lets you redirect output and errors independently: command > out.txt 2> err.txt. Programs like ls write filenames to stdout and error messages ("No such file") to stderr. In pipelines, only stdout flows through the pipe unless you merge with 2>&1.