Tenets of the UNIX Philosophy

from The Unix Philosophy by Mike Gancarz

ISBN:1-555558-123-4. Copyright 1995 Butterworth-Heinemann.

Reprinted with Permission of Digital Press

The main tenets of the Unix Philosophy are as follows:

1. Small is beautiful.
  • Small programs are easy to understand.
  • Small programs are easy to maintain.
  • Small programs consume fewer system resources.
  • Small programs are easier to combine with other tools.
  • 2. Make each program do one thing well.
  • "The best program...does but one task in its life and does it well."
  • "The program is loaded into memory, accomplishes its function, and then gets out of the way to allow the next single-minded program to begin."
  • 3. Build a prototype as soon as possible.
  • Prototyping is a learning process.
  • Early prototyping reduces risk.
  • 4. Choose portability over efficiency.
  • Next ---'s hardware will run faster.
  • Don't spend too much time making a program run faster.
  • The most efficient way is rarely portable.
  • Good programs never die--they are ported to new hardware platforms.
  • 5. Store numerical data in flat ASCII files.
  • ASCII text is a common interchange format.
  • ASCII text is easily read and edited.
  • ASCII data files simplify the use of Unix text tools.
  • Increased portability overcomes the lack of speed (of flat ASCII text files...)
  • The lack of speed is overcome by next year's machine.
  • 6. Use software leverage to your advantage
  • Good programmers write good code; great programmers "borrow" good code.
  • Avoid the not-invented-here syndrome.
  • Allow other people to use your code to leverage their own work.
  • Automate everything.
  • 7. Use shell scripts to increase leverage and portability.
  • Shell scripts give you awesome leverage
  • Shell scripts leverage your time, too.
  • Shell scripts are more portable than C.
  • Resist the desire to rewrite shell scripts in C.
  • 8. Avoid captive user interfaces.
  • CUIs assume that the user is human.
  • CUI command parsers are often big and ugly to write.
  • CUIs tend to adopt a "big is beautiful" approach.
  • Programs having CUIs are hard to combine with other programs.
  • CUIs do not scale well.
  • CUIs do not take advantage of software leverage.
  • 9. Make every program a filter.
  • Every program written since the dawn of computing is a filter.
  • Programs do not create data--people do.
  • Computers convert data from one form to another.
  • Use stdin for data input;
  • Use stdout for data output;
  • Use stderr for out-of-band information.
  • Ten Lesser Tenets

    1. Allow the User to tailor the environment.
    2. Make operating system kernels small and lightweight.
    3. Use lower case and keep it short.
    4. Save Trees.
    5. Silence is golden.
    6. Think parallel.
    7. The sum of the parts is greater than the whole.
    8. Look for the 90 percent solution.
    9. Worse is better. (I won't try to explain this one...)
    10. Think hierarchically.

    "Unix owes much of its success to the fact that its developers saw no particular need to retain strong control of its source code."