You are confusing the differences between file redirection and piping.
The pipe symbol |
is used to pass the output of one command into another command.
Meanwhile, <
and >
are used for file redirection.
These are very different operations.
Example 1:
echo "akka" | cat
The echo
command has the output akka
, and this is piped into the standard input of the cat
command. The cat
command writes to standard output, so in this case it prints akka
. Of course, this is no different from doing simply:
echo "akka"
Example 2:
echo "akka" > cat
The echo
command has the output akka
. Using >
, this output is then redirected into a file called cat
. There is no output shown in the terminal in this case, since the output is placed into a file instead.
Example 3:
cat < echo "akka"
This is quite different from the first two. This runs the cat
command, which reads from standard input. Using <
, input is passed to the cat
command from a file called echo
. If no such files exists, then it will produce an error.