How to teach Bash/Linux so high school students will be intrigued?
November 20, 2020 9:20 AM   Subscribe

I'm teaching an Intro to CS course in high school and want to use the short week before Thanksgiving to introduce them to a command-line OS — namely, Bash on some vanilla Linux (Debian, I assume). How do I induce them to conclude anything other than "wow, command-line is a pain in the ass?"

I've never used Linux or Bash when I needed to, so my experience is limited to some 'ls -al' and 'chmod,' along with a hopeful course in Vim. Given that I will have 2 1/2 days, 80-minute periods, what can I realistically have the students do that will make a light bulb turn on in their minds?

Understand that about 1/3 of these students were just about demolished by Python, so shell scripting or dense one-liners with pipes will be hopeless. Just some practices that show what's grand about Bash, rather than what's arcane or inconvenient.

Thanks!
posted by argybarg to Computers & Internet (44 answers total) 11 users marked this as a favorite
 
Oof, this might be an uphill battle. I use the command line every day for my job but it’s increasingly seen as old-school by younger people.

The Mac terminal has a command “say” which uses text-to-speech to make the computer speak out loud:

say “Hey, you idiot.”

If there’s a similar utility that exists for Debian that could be a fun starting point, they can make their computers swear, insult their friends, etc.

If presented right, apt-get could be interesting. “It’s like the app store but faster and free.” Would have to come up with some fun packages to download though.
posted by mekily at 9:28 AM on November 20, 2020 [5 favorites]


yeah I love it too but the risk is that to someone who hasn't come from a world in which the command line was all you had, it's going to look like a slow & laborious way to do what's already easy in some GUI that they already know - and tbf it's only really when you get to the dense piped one-liners that bash per se is doing anything very interesting or distinctive

can you do something based on RPi instead? at least that _looks_ like an intriguing piece of equipment - and you'd soon get into pretty much exactly the same Debian-based CLI - at least until you show them how to use vncserver or ssh -X

like: you start with a single RPi blinking its little lights in the middle of the room, that you've already previously configured to do $whatever

challenge to the class: what is this strange thing? what can we make it do? how do we even log into it, given that it doesn't have a keyboard & monitor attached? i mean we do have these other machines with putty installed, and they're on the same network... hey do you think that could maybe give us a way to connect? etc
posted by rd45 at 9:59 AM on November 20, 2020 [4 favorites]


I would lean initially towards stuff that does things you wouldn't expect with the terminal, like generating ASCII art or fun with cURL like watching Star Wars or getting the weather or moon phases, maybe moving on from there to generating plots. I'm sure there are a ton of other web apps that are cURLable. You could pick some simple task and race Excel vs gnuplot, or wttr.in vs Dark Sky.

If you can apt-get something like an ASCII game and start it in a grand total of two commands, all the better.
posted by supercres at 10:06 AM on November 20, 2020 [6 favorites]


I would find some data -- like a story or some math homework -- that the students are all familiar with, and then use little tools (like sed or `sort -u` or whatever) to manipulate the data in magic-seeming ways. Like, ask how you would swap the names of Pooh and Piglet in a paragraph without using a third, temporary name. Or sort out a bunch of numeric strings of sports data.

Another demonstration would be to have some MP3s on the system, and use a one-line installer to set up an MPD server and wifi network. Shout out the URL and let them join in to play music. "It only took one command!" -- but then show them all the commands in the install script.
posted by wenestvedt at 10:13 AM on November 20, 2020 [2 favorites]


A simple but kind-of-interesting utility is 'zenity'. It can create all sorts of dialogs, progress notifications, question inputs, etc. It generally fits seamlessly into the desktop, and will be available in any linux distribution.

e.g.
zenity --notification --text="Stop looking at your phone"

Or, for example a simple timer:
sleep 15m
zenity --info --text='Your 15 minutes are up!'

You can also make file chooser dialogs, etc. One can integrate the desktop into the command line fairly easily with this sort of tool.

