Commans line Pipes

can someone help to explain command line pipes with better example ? or even with the example used in this course. I did not understand this example.

Chapter: Working with SHELL -II, Topic : IO Direction (03:26 minutes)

As an example, you can try to “cat” or concatenate a file.

for example: cat /etc/hosts.

This will print the entire contents of this file. Now, using command line pipes you can pass the output of this command as an input this way:

cat /etc/hosts | grep localhost

This will effectively, search for a pattern called “localhost” from the output of “cat /etc/hosts”.

Hope this helps.

let us know should you still have any questions.

1 Like

Thanks @vijin.palazhi . That explains well