Just because you prefer working in a text-mode interface doesn't mean you're not entitled to a little fun here and there.
Last December, I took some time out before the holidays to explore some of my favorite command-line diversions into a series for Opensource.com. It ended up being a bit of an advent calendar for terminal toys, and I got some great suggestions from readers.
Now summer has arrived, at least for us in the northern hemisphere, and for many of this means a time of summer breaks, vacations, and generally trying to fit in a little relaxation between committing code and closing tickets. So to that end, I thought I'd revisit five of my favorite command-line games from that series, and share them here with you on Enable Sysadmin.
All of these games were tested in Fedora, most from the default repositories, but you can likely find them for other distributions as well. Or, grab the source code to compile them yourself.
2048
We'll start with one of my all-time favorite casual games, 2048 (which itself is a clone of another clone).
To play, you just slide blocks up, down, left, and right to combine matching pairs and increment numbers, until you've made a block that is 2048 in size. The catch (and the challenge), is that you can't just move one block; instead, you move every block on the screen, provided it has space to slide.
It's simple, fun, and easy to get lost in it for hours. This 2048 clone, 2048-cli, is by Marc Tiehuis and written in C, and made available as open source under an MIT license. You can find the source code on GitHub, where you can also get installation instructions for your platform. Since it was packaged for Fedora, for me, installing it was as simple as:
$ sudo dnf install 2048-cli
MyMan
MyMan is a fun clone of the classic arcade game Pac-Man. (You didn't think this was going to be about the similarly-named Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance.
MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's another one that looks like it may be promising, but I haven't tried it.
Since MyMan was packaged for Fedora, installation was as simple as:
$ dnf install myman
MyMan is made available under an MIT license and you can check out the source code on SourceForge.
Nudoku
Nudoku is a simple sudoku game that, once installed, can be invoked by name (nudoku) to launch, and should be fairly self-explanatory from there. If you've never played Sudoku before, it's fairly simple: You need to make sure that each row, each column, and each of the nine 3x3 squares that make up the large square each have one of every digit, 1-9.
You can find nudoku's c source code on GitHub under a GPLv3 license.
Snake
Snake is an oldie but goodie; versions of it have been around seemingly forever. The first version I remember playing was one called Nibbles that came packaged with QBasic in the 1990s, and was probably pretty important to my understanding of what a programming language even was. Here I had the source code to a game that I could modify and just see what happens, and maybe learn something about what all of those funny little words that made up a programming language were all about.
This version of Snake is written in Go, and while it's simple, it's just as much fun as the original. Like most simple old games, there are a ton of versions to choose from. In Snake's case, there's even a version in the classic bsdgames package that's almost certainly packaged for your distribution.
But what I like about this version of Snake is that it's packaged in a container so I can easily run it in one line from my terminal without worrying about anything disto-specific. That, and it makes use of 15 randomized food emojis for the snake to eat. I'm a sucker for food emojis. Anyway, give it a try using:
$ docker run -ti dyego/snake-game
This Snake is licensed as open source under an MIT license, and you can check out the source code on GitHub.
Tetris
After taking the world by storm in the 1980s., Tetris was cloned many, many times. I would suspect you could find a Tetris clone for just about any operating system in any language you looked for. Seriously, go look. There are some fun ones out there.
The version I'm bringing you for today's command-line toy is written in Haskell, and it's one of the better-done versions I've seen, with on-screen preview, score, help, and a clean look.
If you're willing to run a compiled binary from an untrusted source (I wouldn't recommend it), you can grab that directly, but for a safer approach, it's also easy to use a containerized version with dex, or to install from source with stack.
This particular Tetris clone is by Sam Tay and available under a BSD license. Check it out!
About the author
Red Hat Certified Engineer. Linux desktop enthusiast. Map/geospatial nerd. Raspberry Pi tinkerer. Data analysis and visualization geek. Occasional Pythonista.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit