IO Redirection and Pipes
Part of the Bash course
Every command you run in Bash is, underneath, hooked up to three separate channels, whether you ever notice them or not. Think of a mail sorting machine: letters go in through one slot, successfully sorted mail comes out one tray, and damaged or undeliverable mail gets kicked out into a separate tray so it does not get mixed in with the good mail.
The three channels have names. stdin ("standard in") is where a command reads its input from, by default your keyboard. stdout ("standard out") is where normal output goes, by default your screen. stderr ("standard error") is a separate channel just for error messages, also shown on your screen by default, which is why the two normally look indistinguishable until you start redirecting them. ...
Want to learn Bash IO Redirection and Pipes in a real environment?
Click below, get a fresh Linux box with Bash ready to go, and work through IO Redirection and Pipes hands-on with an AI tutor that knows your code.
Start this lessonIO Redirection and PipesWhat you'll learn
- >
- >>
- <
- 2>
- 2>&1
- &>
- Tee
- Here-doc <<EOF
- Process substitution <(cmd)
Read this lesson in your language
All lessons in this course
12 lessons- 1What Is Bash20 min
- 2Shebang and Your First Script25 min
- 3Variables and Quoting25 min
- 4Conditionals and Tests30 min
- 5Loops25 min
- 6Functions25 min
- 7Arrays25 min
- 8String and Arithmetic Expansion25 min
- 9IO Redirection and Pipes25 min
- 10Error Handling and Traps30 min
- 11Debugging and Best Practices25 min
- 12Capstone: Server Bootstrap Script60 min
