Get your Unix recipes, piping hot, right here!

This page collects small, self-contained examples of how to exercise various obscure corners of the Unix API and Internet standards.


Code example illustrating use of Unix-domain sockets, also how to make a process into a daemon.


Code example illustrating how to parse RFC822 headers.


Code example illustrating use of Unix semaphores.


Code example illustrating interruptible delays using select(2).


Code example illustrating basic termios programming.

"Hello World" TCP/IP server daemon.

Contributions for this page are cheerfully accepted. Here are the rules:

  1. They must be working code with a test main().

  2. They must have an open-source license that is not infectious.

  3. They should have informative comments.

  4. They should be written to standards (ANSI C, POSIX, SuSV2, FSB) not individual Unix dialects.

Contributions that are working code from real projects will be preferred.

We are looking for examples in the following areas: mmap(2) and friends, shared memory, FIFOs, UDP, file locking, ptys, tty programming, anonymous pipe and socket pairs, controlling inheritence across fork(2).

There are some useful recipes for directory notification, file leases and power management here.