Snake your way across your Linux terminal

Python isn't the only snake you'll find at the Linux command line with this classic 1970s game remake.
196 readers like this.
Linux toy: snake

Jason Baker

Welcome back to the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. It's hard to say exactly, but my definition is anything that helps you have fun at the terminal.

We've been on a roll with games over the weekend, and it was fun, so let's look at one more game today, 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.

Today's 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 for Docker 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.

Animated snake game

Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.

Check out yesterday's toy, Powers of two, powers of Linux: 2048 at the command line, and check back tomorrow for another!

What to read next
User profile image.
Jason was an Opensource.com staff member and Red Hatter from 2013 to 2022. This profile contains his work-related articles from that time. Other contributions can be found on his personal account.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.