The greater than symbol is used to send information somewhere (for example a text file)
cat file1 file2 > file1_and_2.txt
This will concatenate the files together into one big file named “file1_and_2.txt”. Note that this will overwrite any existing file.
The less than symbol will insert information from somewhere (a text file) as if you typed it yourself. Often used with commands that are designed to get information from standard input only.
For example (using tr):
tr '[A-Z]' '[a-z]' < fileName.txt > fileNameNew.txt
The example above would insert the contents of “fileName.txt” into the input of tr and output the results to “fileNameNew.txt”.
The >> symbol appends (adds) information to the end of a file or creates one if the file doesn't exist.
The << symbol is sometimes used with commands that use standard input to take information. You simply type << word (where word can be any string) at the end of the command. However its main use is in shell scripting.
The command takes your input until you type “word”, which causes the command to terminate and process the input.
Using << is similar to using CTRL-D (EOF key), except it uses a string to perform the end-of-file function. This design allows it to be used in shell scripts.
For example type "cat" (with no options...) and it will work on standard input.
To stop entering standard input you would normally hit CTRL-D .
As an alternative you can type "cat << FINISHED", then type what you want.
When you are finished, instead of hitting CTRL-D you could type "FINISHED" and it will end (the word FINISHED will not be recorded).
Redirects error output. For example, to redirect the error output to /dev/null, so you do not see it, simply append this to the end of another command...
make some_file 2> /dev/null
This will run make on a file and send all error output to /dev/null
The “pipe” command allows the output of one command to be sent to the input of another.
cat file1.txt file2.txt | less
Concatenates the files together, then runs less on them. If you are only going to look at a single file, you would simply use less on the file...
Sends output of a program to a file and to standard output. Think of it as a T intersection...it goes two ways.
ls /home/user | tee my_directories.txt
Lists the files (displays the output on the screen) and sends the output to a file: “my_directories.txt”.
Redirects standard output and error output to a specific location.
make &> /dev/null
Sends both error output and standard output to /dev/null so you won't see anything...