Skip to content

2.3.3 Redirection and Pipes

Linux commands often produce text output.
Redirection and pipes allow you to control where this output goes and how it is used.


Output Redirection

Command output can be:

  • Written to a file
  • Overwritten or appended

This is useful for saving results, logs, or reports.


Input Redirection

Commands can also receive input from files instead of the keyboard.

Input redirection enables:

  • Automated processing
  • Consistent input handling
  • Script-friendly workflows

Pipes: Connecting Commands

Pipes allow the output of one command to become the input of another.

This enables:

  • Step-by-step data processing
  • Building powerful command chains
  • Combining simple tools into complex workflows

Why This Matters

Redirection and pipes are core ideas in Unix-like systems.

They allow:

  • Flexibility
  • Reusability
  • Efficient text processing

📌 Key Idea:
Small tools become powerful when connected together.