Learn Bash with a dungeon crawl

Linux is fun

tech unix hack cyberpunk

Learning is hard work, and nobody likes work. That means no matter how easy it is to learn Bash, the language of the Linux terminal, it still might feel like work to you.

Unless, of course, you learn through gaming.

You wouldn't think there would be many games out there to teach you how to use a Bash terminal, and you'd be right. Serious PC gamers know that the Fallout series features terminal-based computers in the vaults, which helps normalize the idea of interfacing with a computer through text, but in spite of featuring applications more or less like Alpine or Emacs, playing Fallout doesn't teach you commands or applications you can use in real life. The Fallout series was never ported to Linux directly (although it is playable through Steam's open source Proton. The modern entries into the Wasteland series that served as predecessors to Fallout, however, do target Linux, so if you want to experience in-game terminals, you can play Wasteland 2 and Wasteland 3 on your Linux gaming PC. The Shadowrun series also targets Linux, and it features a lot of terminal-based interactions, although it's admittedly often overshadowed by blazing hot sim sequences. 

While those games take a fun approach to computer terminals, and they run on open source systems, none are open source themselves. There are, however, at least two games that take a serious, and seriously fun, approach to teaching people how to interact with systems through text commands. And best of all, they're open source.

Bashcrawl

You may have heard of Colossal Cave Adventure, an old text-based, interactive game in the style of "choose your own adventure" books. Early computerists played these obsessively at the DOS or ProDOS command line, struggling to find the right combination of valid syntax and zany fantasy logic (as interpreted by a sardonic hacker) to beat the game. Imagine how productive such a struggle could be if the challenge, aside from exploring a virtual medieval dungeon, was to recall valid Bash commands. That's the pitch for Bashcrawl, a Bash-based dungeon crawl you play by learning and using Bash commands.

In Bashcrawl, a "dungeon" is created in the form of directories and files on your computer. You explore the dungeon by using the cd command to change directory into each room of the dungeon. As you proceed through directories, you examine files with ls -F, read files with cat, set variables to collect treasure, and run scripts to fight monsters. Everything you do in the game is a valid Bash command that you can use later in real life, and playing the game provides Bash practice because the "game" is made out of actual directories and files on your computer.

$ cd entrance/
$ ls
cellar  scroll
$ cat scroll 

It is pitch black in these catacombs.
You have a magical spell that lists all items in a room.

To see in the dark, type:     ls
To move around, type:         cd <directory>

Try looking around this room.
Then move into one of the next rooms.

EXAMPLE:

$ ls 
$ cd cellar

Remember to cast ``ls`` when you get into the next room!
$

Install Bashcrawl

Before you can play Bashcrawl, you must have Bash or Zsh on your system. Linux, BSD, and MacOS ship with Bash included. Windows users can download and install Cygwin or WSL or try Linux.

To install Bashcrawl, navigate to GitLab in Firefox or your web browser of choice. On the right side of the page, click the Download icon (to the right of the Find file button). In the Download pop-up menu, click the Zip button to download the latest version of the game.

Once it's downloaded, unzip the archive.

Alternatively, if you want to start working in the terminal right away, you can use Git:

$ git clone https://gitlab.com/slackermedia/bashcrawl.git bashcrawl

Getting started

As with almost any new software package you download, the first thing you must do is read the README file. You can do this by double-clicking on the README.md file in the bashcrawl directory. On a Mac, your computer may not know what application to use to open the file; you can use any text editor or LibreOffice. README.md tells you exactly how to start playing the game, including how to get to the game in your terminal and the first command you must issue to start the game. If you fail to read the README file, the game wins by default (although it can't tell you that because you won't have played it).

Bashcrawl isn't meant to be overly clever or advanced. On the contrary, it's as simple as it possibly can be in the interest of being transparent to new users. Ideally, a new Bash user can learn some of the basics of Bash from the game, and then stumble upon the mechanics of the game, including the simple scripts that make it run, and learn still more Bash. Additionally, new Bash users can design their own dungeon by following the examples of Bashcrawl's existing content, and there's no better way to learn to code than to make a game.

Solarized GNU by Linux Pictures under the idgaf license.

Previous Post Next Post