So I’m currently on the “Ecosystem” project ( https://www.codecademy.com/courses/learn-the-command-line/projects/ecosystem ). And in Task 8 I’m supposed to do the following:
In one command, pipe the standard output of the
ls -lacommand to the
headcommand, then append the standard output to ** list1.txt**, then pipe the standard output to the
Once you complete the above step, use
catto view the contents of list1.txt .
Apparently, the correct way to do it is this : ls -la | head >> list1.txt | wc
Here’s what the glossary of commonly used commands ( https://www.codecademy.com/articles/command-line-commands ) says about pipes:
|takes the standard output of the command on the left, and pipes it as standard input to the command on the right. You can think of this as “command to command” redirection.
And the example it gives is exactly what I wanted to use in Task 8: cat volcanoes.txt | wc
So why is it suggested that I pipe the standard output from list1.txt to wc? I though that only commands can produce a standard output. Shouldn’t I use cat on list1.txt and then pipe its output to wc?