As per mekily's idea, you could also combine this with a text-to-speech package (e.g. festival or flite), where they have a simple dialog to get text, then pass that into the tts engine:
textinput=$(zenity --entry --text="What\'s up\?")
flite "$textinput
"
posted by patternocker at 10:14 AM on November 20, 2020


Along the games front, DCSS can be easily installed and played in the console, and if they get interested they can play it at home. Just playing the tutorial and learning commands feels almost like learning an OS or light programming language.

Maybe the Lynx web command line web browser is neat?
posted by SaltySalticid at 10:20 AM on November 20, 2020


Tough one, just because if you're coming from GUIs, command line stuff is only really "cool" once you're experienced enough to feel limited by GUIs, or you have some task that either can't be done with the GUI, or can't be done efficiently with the provided GUI.

What about some basic text file manipulation tools? If you have one file with a word spelled wrong (assume you don't have a spell-checker, or it's the kind of mistake spellcheck wouldn't catch), you just open it in a graphical text editor, find->replace, and be done, but what if you have 500 files? Do they know anything about regexes? You could have them write mad-libs with sed. What if they had a bunch of essays, and they had to change all the single spaces only at the ends of sentences to double-spaces? Check their word counts, find every file in a directory structure that referenced some topic. Show them how to read the man pages. Take a spin through the startup scripts on a typical headless linux box.
posted by mrgoat at 10:24 AM on November 20, 2020 [1 favorite]


I don't know that you'll be able to teach anything super-useful in so short a time. The CLI is powerful in part because of its steep learning curve.

One thing that might be interesting, though, is to show off the idea of pipes - daisy-chaining tools together to accomplish a task. Something like a mass-file-renaming, or 'cat $file | sort | uniq -c | sort -rn | head -10'

This sort of thing is hard in a GUI - sending data through different apps to arrive at a desired result - but it's the basis for the entire Unix Way.
posted by jquinby at 10:29 AM on November 20, 2020 [3 favorites]


I'll second aSCII games as being quite cool. DCSS, NetHack, etc. are all free and have an astonishing amount of depth, though it might not look like much. NetHack was basically Diablo years before it existed.
posted by Alensin at 10:41 AM on November 20, 2020 [1 favorite]


function say { echo "$@" | espeak --stdin --stdout | paplay; }

I'm not sure how you would go about this introduction without some pipes and composed one-liners, it's what shell does.

Boss sends a list of names and asks you to pick 5 random winners. Do you write some Python, or open up Excel? Hell no.

Select the list of names...
xclip -o | shuf | head -5 | mail -s 'the winners' boss
And well that job took like 5 seconds, you should delay actually doing it for at least a few minutes lest your boss starts thinking you can do everything in 5 seconds.

Pick lotto numbers...
seq 1 70 | shuf | head -5 | sort -n; seq 1 20 | shuf | head -1

Someway you have to get across that before GUI, the people writing the GUI had created and were using the CLI and it's bazillion commands like casting actual magic spells. You learn to speak the secret language and then you type to the computer and tell it what to do instead of poking around with a mouse and pushing buttons and clicking checkboxes.

Good luck in a couple of days. I'm glad you're trying.
posted by zengargoyle at 10:51 AM on November 20, 2020 [1 favorite]


Maybe they'd enjoy In The Beginning Was The Command Line.

The Ascii games are a good idea. Maybe you could appeal to their sense of finding a secret easter egg: You can boot up Emacs and then find the hidden, bizarre adventure game tucked away in it.
posted by johngoren at 10:51 AM on November 20, 2020 [1 favorite]


I think high school students would probably find youtube-dl to be useful, and you could explain command line switches so they could download only the audio/music rather than the whole video.
posted by I paid money to offer this... insight? at 10:53 AM on November 20, 2020 [8 favorites]


Have them play The Command Line Murders
posted by inkyz at 10:53 AM on November 20, 2020 [1 favorite]


Piping text manipulation commands from one to the other and redirecting to new files is what came to mind for me. This tutorial looks like what I had in mind: cat, wc, time, head, tail, diff, patch, tr, cut, paste, join, sort, uniq, and uniq -c. You could also demo grep (including flags like -Hrni) & very basic regexes (^whatever and whatever$), file manipulation commands (e.g. du for finding what's taking too much space), web stuff (e.g. curl, curl -v, and wget), system monitoring stuff like top and iftop, and end user stuff like cal (show them "cal 9 1752" for a history lesson), calculators (bc or calc), Taskwarrior, and pass.
posted by Wobbuffet at 10:54 AM on November 20, 2020


ASCII games don't really teach the shell. in most OSs you can launch an ASCII game by double-clicking on its program icon.

Look at the intersections of the kids' interests with problems the shell is good at solving. What do these kids need to automate?
posted by Sauce Trough at 10:54 AM on November 20, 2020 [1 favorite]


SQL Server guru Scott Hanselman has a series of videos about this type of thing. here's the one about the command line.
How do you use the Command line? PowerShell, cmd, bash? - Computer Stuff They Didn't Teach You #13
posted by capnsue at 10:55 AM on November 20, 2020 [2 favorites]


It's tough; everything interesting you can do with the command line is programming. If they're not willing to program at all, not even pipes, then it is just a crappier version of a GUI.

I think some combination of grep/cut/sort/uniq on CSV files (like grep to filter out columns, pick out one column from dozens that has names, sort in alphabetical order and get unique) could be pretty simple and obviously useful.
posted by vogon_poet at 10:55 AM on November 20, 2020 [2 favorites]


One fun thing to try is applying grep to /usr/share/dict/words. For example, here are all the words starting with "qu" that contain a letter "j":
$ grep ^qu /usr/share/dict/words | grep j
quadratojugal
quadrijugal
quadrijugate
quadrijugous
quasijudicial
quillaja
quinquejugous
Lots of lexicographical queries that would be hard to do on the web become easy with grep and pipelines (even ignoring the full power of regular expressions, which you may not want to get into).
posted by panic at 11:00 AM on November 20, 2020 [2 favorites]


If you can find a way to show that a task in a GUI is more complicated than doing it in CL that may be helpful. Launching multiple apps, saving and reopening files, changing settings... but then show that you can do the entire thing in one line. They may respond to the idea that the GUI is dumbing and slowing things down for them.
posted by BlackLeotardFront at 11:05 AM on November 20, 2020 [3 favorites]


I agree with supercres's approach - the commandline is just really cool and fun, besides being useful. Other ideas along those lines: teach them how to use the commandline to make beeps and talk. The 'yes' command (and why it exists). If they're all on the same network, you... could teach the 'finger' command, a perennial favorite (and tell them about .plan files). ping and whoami. Networked tetris in the terminal. cowsay/cowthink is always fun. Can they make directories public to other uses? And navigate to each other's public directories?

Definitely show them the Star Wars thing supercres mentioned.

Teach them the really basic stuff like ctrl-c to stop a process, ctrl-z to freeze it (and then how to resume it in the background or foreground, and what that means), ctrl-l to clear the screen, shift-pgup/down to scroll, arrow keys to scroll through previous commands, the history command, etc. Ctrl-r. How to launch graphical programs and how to use 'jobs' and 'top'. Introduce them to 'man', how to navigate and search in 'less', and how most commands will have a -h or --help option.

Basic wildcard/regex stuff, like how to use ls to display only files that end in .py, or how to cp, mv, or rm or how to grep/find files where you remember part of the name or contents, but not all of them. If you don't have time for this during the week, but will be teaching regexes as part of the regular CS course, you can revisit the topic on the commandline too.

You can teach them how to make aliases (and use an aliases file to have them permanently available) to customize their experience and make life a little easier. (If/when you teach them how to access commandline arguments they can also write mini scripts and just save them in their aliases file.) Make them write aliases for stuff like displaying the contents of a directory sorted by the most recently changed file, or give points for the coolest or most creative aliases they come up with themselves. You can also teach them how to edit their .xsession files (or whatever you're using) to launch specific commands and customize how their sessions startup.

df and du are basic and useful.

You might want to be careful about the legality of this, but teaching them how to use something like youtube-dl effectively might be a motivating activity... (on preview, yup)

One last suggestion: set them up with good .bashrc and .inputrc files, so that things like tab completion work nicely, the commandline prompt is informative, ls has useful colors, etc. And make sure 'rm' is aliased to 'rm -i', and teach them to beware rm *.
posted by trig at 11:10 AM on November 20, 2020 [3 favorites]


I like the idea of acquainting students with the command line but I have concerns about the limited amount of time to teach the subject and to prep material, especially if you yourself are not overly familiar with the command line. An intro that doesn't hit right may do more to cement the idea of "the command line is bad / hard" than to intrigue them.

If I suddenly needed to teach some HS folks CLI 101, without the benefit of a boatload of Raspberry Pi's, is to demonstrate things they would be interested in doing. So the example of youtube-dl is good, though that might be iffy from a legal standpoint.

You could also show how you can "batch" things at the CLI that they might want to do, like converting documents or images?

My experience with high school students that aren't directly interested in computers for their own sake is that they're going to be highly disinterested in anything they don't perceive as relevant.
posted by jzb at 11:11 AM on November 20, 2020 [2 favorites]


Tab completion is magical (and exists on Windows too!)

I use batch/shell scripting to automate processes all the time, but I'm not sure how to explain the value of this before you know that a whole universe of command-line utilities exist. Imagemagick and FFmpeg can do a lot, though unless you have something easily batched, GUI tools they already know will be easier, so that runs the risk of backfiring.
posted by Alterscape at 11:13 AM on November 20, 2020 [1 favorite]


Also: this might depend on your network setup but the 'write' command and variants thereof. Sending messages and getting them from other people is just really fun, and the novelty of doing it through the terminal might be a little magical for some of them.
posted by trig at 11:17 AM on November 20, 2020


Oh, and kill/pkill and killall: powerful and satisfying.
posted by trig at 11:18 AM on November 20, 2020


The command line sells itself when you show someone cool things you can do with it. So if you can put together a demo of what you personally can accomplish with it, that will set off a light bulb for some students.

As far as examples go, I think that informational queries are a great place to start. The /usr/share/dict/words example above is great.

Another one that comes up for me all the time is answering questions about a codebase: how many classes have a field named "peanut"? Where can I find out how to use ActivityCompat correctly?
posted by billjings at 11:29 AM on November 20, 2020


All the kids know what TikTok is, and what memes are. Do you know ffmpeg and imagemagik well enough to make a pipeline for converting their videos & pictures into Internet-ready posts?

(Warning: you may need to supply videos/pictures of yourself or the principal to use as raw materials.)
posted by wenestvedt at 12:27 PM on November 20, 2020 [3 favorites]


I don't think you're teaching the command line in this amount of time, you're piquing interest so 20% of them go look into it more.

All the kids know what TikTok is, and what memes are. Do you know ffmpeg and imagemagik well enough to make a pipeline for converting their videos & pictures into Internet-ready posts?

This is a great idea. You can also chain together youtube-dl and these tools to take a youtube video, turn it into a gif, and add meme text.
posted by supercres at 12:45 PM on November 20, 2020 [4 favorites]


At the risk of sounding like "Up the Man" (but I grew up in the 1960s) I'd suggest (?) that Windows is lame and Mac is a walled garden and Linux is where you can do what you want to do. There's nothing wrong with using Windows or Mac, but there's something wrong with ONLY being able to use Windows or Mac. And Mac and Windows both now support *nix Terminal mode.

So ffmpeg will let you edit, transcode, crop, convert to animated gifs video in all sorts of ways.

Rsync will let you backup machines, and smb will let you bring together your networked machines and cross-backup or share files.

And when you get into Virtual Machines it's a lot earier to bring up a *nix VM than the alternatives. And ssh lets you talk to "headless" servers which you might run into in college. And DevOps is a hot area for hiring.

I went heavily into "salesman" mode so I'm not even sure all of that is technically perfect, but that's what I would try (appealing to the maverick/freedom loving side of their personalities). FWIW.
posted by forthright at 1:03 PM on November 20, 2020 [1 favorite]


If this will involve them using a text editor in the terminal, dear gods don't make them use vi or emacs or any other primordial-UNIX-editor-evolved-into-a-Swiss-Army-knife. I personally prefer GNU Moe. You press F1 and you get a help page! You press escape and you're back to editing! What a concept!

Unfortunately and incongruously, par for the GNU course, instead of being provided as a package manager package you have to download, un-lzip (sigh) and build via the usual
./configure
make
make install
Possibly with some false starts and having to install libraries from your package manager before re-trying.

It helps the process if you talk to yourself in a Comic Book Guy voice while doing this.
posted by XMLicious at 1:18 PM on November 20, 2020 [1 favorite]


I don't have a specific suggestion, but I have a general one. I think that the single thing that is most effective in conveying the usefulness of the commandline when you have a very short time window is showing how it makes intractable problems tractable. This heavily overlaps with programming in general, but using the commandline is programming; any distinction between them is completely arbitrary.

If you need to process one file in a repetitive and predictable way, it's probably faster (assuming that you aren't already familiar with the commandline) just to do it by hand than to try to figure out how to automate it. If you have ten files, maybe the automation is worth it, but it can feel kind of borderline -- you could still do it by hand if you wanted to, although it would take a few hours and be very boring and error-prone. But what if you had a hundred files? A thousand files? Ten thousand? A hundred thousand? At some point the task would take such an absurdly long time to do by hand that it's effectively impossible to do. But if you know how to automate it, it's trivial, no matter how many files there are. (I'm oversimplifying this by assuming that these are relatively small files and processing them doesn't take long; if they're big files there are additional complications, but the automation is no less useful.)

Not knowing how to use the commandline for automation artificially restricts what things you can do with your computer -- an extremely powerful device which a lot of people use to only a fraction of its full potential. Being able to use even a few simple commandline tools to start with opens up a whole new world of possibilities. I think that a good analogy is learning how to drive. It's a game changer, even if you have no intention of being a professional truck or racing car driver, and even when you're just starting out and not very good at it yet.

The trick is to tailor the demonstration to something that will be compelling to the students. While an example drawn from actual work that they have done before would be viscerally effective, they may not do the kind of data wrangling in their schoolwork where this would come up. Second-best may be something that they haven't experienced personally but is intrinsically interesting and can be tied to some kind of cool concrete outcome. Maybe a real-life example of processing scientific data? Maybe an explanation of radio interferometry? Maybe the use of protein simulations in drug design?

I know that this is all very vague, but maybe it would help to find a big-picture example and work backwards to show how to join up commands into a pipeline that will do a bunch of cool stuff automatically that a human couldn't possibly hope to do by hand.

A more practical and specific suggestion: file management. I haven't used a graphical file manager in about 20 years -- my first window manager was Blackbox, which didn't come with one, and after learning how to navigate the filesystem and manipulate files on the commandline I've never gone back. The new(ish) perl-based rename command may be a good example to demo. Someone mentioned youtube-dl, which is also pretty great.

But I don't understand how kids work, so this may all be a lot of wishful thinking.
posted by confluency at 3:30 PM on November 20, 2020 [3 favorites]


It may not be something that you can readily demonstrate, but you can talk about how most systems are built out of scripts that run commands, and that in the data center, there is no one sitting at the console of all those servers clicking on GUI's. The command line is the manual interface to most of the computing world.

It is easy to dismiss as arcane and luddite, but anyone who has ever had to configure a bunch of systems will tend to discover that scripting is where it is at, and the command line and commands available there form the basis for this.

In the Windows world, this tends to be PowerShell. In the UNIX world, we're blessed with any number of shells, and the UNIX system itself is traditionally based around the concept of /etc/rc, the script that controls the composition of a running UNIX system.

It is worth pointing out that running "GUI" stuff is often just a proxy to running UNIX commands underneath the covers.
posted by jgreco at 5:41 PM on November 20, 2020


I spent hours of fun using the talk command to chat with friends in the computer labs. Seeing them type each character, typos and all, seemed magical.

Logging in to another workstation and playing audio files from that computer's speakers made for lots of fun too. I think I used play from the sox package.

Using perl to do an in-place search and replace among thousands of files can be a powerful example of making tedious tasks trivial.

You've picked a challenging task, but one I applaud. The more people who appreciate and can benefit from the power of the command line, the better.
posted by jaden at 5:46 PM on November 20, 2020


I'd probably start with teaching them how to create cool console prompts and go from there.
posted by rmmcclay at 6:37 PM on November 20, 2020 [1 favorite]


Yeah, I've tried to teach highschoolers and other undermotivated folks of roughly the same age "Intro to CS" courses about a decade ago on the east coast.

There are a few ways to introduce the material.

One way: "look how cool and relatable"

Another way: "Do you like money and stability? Who likes shopping? If the economy keeps going the way it does (meaningful look at the landmass to the east, based on the location in your profile), you're going to get an advantage in getting a good steady job if you remember the things I teach you today."

Ruthlessly capitalistic, or maybe realistic. I don't know if the parents will run you out of town if you say that.

Then you try to accomplish a bunch of tasks (maybe ones you have taught earlier in the curriculum via the GUI) on a laptop where the trackpad is broken and you can't find your USB mouse.

Or if you want to straddle the worlds, you could use /usr/dict/words to brute force some word puzzle you come up with.
posted by batter_my_heart at 11:04 PM on November 20, 2020 [1 favorite]


Why not find out what devices they use on a regular basis and select the CLI from the most common?

Besides that, I recall a text with the name 'Stupid BASH Tricks' or some such that may help.
posted by IronLizard at 11:15 PM on November 20, 2020


Yeah, I'm not sure the shell is *fun* until you have a key few dozen utilities you can fluently pipe together.

But shell scripts are programming for everybody. Why is Command A better than GUI Click A? Well, it's not! What's better is that after you did Command A, Command B, Command C, you can stuff those into a text file and run the whole thing in one go.

And then it gets real: you can take something the script is using and make it a parameter. Then you can write another script that applies the first repeatedly. Possibly this is unnaturally attractive to me since I'm a programmer.

To make this work you need to find something your audience wants to do, for which I'd suggest picking something you the instructor want to do, since you can sell it.
posted by away for regrooving at 12:39 AM on November 21, 2020 [2 favorites]


I don't use bash, so I may be the wrong person to answer this, but you might be able to use the strategy of telling them that using bash will make you feel like a 1337 h4xxor because you can use it to do stuff that the GUI does not have a button for. Maybe the idea of having more power over the OS will seem appealing to them?
You might try showing a compilation of hackers in movies and TV series, using the CLI. That might help get the idea across.
posted by Too-Ticky at 2:06 AM on November 21, 2020


I remember sitting in the computer room in college (mid 90s) using the talk command (though I thought it was tell, but that looks like it's wrong). There was a lot of laughing going on. Thing is, I didn't know that was a CLI.

Fast forward 20ish years, I got interested in Linux. My friend was my mentor and tutor. At some point, I needed to convert stuff I ripped with iTunes into mp3 files so I could play them or a program that could play the files I had. He sent me CLI instructions to install (or maybe the source to compile it) a program to play the files. I freaked the fuck out. I was terrified I was going to screw up my whole computer. Needless to say, I didn't. I wish I could remember the name of that little program. Eventually I decided to try (and failed) to write a script that would ask me what I was interested in listening to and play me a randomly generated play list.

I have a Raspberry Pi that I use when I need to be at a desk and concentrating. I didn't even figure out how to do updates via GUI. I went right to the CLI.

Anyhow, I guess I'm saying is maybe share a story like that or one that made the CLI make sense to you. Then dive into bash. supercres said what I'm trying to say more succinctly. Stress that while you can screw things up, it's pretty hard to do. I'm sure there are going to be kids who will be afraid of that.
posted by kathrynm at 11:44 AM on November 21, 2020


I love a lot of these suggestions! Rogue and rogue-alikes will let them understand the command line isn't just for work and it can even make you FEEL.

There's a great revival of old-school command line stuff at https://tilde.club/. It's about the root and bone of the internet: what came first and what lies underneath and the minimum of what we really need to form a community. A tilde server could be a great group activity: home pages, chat server, basic HTML, fun!
posted by Mo Nickels at 12:41 PM on November 21, 2020 [1 favorite]


There's a book called The Linux Command Line that could give you some good ideas. There's a quote in the introduction (unattributed) that I think sums it up well and might be a helpful way to distill for your students what you're hoping they get out of this lesson:
Graphical user interfaces make easy tasks easy, while command line interfaces make difficult tasks possible.
With that in mind, I think the find command would make a great example that allows a lot of progressive enhancement. Say you want to find a file but you don't remember what directory you put it in. How do you find it? If you have partial information, you can often translate that into options to find. File type, last-modified time, maybe a word in the filename, etc.

Doing batch updates is also a nice example. For example, say you want to make thumbnails of all the pictures in a directory. You could open each one in Photoshop (well, GIMP if you're on linux anyway) and go through the menus, etc. But what if you have 1000 pictures? Write a little shell script with Imagemagick and you're good.
posted by number9dream at 4:14 PM on November 21, 2020 [1 favorite]


I haven't had time to play it to see how much it teaches, but bashcrawl is "a Bash-based dungeon crawl you play by learning and using Bash commands". Screenshot.

I wonder if you could use your 2.5 days to briefly introduce the point of the commandline and do a demo of some basic useful/magic things you can do with it; tell them "but it's also fun!" and spend the rest of the time letting them do fun things with it; and then spend the occasional half-days or whatever throughout the year having them learn/practice specific things, so that by the end of the year they both feel comfortable-to-enthusiastic about the commandline and have some basic skills in it.
posted by trig at 3:25 AM on November 22, 2020


Response by poster: I'm immensely grateful for all the input. I'll share the results. I think a chewy challenge makes for better computer science learning (at least for some students) than emphasizing how easy and non-threatening things are. So maybe we will learn pipes!
posted by argybarg at 1:28 PM on November 22, 2020 [1 favorite]


OMG, rmmcclay, how the hell did I not think of console prompts and ASCII art and ANSI control codes and Debian packages like figlet and toilet and linuxlogo? I mean fiddling with console prompt appearance is bread and butter, it transcends UNIX itself—it was the first thing I learned sitting at the feet of sifu, working in VAX/VMS.

100%, start with this stuff. Not only are the aesthetic and personal-style aspects appealing beyond the technical realm, if someone gets hooked trying to figure out how to do specific things (ROFLcopter, anyone?), or do them more easily, it's a gateway drug to all the little unix text utilities and consequently piping, and maybe a little light scripting. And then the world.
posted by XMLicious at 2:11 PM on November 22, 2020


Response by poster: Okay, so I did wind up teaching pipes and redirects, because "echo 'hello world'" is a damp squib, but "echo 'hello world' > hello.txt" has a little magic to it.

We used Webminal, which gives a free server with a home directory for everyone who creates an account. No WAN access, so no curl and no apt-get; also no executables, so no shell scripting.

Still, by pasting I was able to create some long documents in a common folder and teach piping them, roughly cat | grep > file (and yes, I know you can grep a file directly, but the piping was the point). I made a 500-entry list they had to grep with their names to find a population number, which they used to grep a list of 1000 largest cities — this gave them their "assignment" city. Then they practiced making directories and subdirectories by country, state, city, along with a text file in the city directory — and we were done.

I also gave them the outline how, using shell scripts, you could take this text file with the 1000 largest cities and, in no time, create a directory structure of USA > states > cities with a date-stamped text file in each city — something that would take a very, very long time on a GUI. The thesis of my class is that computer science is about transforming information, and that's a perfect example.

In the end, I agree with supercres that I'm aiming at the 20% who might be intrigued and start tinkering with the terminal on their own time someday.

Thanks again for all the thoughtful responses; they really helped.
posted by argybarg at 12:18 PM on November 25, 2020 [6 favorites]


« Older Old fashioned distribution list in Outlook   |   Vegan pecan pie recipes, please Newer »
This thread is closed to new comments.