In this lesson, we’ll dive into Linux streams and learn how to manipulate them in shell scripting. Linux streams are the flow of data between processes—much like water flowing through a pipe. Just as you can redirect a river with gates, you can reroute streams in the shell using redirection operators and pipes.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.

Standard Streams in Linux
Every Linux process is born with three standard file descriptors:| File Descriptor | Stream Name | Description | Default Source / Destination |
|---|---|---|---|
| 0 | stdin | Reads input (keyboard or another stream) | Keyboard or pipe |
| 1 | stdout | Writes normal output | Terminal or redirected file |
| 2 | stderr | Writes error messages and diagnostics | Terminal or redirected file |
- Standard input (fd 0) typically reads from your keyboard

- Standard output (fd 1) displays command results
- Standard error (fd 2) sends error messages
stdout and stderr both default to your terminal. Redirecting one does not affect the other unless you explicitly combine them.Redirecting Streams
You can reroute streams using<, >, and pipes (|). This allows you to save output to files, read input from files, or chain commands together.

When combining redirections, order matters. Always place
2>&1 after > file to capture both streams.Examples
Capture command output and errors separately:Links and References
Further Reading
| Topic | Description | Link |
|---|---|---|
| Bash Scripting | Comprehensive guide to Bash syntax | https://www.gnu.org/software/bash/manual/ |
| Advanced Pipelines | Building complex command pipelines | https://www.linuxjournal.com/content/beauty-pipelines |
| File Descriptors | Low-level I/O in Unix/Linux | https://opensource.com/article/18/4/introduction-file-descriptors |