I was trying to find how to pass some text to a file without overwriting what's there already using the > command and I realised I don't know what it's called. Searching for right arrow or right chevron or more than command didn't show up anything. I've always just called it pass to.


4 Answers 4


> is not a command but a file descriptor redirection. This means that the shell parses this assignment, removes it from the command line and changes the environment for the new process in which it is started. The new process does not notice this part of the command line. That's the reason why you can put it everywhere: At the beginning, at the end or in between.

Look for the REDIRECTION block in man bash.

In order to append to an existing file you need to use >>.

  • If the option noclobber is set, then >| will override and allow clobbering the file.
    – bsd
    Apr 9, 2014 at 16:52

> is a redirection operator. Note that using > to redirect to a regular file will overwrite what is already there, unless noclobber is set. >> will append to the end of the file.

  • And it doesn't overwrite if noclobber has been set (bash). Apr 3, 2014 at 16:34
  • Updated my answer, thanks for the clarifications.
    – Josh Jolly
    Apr 3, 2014 at 16:48
  • 5
    @HaukeLaging noclobber isn't just a bashism. It's part of POSIX
    – kojiro
    Apr 3, 2014 at 17:16

As other people have answered, > is not a command, but rather a redirect operator. However, the term 'redirection operator' doesn't specifically refer to the >, but a number of different possible redirection operators. The dash man page lists the following as redirection operators:

 < > >| << >> <& >& <<- <>

I'm not sure there is a valid individual name for each one. Maybe if you dig through some old shell manuals you will find something interesting. This source, correct or incorrect, certainly has a go at naming some of them:

>  - 'output redirection operator'
<  - 'input redirection operator'
>> - 'output append operator'

But also:

2> - 'standard error redirection operator'

However I don't think this is really correct since the 2 is technically an argument rather than part of the operator.

A quick reference (in case you don't recognise any of the ones above):

>   - redirect output stream to a file, eg >somefile (for stdout) or 2>somefile
>|  - as above but overwrite the file even if the noclobber shell option is set
>>  - append output stream to file
<   - redirect input stream from file, n defaults to 0 for stdin
<>  - open file for reading and writing on stdin
>&  - redirect output stream to another stream (eg >&1) or close with - (eg 2>&-)
<<  - here document - see http://en.wikipedia.org/wiki/Here_document
<<- - here document with leading tabs removed.

In bash you also have:

<<< - here string, a one line here file. Eg <<<"foo bar"
  • Very nice quick reference list, but doesn't <<- remove leading tabs and spaces?
    – iconoclast
    Jun 22, 2014 at 18:21
  • @iconoclast, nope, definitely just tabs.
    – Graeme
    Jun 22, 2014 at 19:24

> redirects output to a file (or device) overwriting anything already existing there

>> redirects output to a file (or device) appending to anything already existing there

< directs data from a file (or device) to a program or device

<< a here document

  • 1
    << is a here document
    – Graeme
    Apr 5, 2014 at 8:35
  • 1
    @ Graeme I edited my answer. Thank you for the help
    – les
    Apr 7, 2014 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .