WHAT IS REDIRECTION?
Normally a command executing in the terminal shows it’s output on the terminal screen. Instead of that, if we could be able to print those output details to a file, it would be great. This what we known as Redirection. Redirecting the output of a command to a file instead to the terminal screen.
HOW TO REDIRECT?
- > – Greater than sign is used to redirect data to a file.
- >> – Two greater than signs are used to append data to a file.
- < – Less than sign is used to get data from a file to the terminal.
WHAT IS PIPING?
In the above examples we saw that how to put the output to a file and how to get the input from a file. Now let’s see how to give the output of one command to another command. This is known as piping.
HOW TO DO PIPING?
- | – Using this symbol in between two commands, we can redirect the output of first command to the second command as the input.
We can combine multiple commands using piping as well.
Also we can combine piping and redirection together as well.
Piping and Redirection is a much more advanced and helpful topic regarding LINUX. Hope you got clear idea about piping and redirection. Hope to see you soon with another interesting topic. Thank You!