Tutorial Linux: Redirecting Output and Input – Linux is popular for its approach in giving us building blocks for us to put together and develop things we need, in this Tutorial Linux, we’re going to learn Redirection and how to Redirect an output.

What you need to know about Redirection
Processes which are initiated by the commands typically write to the terminal screen while many take the input from the keyboard as its standard input, however, at times you’re presented with a standard error in which said processes by default write error messages to your terminal screen. When this happens, type % cat without adding specific file, type random words on keyboard before you press Return key, and follow with holding Ctrl key while pressing [d] at the same time to end your input.
Here is what happens: when you run a cat command without specifying a particular file to be read, it automatically reads your standard input and the [d] or ^D instantly copies it to your screen.
How to Redirect Output and Input
To properly redirect your output, use the > symbol as seen in the following example: % cat > list1 and then type random words and press the return key after each of the word you type in. See the following example:
plane
helicopter
pilot
^D
The cat command will automatically read your standard input while its > will automatically redirect its output into a specific file referred to as list1. To read the contents, simply type in % cat list1. As to how to redirect input, the < symbol is used. Type in % sort to start and type in words as follows:
orange
mango
avocado
^D
Output will contain the aforementioned words and redirect it using these steps: type in % sort < biglist, once your output is specifically sorted to a file, type in % sort < biglist > nlist. Use cat to read the nlist content.