We Should Teach Students UNIX, or the Power of Pipes

2023-09-14

Teaching the command-line is increasingly eschewed for all-in-one IDEs and web platforms. For long-term transferable skills, we should revisit UNIX in Computing curriculums.

In the same way every teacher wants their subject given special priority, I think greater focus to be given to teaching UNIX in Computing Science curriculums. Allow me to make my case.

I'll preface this by saying that when I refer to UNIX, I'm meaning using UNIX-like tools, typically via a command line. I'm not suggesting we wheel out the PDP-11.

How are students taught Computing? Taught to program? They're probably told to open an IDE, create a new 'project' or 'solution' and leave it at that. How do they debug? The IDE shows them. What's the right syntax for that function? The IDE shows them. Where did you make that syntax error? The IDE shows them.

While these comforts are welcome, this abstracts away too much in my opinion. Indeed, Tyson Kendon and Ben Stephenson of the University of Calgary put it well:

While our students have grown up using so much technology that they are sometimes referred to as "digital natives", they often struggle to learn to use a command line interface on an unfamiliar operating system because it is so far removed from their prior computing experience.

UNIX Re-frames What Computing Is

This is one of the key reasons I advocate familiarising students with UNIX: it re-frames what Computing is. With sufficient experience of chaining together pipes, writing shell scripts to automate tasks, or just interacting with a computer through direct commands; Computing starts to move away from the idea that programs must operate in a vacuum: I program in my IDE, I write documents in a word processor, I use the Internet via a browser. UNIX however allows endless possibilities to create new programs on the fly for whatever purpose you might have. One recent example I'm rather proud of was putting together a script that found all the keywords in a collection of papers:

By chaining together just six programs I took a collection of documents and created a neatly organised list of keywords that can be modified and expanded as needed. I created entirely new functionality that none of the individual commands could offer on their own. How would I have tackled this issue without UNIX? Gone through and transcribed each document by hand? Written a script in a language like Python that probably meant installing some extra packages to perform? The use case is so niche that I doubt a pre-made executable would have existed for me.

It Gives A Modular View of Problems

When you're working at the command-line, with the ability to feed one programs output as the input to another. Programs stop being monoliths but rather a collection of tools.

I believe this fundamentally shifts how you look at the act of computing.

For one, problem solving changes from trying to figure out what singular existing program can solve your issue - to what programs (tools) you have at your disposal and how they can be combined to get what you want. Critical thinking is also aided by having you walk through a problem step by step; figuring out what data needs to come in and go out as you move from program to program.

It's Transferable

But more broadly, if you learn an IDE, you have an excellent knowledge of that specific IDE - an IDE that might be tied to one platform, that might have a subscription fee, that might get shutdown at any moment.

If you learn UNIX you can move anywhere with things like Cygwin for Windows, a fully spec-compliant environment on every Mac, and an innumerable number of options across every Linux and BSD distribution.

It Connects With the History of Computing

Using programs that, in many cases have existed longer than you've been alive, helps affirm the idea of Computing as a continually developing field. Often times tools and languages are presented in a vacuum. We use this tool because the course teaches it - and that's ok, most students simply want to get up and running with whatever is being taught as soon as possible.

But learning the command-line gives a fresh perspective. It gives you a better appreciation for why one-click solutions exist in your IDE, for what's really happening under the hood. It develops a deeper knowledge of a range of tools that are going to be available to you almost anywhere and be applicable to almost any possible situation.

So for preparing students with a sustainable, transferable, and reliable knowledge-base - why not teach UNIX?