The UNIX Philosophy


As it has evolved, UNIX has developed a characteristic, consistent approach that is sometimes referred to as the UNIX philosophy. This philosophy has deeply influenced the structure of the system and the way it works. Keeping this philosophy in mind helps you understand the way UNIX treats files and programs, the kinds of commands and programs it provides, and the way you use it to accomplish a task.

The UNIX philosophy is based on the idea that a powerful and complex computer system should still be simple, general, and extensible, and that making it so provides important benefits for both users and program developers. Another way to express the basic goals of the UNIX philosophy is to note that, for all its size and complexity, UNIX still reflects the idea that “small is beautiful.” This approach is especially reflected in the way UNIX treats files and in its focus on software tools.

UNIX views files in an extremely simple and general way within a single model. It views directories, ordinary files, devices such as printers and disk drives, and your keyboard and terminal screen all in the same way The file system hides details of the underlying hardware from you; for example, you do not need to know which drive a file is on. This simplicity allows you to concentrate on what you are really interested in-the data and information the file contains. In a local area network, the concept of a remote file system even saves you from needing to know which machine your files are on.

The fact that your screen and keyboard are treated as files enables you to use the same programs or commands that deal with ordinary stored files for taking input from your terminal or displaying information on it.

A unique characteristic of UNIX is the large collection of commands or software tools that it provides. This is another expression of the basic philosophy These tools are small programs, each designed to perform a specific function, and all designed to work together. Instead of a few large programs, each trying to do many things, UNIX provides many simple tools that can be combined to do a wide range of things. Some tools carry out one basic task and have mnemonic names. Others are programming languages in their own right with their own complicated syntaxes.

A good example of the tools approach is the sort command, which takes a file, sorts it according to one of several possible rules, and outputs the result. It can be used with any text file. It is often used together with other programs to sort their output.

A separate program for sorting means that other programs do not have to include their own sorting operations. This has obvious benefits for developers, but it also helps you. By using a single, generic, sorting program, you avoid the need to learn the different commands, options, and conventions that would be necessary if each program had to provide its own sorting.

The emphasis on modular tools is supported by one of the most characteristic features of UNIX-the pipe. This feature, important for both users and programmers, is a general mechanism that enables you to use the output of one command as the input of another. It is the “glue” used to join tools together to perform the tasks you need. UNIX treats input and output in a simple and consistent way, using standard input and standard output. For instance, input to a command can be taken either from a terminal or from the output of another command without using a different version of the command.




UNIX. The Complete Reference
UNIX: The Complete Reference, Second Edition (Complete Reference Series)
ISBN: 0072263369
EAN: 2147483647
Year: 2006
Pages: 316

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net