Skip to content
Justice Tech School

Pipes and tee

A pipe sends output to the next command. tee writes to a file and passes output on.

Example
printf "b\na\nc\n" | sort | tee /tmp/t.txt | head -n 2
cat /tmp/t.txt | wc -l
rm /tmp/t.txt

Result

a
b
3

Exercise

Split output.

cmd |  file

Quiz Test

What does tee do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.