Difference between revisions of "Redirection"
From Knoppix Documentation Wiki
Harry Kuhman (Talk | contribs) m (Reverted edit of Nk6K5w, changed back to last version by Dr Kludge) |
|||
Line 6: | Line 6: | ||
cmd < read file to pipe input in <br> | cmd < read file to pipe input in <br> | ||
cmd >> append write file <br> | cmd >> append write file <br> | ||
− | cmd 1>log.out 2> | + | cmd 1>log.out 2>&1 # dump stdin and stderr to the output file. |
+ | |||
+ | |||
+ | stdin: file stream 0<br> | ||
+ | stdout: file stream 1<br> | ||
+ | stderr: file stream 2<br> | ||
+ | |||
+ | Advanced: | ||
+ | |||
+ | Teeing error data. So, when you have a large compile running. You can log all output to a file & see what is happening. '''gcc *.c 1>log1.out 2>log2.out''' You will not see echoing to the console screen. | ||
+ | |||
+ | '''gcc *.c 2>&1 | tee all.out''' |
Revision as of 17:30, 13 April 2007
Redirection
First, you have input / output streams. This is where the keyboard (input) data or display (output) data is (normally) going to/from.
cmd > write file
cmd < read file to pipe input in
cmd >> append write file
cmd 1>log.out 2>&1 # dump stdin and stderr to the output file.
stdin: file stream 0
stdout: file stream 1
stderr: file stream 2
Advanced:
Teeing error data. So, when you have a large compile running. You can log all output to a file & see what is happening. gcc *.c 1>log1.out 2>log2.out You will not see echoing to the console screen.
gcc *.c 2>&1 | tee all.out