How to Play Games from the Linux Terminal

Spread the love

Today’s gaming experience is quite different to that of the 1970s and 1980s! The current generation of PCs, consoles and mobile devices can handle sophisticated 3D games with shaders, anti-aliasing and more. But there was a time when the only games that could be played were text-based. If you are up for a bit of nostalgia, then some of the these games are still available to be played today.

The most venerable set of text-based games is from the BSD games collection. These games were written several decades ago and became part of the BSD Unix distribution. Today you can enjoy them on Linux.

Note: Most, if not all, of these games can be installed in any Linux distro. In this tutorial, we will just focus on the installation on Ubuntu. If you are not using Ubuntu, you can install the games from your package manager.

To install the BSD games collection on Ubuntu, use:

sudo apt-get install bsdgames

There are a total of forty-three games in the collection! Here is the list: random, gomoku, caesar, countmail, rot13, bcd, atc, number, boggle, quiz, morse, teachgammon, snake, snscore, pig, wargames, tetris-bsd, adventure, arithmetic, worms, hunt, canfield, battlestar, rain, robots, cribbage, dab, sail, wump, trek, phantasia, wtf, go-fish, monop, backgammon, worm, hack, ppt, primes, hangman, pom, cfscores, and mille.

The classics among this list of classics are: adventure, one of the original text-based adventure games and from where the genre gets its name; worm, the original version of the “Snake” game that was so popular on Nokia feature phones; tetris-bsd, a terminal version of the classic game Tetris; and trek, a game for Star Trek fans where you get to kill Klingons (of course, the game was written before we knew about the Khitomer Accord).

If you like the idea of Tetris running in a terminal, then Bastest is a better version than the one found in the BSD games collection. To install it on Ubuntu, type:

sudo apt-get install bastet

To run it type:

bastet

But text gaming doesn’t stop with the BSD games collection or Tetris. There are plenty of others to explore. What about a clone of the classic arcade games Space Invaders? Called “ninvaders”, you can install it on Ubuntu using:

sudo apt-get install ninvaders

The “n” in the name comes from the fact that the game was written using the ncurses library. ncurses provides an API for programmers to write text-based user interfaces in a terminal-independent manner. Once installed, type “ninvaders” to start the game.

If you thought that the smartphone perpetually running games like Temple Run and Subway Surfer were a new genre, then think again! What about Moon-buggy? You drive a car across the moon’s surface while trying to avoid the dangerous craters by jumping over them. Moon Buggy can be installed on Ubuntu using:

sudo apt-get install moon-buggy

The game can be started using the command “moonbuggy“.

Another craze which swept the casual gaming world was 2048. Available on the web and for smartphones, the game is easy to learn but deceptively hard to master. The idea is to slide numbered tiles around a 4 x 4 grid. When the numbers touch they merge. You need to keep merging tiles until you get a tile with the value of 2048. There is also a text version.

The game needs to be built from its source code, but it isn’t difficult. Here are the commands:

wget https://raw.githubusercontent.com/mevdschee/2048.c/master/2048.c
gcc -o 2048 2048.c

This will download the source and build it in your current working directory. Then to run it, type:

./2048

If you have any other favorite text-based games, please share them in the comment section below.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Gary Sims

Gary has been a technical writer, author and blogger since 2003. He is an expert in open source systems (including Linux), system administration, system security and networking protocols. He also knows several programming languages, as he was previously a software engineer for 10 years. He has a Bachelor of Science in business information systems from a UK University.

Comments (5)