> : is used to overwrite contents of one file to other
>> : is used to append contents from one file to other
0> : std input
1> : redirect to std output
2> : redirect to std error
2>&1: std error to std output
Examples:
1)cat file1 > file2
(overwriting contents of file2 with file1)
2)cat file1 >> file2
(appending file2 with file1)
3)cat file1 > /dev/test 2>&1
(if the above copy command is wrong then that error will also be directed to output. In this case whether command is right or wrong it will be directed to /dev/test file)
No comments:
Post a Comment