Skip to main content

Standard Input, Output, and Error

Linux programs use three data streams:

StreamNameDescription
stdinStandard InputInput data (usually from keyboard or another command)
stdoutStandard OutputNormal output of a command
stderrStandard ErrorError messages

Example:

ls > files.txt

Redirects output (stdout) to files.txt.

ls /root 2> errors.txt

Redirects error messages (stderr) to errors.txt.