Difference between > and |?


It seems to me like they both do the same thing... whats the difference? Is it solely that > is used with files and | only works with commands?

Suggest to include tee in command line course

Good question.

Let's analyze this a bit:

  • > "redirect": this is used to redirect output from a common to a file on disk, overwriting anything that may have been already in the file.
  • >> "appending redirect": same as redirect, but instead it appends rather than overwrites.
  • < "read": read a file for input to a command
  • | "pipe": pass the output of a command to another command for further processing
  • tee "tee": used with | to simultaneously redirect and pipe.

With this information, are you able to see the different?

> is used to toss into a file and be done.
| is to pass onto another command.


Yah, this helps, thanks :smile: Although I don't think we were introduced to the tee, but that's ok. I guess we can look up extra info on that. Thanks!


No worries. I didn't think tee would be included, but I thought I might give you some background on it anyway.


A post was split to a new topic: Suggest to include tee in command line course


press shift and \ and you can do