STDIO and pipelines

Data streams as raw materials

Note:

  • Transformations, not just “filters”

Text streams - a universal interface

“This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.” —Doug McIlroy, Basics of the Unix Philosophy

STDIO file handles

  • STDIN (0)
  • STDOUT (1)
  • STDERR (2)

Preparing a USB thumb drive

Preparation 9-1

Generating data streams

Experiment 9-1: ls Experiment 9-2, 9-3: yes

Test a theory with yes

Experiment 9-4: Filling the USB stick

Exploring the USB drive

Experiment 9-5 to 9-9: dd

Randomness

Experiment 9-10: /dev/urandom

Pipe dreams

Experiment 9-11: Command pipeline

Building pipelines

Experiment 9-12: Building pipelines

Redirection

Experiment 9-13: Redirecting STDOUT Experiment 9-14: Appending STDOUT

Just grep’ing around

Cleanup

Summary