Skip to main content

Streams for Shell and Bashs

Streams are the three data channels every Unix process uses: standard input, standard output and standard error. Redirection and pipes connect these channels between files and programs, and text tools such as grep, sed, awk, sort and cut transform the data flowing through them. This is the core idea behind composing small commands.

Stage: Command Line · Part of the Shell and Bash roadmap · Last reviewed 19 November 2026

What to learn in Streams

Streams interview questions

What is the difference between > and >> in redirection?

The single > operator truncates the target file and writes new output, destroying earlier content. The >> operator appends to the end of the file and creates it if missing. Using > on a log file by mistake is a classic way to lose data.

How do you send both stdout and stderr to the same file?

Use command > out.log 2>&1, which sends stdout to the file and then points stderr at wherever stdout currently goes. In Bash you can also write command &> out.log. The order matters: 2>&1 placed before the > redirect behaves differently.

Where Streams fits in the Shell and Bash roadmap

Streams belongs to the Command Line stage (beginner level), which takes about 12 hours. Everyday use.

Back to the full Shell and Bash roadmap