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
2048

 

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.

MyMan

 

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.

Nudoku

 

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.

Snake

 

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!

Tetris

 


关于作者

Red Hat Certified Engineer. Linux desktop enthusiast. Map/geospatial nerd. Raspberry Pi tinkerer. Data analysis and visualization geek. Occasional Pythonista.

UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来