Pipeline "|" versus output redirection ">"



The uses of output redirection, >, and pipelining, |, seem similar. What is the distinction in their use?


The distinction here is between storage and use as input. Consider the following example

cat volcanoes.txt | wc

from this lesson. Here we’re using the result of the left side, cat volcanoes.txt, as input to the right side, wc. If we instead wrote

cat volcanoes.txt > wc

then we would use the result of the left side and store it into a file called wc. This is a very different behavior than what we did with | above.

FAQ: Redirection - |

I was confused by this lesson:
$ cat volcanoes.txt | wc | cat > islands.txt

if we want to “pipe” the standard output of volcanoes.txt to islands.txt, could we write
$ cat volcanoes.txt | wc > islands.txt ? cat islands.txt turns out the same result as the lesson.

And please explain to me what the difference between storage and use as input?


I’m confused about this as well. Could someone help plz?