/rɪˌdɪˈrɛk.ʃən/

noun — “telling your computer to speak somewhere else without moving its mouth.”

Redirection is the process of changing the default destination or source of a program’s input or output. Instead of letting a program read from the keyboard or write to the terminal, Redirection allows data to flow into files, devices, or even other programs. It’s one of the foundational tools in shell environments for creating automation, pipelines, and clean logging.

By default, every process has three standard streams: Standard Input, Standard Output, and Standard Error. Redirection manipulates these streams, sending the data elsewhere. For example, using the `>` operator sends Standard Output to a file, while `2>` sends Standard Error to a separate destination. Combining streams with `&>` merges output and errors into a single file for convenience.

Redirection is not limited to files. Pipes (`|`) take the output of one command and feed it as input to another, enabling workflows that are modular, reusable, and surprisingly powerful. In effect, Redirection turns the command line into a factory where programs pass components along a conveyor belt, and you decide which assembly line each component takes.

In more advanced usage, Redirection supports here-documents and here-strings, allowing inline input for programs that would normally require external files. It also enables dynamic logging setups, where diagnostic messages can be separated from normal results, helping maintain clarity in automated scripts and monitoring tools.

Security and reliability are intertwined with Redirection. Misrouted output can overwrite important files or leak sensitive information. Clever use of /dev/null allows developers to discard unwanted output safely, while redirecting logs to protected directories ensures traceability. Proper understanding of Redirection prevents accidental chaos in multi-user or production environments.

In short, Redirection lets you control where your program speaks, what it listens to, and whether its cries for attention get noticed or politely ignored. It’s the difference between shouting into the void and delivering a memo directly to the right inbox.

Redirection is like giving a program GPS coordinates: it doesn’t care where it goes, just follow the path you set.

See Shell Scripting, Pipeline, Standard Output, Standard Error, /dev/null.