Contents /
Previous /
Next
IO Redirection
>& and > and >> and < are called redirection operators.
\>& : merges std streams.
> : redirects stdout of stderr stream into a file.
>> : appends stdout or stderr stream to a file.
< : redirects the contents of a file in place of stdin,
it replace what would normally come from a keyboard.
Examples:
2>&1 : merges stderr into stdout
(useful when stderr goes to /dev/null).
1>A : writes stdout into file A.
> ls -d -l a* b* thisFileDoesNotExist
ls: thisFileDoesNotExist: No such file or directory
drwxr-x--- 2 felix users 664 2002-09-26 10:24 ada
drwxr-x--- 3 felix users 2184 2002-10-05 13:45 bin
Try:
ls -d -l a* b* thisFileDoesNotExist 2>ErrorLog
ls -d -l a* b* thisFileDoesNotExist 1>ErrorLog
ls -d -l a* b* thisFileDoesNotExist 1>>ErrorLog
cat
cat < ErrorLog