Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 1.6 Power Tools for Editing Chapter 1
Next: 1.8 There Are Many Shells

1.7 Power Grows on You

It has been said that UNIX is not an operating system as much as it is a way of thinking. In The UNIX Programming Environment, Kernighan and Pike write that at the heart of the UNIX philosophy "is the idea that the power of a system comes more from the relationships among programs than from the programs themselves."

Almost all of the utility programs that run under UNIX share the same user interface - a minimal interface to be sure - but one that allows them to be strung together in pipelines to do jobs that no single program could do alone.

There are many operating systems with features UNIX can't match - better performance, better documentation, more ease of use. But none of them are so powerful or so exciting to use once you get the hang of pipes and filters, and the programming power of the shell.

A new user starts by stringing together simple pipelines and, when they get long enough, saving them into a file (1.5) for later execution. Gradually, if the user has the right temperament, he gets the idea that the computer can do more of the boring part of many jobs. Perhaps he starts out with a for loop (9.12) to apply the same editing script to a series of files. Conditions and cases soon follow and before long, he finds himself programming.

On most systems, you need to learn consciously how to program. You must take up the study of one or more programming languages and spend a fair amount of concentrated effort before you can do anything productive. UNIX, on the other hand, teaches programming imperceptibly - it is a slow but steady extension of the work you do simply in interacting with the computer.

Before long, you can step outside the bounds of the tools that have already been provided by the designers of the system, and solve problems that don't quite fit the mold. This is sometimes called hacking; in other contexts, it is called "engineering." In essence, it is the ability to build a tool when the right one is not already on hand.

Dale Dougherty compares UNIX to the Volkswagen beetle, that unique automobile of the '60s and '70s. Its simple design was in part what made it popular; the "bug" was hand-maintainable. VW owners (users) could tinker with their cars, performing such tasks as changing spark plugs by hand. They scoffed at owners of other cars who depended upon auto mechanics. It is perhaps this same feeling of independence (let me do it myself) that the UNIX environment fosters in its users. There are many other, quite capable software environments that are packaged to keep users out, like a television set.

In some ways, the secret of UNIX is that its working parts are visible. The UNIX environment, like the VW beetle, is designed so that users can take it apart and put it back together. UNIX provides general-purpose tools, all of which are designed to work together.

No single program, however well thought out, will solve every problem. There is always a special case, a special need, a situation that runs counter to the expected. But UNIX is not a single program. It is a collection of hundreds of them, and with these basic tools, a clever or dedicated person can meet just about any computing problem.

Like the fruits of any advanced system, these capabilities don't fall unbidden into the hands of new users. But they are there for the reaching. And over time, even those users who want a system they don't have to think about will gradually reach out for these capabilities. Faced with a choice between an hour spent on a boring, repetitive task and an hour putting together a tool that will do the task in a flash, most of us will choose the latter.


Previous: 1.6 Power Tools for Editing UNIX Power ToolsNext: 1.8 There Are Many Shells
1.6 Power Tools for Editing Book Index1.8 There Are Many Shells

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System