This is why “Unix Pipelines” are so powerful

Unix Pipelines are basically the mechanism of connecting, directly, the output of a program to the input of another program.

A brief history:

“Historically” developers did not think of connecting programs at all, in fact they used to see a program as an entity that takes gives a certain output, and that’s it.

The magic Operator “ | ” :

Linux shell provided since it’s beginning the mechanism of file redirection, whith a pretty easy syntax, but the “new invention” was the idea of putting and operator “ | ” to directly connect one programs output to another’s input, and it can goes on and on with and the end multiple programs being connected.

a brief exemple of listing all sub-directories in the current directory with pipelines:

Advantages of using Pipelines:

First, with pipelines you don’t have to write a massive program, but in stead you may relay on connecting existing smaller programs wich allows to much “cleaner” modifications of the program if you need one.

Second, and the most powerful idea in my opinion is that those small programs, when connected together can work together and operate in ways that were not thought of in their original design.

another exemple on how to list all the files in an Apache log directory for the month of September in the current year

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store