Back to feed
Dev.to
Dev.to
6/29/2026
The original title is: 'Everything Is a File in Unix' : A Tour of Linux I/O Redirection

The original title is: 'Everything Is a File in Unix' : A Tour of Linux I/O Redirection

Original: 'Everything Is a File in Unix' : A Tour of Linux I/O Redirection

Short summary

Unix I/O redirection works by treating stdin, stdout, and stderr as file descriptors that can point anywhere—files, /dev/null, or other commands. Using operators like > (redirect), >> (append), 2>&1 (combine streams), and | (pipe), you control where program output flows. The key insight: redirection simply rewires where file descriptors point, unifying operations that seem cryptic but follow the same principle.

  • Stdout, stderr, and stdin are file descriptors (1, 2, 0) that can be redirected to files or commands
  • Use >, >>, and 2>&1 to redirect output; | pipes one command's output to another's input
  • Understanding that redirection rewires file descriptors makes the operators intuitive and composable

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more