With regards to piping commands, what are the greater than (>) and less than (<) symbols called?

by Mikey   Last Updated October 10, 2019 21:01 PM

On linux at least, and I think windows/dos shell too you can use > to "pipe" output into a file. Something like:

cat myfile.txt > mightAsWellCP.txt

What is that piece of syntax sugar called? This is a "pipe": | so what do we call the > and < (and << and >> while were at it.)

Tags : pipe


Answers 4


I usually refer to all four variations (< << > >>) as a "redirect" when speaking to folks that I know will understand.

Brian Adkins
Brian Adkins
September 28, 2012 01:08 AM

They're symbols for redirection of input/output.
Quick runthrough on the differences between the redirection syntax commands

rbm
rbm
September 28, 2012 01:52 AM

When speaking a command-line, I usually pronounce the symbols by their function.

  • > "output to"
  • >> "append to"
  • < "input from"
  • | "pipe"

So when reading your example out loud:

cat myfile.txt > mightAsWellCP.txt

I would pronounce as "cat myfile dot T X T output to might as well C P dot T X T".

RJHunter
RJHunter
May 30, 2014 09:23 AM

> is used to redirect output.

$echo "hello" > file.txt

< is used to redirect input.

$ cat < file.txt

Output:

hello

>> is used to append output to the end of the file.

$ echo "world!" >> file.txt

Output:

hello
world!

<< (called here document) is a file literal or input stream literal.

$cat << EOF >> file.txt

Output:

>

Here you can type whatever you want and it can be multiline. It ends when you type EOF (We used EOF in our example but you can use something else instead).

> linux
> is
> EOF

Output:

hello
world!
linux
is

<<< (called here string) is the same as << but takes only one word.

$cat <<< great! >> file.txt

Output:

hello
world!
linux
is
great!

Note that we could have used $cat <<< great! | tee file.txt instead of $cat <<< great! >> file.txt.

Mathieu Gemard
Mathieu Gemard
October 10, 2019 20:44 PM

Related Questions


Updated August 28, 2017 19:01 PM

Updated July 04, 2017 13:01 PM

Updated August 23, 2017 13:01 PM

Updated September 12, 2019 20:01 PM

Updated November 30, 2015 13:00 PM