Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Environment and Redirection Pipes and Redirection

What are Pipes?

Referenced video: https://teamtreehouse.com/library/console-foundations/environment-and-redirection/pipes-and-redirection

I'm not understanding what Pipes ( | ) are and what they're doing. I think all it's doing is stringing together different programs and running them all at once, but when/why would that be useful at the console command level? Is it just a time saver?

1 Answer

Steven Parker
Steven Parker
231,198 Points

:point_right: Pipes connect program outputs and inputs.

As explained in the video: "So what pipe does is it takes the standard output of the process to the left of it and makes it the standard input to the process on the right." This can save you a step where you would otherwise create an intermediate file with one command, and use it as redirected input on another.

So it's both a time and disk-space saver.