What does Unix programming mean, exactly?

I thought I understood what the term Unix programming meant, but now, after reading about it in a kernel/C programming context, I feel like I need to clarify the meaning of this term.

It is not clear to me if it means:

  1. Shell programming,
  2. Unix programming tools,
  3. a particular way/pattern of programming Unix command-line tools (e.g, to agree with the pipeline way of “Unix shell programming”), or
  4. something else.
Asked By: Brandt


“Unix programming” refers to programming explicitly for a unix environment. This would include programming for shells that conform to a relevant standard (such as POSIX). However, it would also include programming in any language whilst making explicit use of system interfaces and resources that are similarly standardized, presuming that these are specific to the *nix world.

For example, network programming without a third party library in C or C++ is not portable, because neither standard says anything about it. Networking in C/C++ is implemented using an interface dictated by the operating system, and on while on *nix-ish systems this is more-or-less universal, you cannot port that code unchanged to (e.g.) Windows, and vice versa. Hence, doing network stuff in C or C++ means using a portable library, or targeting a platform, and Unix is one possibility in the later case, hence, that’s “unix programming” (and C or C++ programming, and network programming).1

However, networking programming in many higher level languages such as perl or python or java is portable; these languages are generally implemented in C, but while the details of the implementation differ from platform to platform, the interface does not. Therefore you can write networking code in perl that should run on any system on which perl runs; on a Unix system, this is translated by the interpreter implementation into the appropriate native calls, and on a windows system, it will be translated differently. Since your actual perl code is not specific to anything but perl, it’s not unix programming. It’s network programming, and perl programming, but not unix programming.

1. Because of the intimate historical relationship between C and Unix, the fact that C has been the language most used to write operating systems generally, and the nature of what an “operating system” is, there’s a lot of stuff in the category “OS specific C programming” — another everyday example besides networking is filesystem oriented stuff, such as statting files and reading directories. Hence, there’s various “Unix Programming in C” type books around, because basic programming in C inevitably involves a lot of OS specific elements. This is not the case with more portable languages such as perl or java; in this case, the subject of the book will likely be “Systems programming in Perl”, or more likely, just plain “Programming with Perl”.

Answered By: goldilocks
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.