It's an IO redirection operation. You have :
in UNIX world,
You can redirect output of the your command to a file. such as:
ls -l > myfile.txt
Above command used stdout.
ls -l >> myfile.txt
Above command doesn't overwrite a file; it just appends to end of the file, or creates it if it doesn't exist.
Many commands have standard error: if you want to redirect standard error you just use
Suppose, you want to read a file for which you don't have permission. It's a error. If you are a normal user, use:
cat /etc/passwd 2> myerror.txt
Sometimes you want to redirect standard error and standard out to the same place. You may for example:
ls -R /etc 2>&1 > myoutputanderrors.txt
But Your Answer:
Redirection of output causes the file whose name results from the expansion of word to be opened for writing on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the file does not exist it is created; if it does exist it is truncated to zero size.
The general format for redirecting output is:
If the redirection operator is
‘>’, and the
noclobber option to the set builtin has been enabled, the redirection will fail if the file whose name results from the expansion of word exists and is a regular file. If the redirection operator is
‘>|’, or the redirection operator is
‘>’ and the noclobber option is not enabled, the redirection is attempted even if the file named by word exists.