RTFM · Tools
Shell pipelines and redirection
The Unix idea that made computing compounding: programs producing bytes, bytes fed onward, results composed beyond what any single program imagined.

The core moves
command > file.txt # stdout to file (truncate)
command >> file.txt # stdout to file (append)
command 2> err.log # stderr separately
command 2>&1 # stderr joins stdout stream
command | tee both.log # see it AND save it
command < input.txt # stdin from fileThese few symbols compose infinitely. 2>&1 specifically duplicates file descriptor 2 onto descriptor 1; ordering matters. Bash adds |& shorthand for merging both through a pipe.
Pipelines build tools nobody wrote
# Memory hogs among top processes
ps aux | sort -rnk4 | head -20
# Count log hits per IP, largest first
awk '{print $1}' /var/log/access.log | sort | uniq -c | sort -rn | head
# Watch something change
watch -n2 'wc -l < current.counter'Before scripting a special-purpose tool, try composing primitives aloud left-to-right describing the transformation. Fluent Unix thinking converts language directly to pipelines; fluency is earned only through daily practice.
Exit status composes control flow
if ping -c1 -W2 gateway; then echo reachable; fi
command || logger -t myjob "failed"
set -euo pipefail # scripts fail fast instead of propagating nonsense- 0 means success; anything else means some specific flavour of failure.
- Exit codes propagate naturally through && and || chains.
Prove it works: pipeline reproducibility
any pipeline shown here, retyped cold weeks later, produces the same result because the inputs were understood, not memorised.
Did we miss something?
If this page left something unanswered, found an error, or there is another subject you would like documented, tell us. Saphira’s documentation grows from real problems people need to solve.
Send feedback or request a new section →
Prefer not to do it yourself?
Everything needed to do the work yourself is documented here and remains free — we charge for human time, not for withholding knowledge. Sometimes the missing resource is simply time. The same people who build Saphira can provide paid professional help with implementation, migration, troubleshooting and administration.