I am learning about Linux to take the LPIC Lv.1 which is the exam of Linux these days.
$ ps aux > proc.txt
As you can see above, I made a file by the output of the ps command named proc.txt
.
Then I tried to show the content of proc.txt
as hit the command like this.
×
$ cat proc.txt > less
However, It didn`t work, nothing was shown.
Even though this worked.
◯
$ cat proc.txt | less
I thought pipe:|
and direction:<, >
both make the result itself the input for the next command but it is not actually.
What is the difference between them?
>
redirects stdout to a file. |
redirects stdout to another command.