Offer Alert | 71% + 5% Off & 26-days Extra Lab | Use Coupon Code RDC on Checkout |

  Enroll Now

Linux Basics

71 / 87

Pipes - Introduction

If we want to send the output of one program to another, we can use pipe. A pipe is denoted by "|".

"echo" command prints on the standard output whatever argument is passed to it.

echo "Hi"

"wc" command prints the number of characters, words and lines out of whatever you type on standard input. Start "wc" command, type some text and press Ctrl+d to end the input:

how are you
[CTRL + d]


        2       4      15

Now, if we want to count number of words, characters in the output of any program, we can pipe the output in the following way:

        echo "Hello, World" | wc

You can also save the results using redirection, in the following way:

        echo "Hello, World" | wc > wc_results

Please execute above command to succeed the assessment.