Module 1 · Lesson 2 of 31

Linux distributions and the Unix philosophy

What a distribution is, how the families differ, why POSIX exists, what GPLv2 means for a product, and the nine tenets of the Unix philosophy.

  • Beginner
  • 6 min read
  • 12 min video
By the end you can 4 objectives
  • Explain what a distribution contains and how a derivative differs from it.
  • Name the two big package families and their tools.
  • Say what POSIX standardises and what GPLv2 asks of a product.
  • Recognise the nine tenets of the Unix philosophy.
Watch first, then read the lesson. Watch on YouTube · Eslam El Hefny channel
01

Distributions, packages, and open source in practice

6 min read

A distribution assembles the kernel, a C library (glibc on most desktops, musl on some small systems), the shell, core utilities and a package manager into one installable, updatable system. The two dominant families are the Debian family and the Red Hat family, which differ mainly in package format and tooling.

Before distributions, you collected the kernel, the C library, the GNU tools and the utilities yourself, compiled them, and hoped the versions worked together. A distribution is that work done once, for everybody.

What a distribution containsUtilitiescompiledGNU toolscompiledC librarycompiledLinux kernelcompiledtogether: a distributionUtilitiescompiledGNU toolscompiledC librarycompiledLinux kernelcompiledtogether: a distribution
Building a system by hand, and what a distribution wraps up

The first distributions

More than 200 distributions

Because the code is open, anyone can take a distribution, change it and share the result. A derivative is built from another distribution: Ubuntu comes from Debian, and Kubuntu and Lubuntu come from Ubuntu. A derivative can be official or unofficial.

DerivativesDebianUbuntuKubuntuLubuntuDebianUbuntuKubuntuLubuntu
A derivative is built from another distribution
The two package familiesDebian familyRed HatfamilyPackage formatdebrpmHigh-level toolaptdnfLow-level tooldpkgrpmExample distrosDebian,Ubuntu,Raspberry PiOSRHEL, Fedora,AlmaLinux
The two dominant package families, with their formats, tools and example distributions

On Debian, Ubuntu and Raspberry Pi OS you install software with apt, which uses the low-level dpkg and packages ending in .deb. On Red Hat Enterprise Linux, Fedora and AlmaLinux you use dnf, which uses rpm and packages ending in .rpm. A third group, such as Arch Linux with pacman and Alpine with apk, is independent. The commands you learn for using Linux itself are the same everywhere; only installation and upgrade syntax change.

Linux familiesLinuxDebian familyUbuntuLubuntuRaspberry Pi OSRed Hat familyFedoraCentOSLinuxDebian familyUbuntuLubuntuRaspberry Pi OSRed Hat familyFedoraCentOS
The two best known families
Debian logoUbuntu logoKubuntu logoLubuntu logoRed Hat logoFedora logoCentOS logoSlackware logo
Logos belong to their owners and are shown only to identify the projects. CentOS logo: Alain Reguera Delgado · CC BY-SA 4.0

POSIX: one agreed standard

When every system has its own interface, a program written for one may not work on another. IEEE Std 1003.1-1988 defined a common one: POSIX, the Portable Operating System Interface. Richard Stallman suggested the name (his account). Linux, which came later, aims towards POSIX compliance.

POSIXMany UnixsystemsdifferentinterfacesPOSIX, 1988IEEE Std1003.1-1988Linux, 1991aimstowardsPOSIXMany UnixsystemsdifferentinterfacesPOSIX, 1988IEEE Std1003.1-1988Linux, 1991aimstowardsPOSIX
Different Unix systems, one agreed interface, then Linux

Which one should you install?

To start, use Ubuntu. A new version comes every six months, and every two years one of them is an LTS (long-term support) release with five years of standard security maintenance.

Open-source licensing is not a detail for an engineer; it is a business decision. The Linux kernel is licensed under the GNU General Public License version 2, specifically GPL-2.0 only, without the "or any later version" option. The GPL is a copyleft licence: you may use, study and modify the code, but if you distribute the modified program, you must also make the corresponding source code available under the same terms.

What GPLv2 means for a product

If your company ships a device that runs a GPLv2 kernel, it must offer the source of the kernel (and any GPL-licensed code linked into it) to anyone who receives the device. This is why vendors publish source-code offers on their support pages. Non-copyleft licences, such as the MIT or Apache licences, impose no such requirement. This paragraph is engineering guidance, not legal advice; for a real product, a lawyer reviews the final bill of materials.

Underlying this whole ecosystem is the Unix philosophy: write small programs that do one thing well, and combine them. A modern command line is dozens of tiny tools wired together, which is exactly what makes the shell powerful once you know the basics.

The Unix philosophy: nine tenets

Mike Gancarz collected them in The UNIX Philosophy. They explain why Linux tools look the way they do.

  1. Small is beautiful.Write the smallest program that does the job.
  2. Make each program do one thing well.cp copies, ls lists. Many small commands instead of one that does everything.
  3. Build a prototype as soon as possible.Get a first version out early, then improve it. Linux 0.01 came in 1991, 1.0 in 1994.
  4. Choose portability over efficiency.Prefer code that runs on many systems over code tuned for one.
  5. Store numerical data in flat ASCII files.Plain text can be read by many programs: cat, grep, less.
  6. Use software leverage to your advantage.Build on tools that already exist before writing your own.
  7. Use shell scripts to increase leverage and portability.Put repeated commands in one script and run it anywhere there is a shell.
  8. Avoid captive user interfaces.A program that waits for clicks cannot be automated. Give it what it needs, then let it run.
  9. Make every program a filter.Read text in, write text out, so one program feeds the next.

Tenets as listed in the Linux Journal review, 1 September 1995.

Programs as filtersText inProgram 1TextProgram 2Text outText inProgram 1TextProgram 2Text out
Every program a filter: output becomes the next input

Try combining three tools below:

cat passes the line through, grep keeps it because it contains 'bash', and cut splits on ':' to keep field 7, the login shell, yielding /bin/bash.

Key takeaways

  • Linux is a kernel; a distribution bundles it with user-space programs, a package manager and a licence policy.
  • A derivative is built from another distribution, as Ubuntu is built from Debian.
  • POSIX is one agreed interface, so programs can move between systems.
  • Small programs that read and write text can be combined: that is the Unix philosophy.

Reflect

  1. Explain to a colleague, in two sentences: explain what a distribution contains and how a derivative differs from it.
  2. Which objective are you least sure about? Re-read that section.
Practise this lessonQuiz, interview preparation and spaced review

References and further reading

Official documentation first. Links checked when the lesson was published.

Find your next step

↑ ↓ to move · Enter to open · Esc to close