A Thousand Little Pieces

One of the reasons I love Unix/Linux is that it comes with dozens of little programs that work amazingly well together, and is designed to let them from the ground up. For example, there's the handy "find" command that will show you all files, subdirectories, sub-subdirectories, etc. in a directory (by default your current directory if you don't specify one). So "find /" in Linux will show every single file and directory on the whole system. If you want to find any file containing the word "foo", you could type:
find | grep foo
This is the first example of two programs working together - "find" lists the files, and "grep" does the search. "|" is the magical glue that makes them work together: it takes the output from "find" and pipes it into "grep".

Here's another example: "wc" shows a character, word, and line count for whatever is given to it. "wc -l" just counts the lines. So in the previous example, if you wanted to count how many files have the word "foo" in it, you could type:
find | grep foo | wc -l
If you want to sort the results instead:
find | grep foo | sort
Note: I'm not sure if find already does sorting, but I wouldn't assume so.

Anyway, these little tools are all really useful on their own, but when you chain them together, you expand their value tremendously. And Linux makes it almost trivial to write your own tool that would fit in with the others (this system is also much more effective than any "supertool" that may have been designed - no all-in-one solution would have been nearly as flexible or powerful in the long term).

The point of all this, besides the geeky *nix love, is that it shows how very simple, specialized pieces can work together to make something much greater than the sum of their parts. It happens on a much grander scale in biology with cells - billions of cells work together to make an organ, and all the organs work together for a working body. Each cell does its thing, but because the way the system is set up, something called an organism emerges.

The same thing also happens in the market - billions of individuals make decisions, and incredibly complex economic trends emerge. It's much messier because the "|" (i.e. the written and unwritten laws that govern financial relationships) is much messier.

So a belated kudos to the original developers of Unix for understanding this concept - I think it's a major reason for its staying power as an operating system.


No comments: