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.txtResult
a b 3
Exercise
Split output.
cmd | file
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.