181. How can you redirect I/O in Unix?
In Unix we can redirect the output of command or operation to a file instead of command line interface (CLI). For this we sue redirection pointers.
These are symbols > and >>.
If we want to write the output of ls –lrt command to a file we use following:
% ls –lrt > fileList.txt
If we want to copy one file to another file we use following:
% cat srcFile > copyFile
If we want to append the contents of one file at the end of another file we use following:
% cat srcFile >> appendToFile