Intro

GNU/Linux gaming has come a long way over the past decade. We are lucky to live in an age where there are a number of native linux games including AAA titles to choose from on the platform. Steam has also vastly increased the number of games available on Linux. Despite the vast availability of GUI based games, sometimes it can be more relaxing and entertaining to play terminal based ones. This is not so surprising considering the fact that most Linux users spend a lot of time on the command line and feel at home there. Luckily, there are a number of great terminal based games available on the platform as well.

In this tutorial you will learn:

  • about popular terminal based games available on GNU/Linux
  • how to install various terminal based games on various distributions
Best Terminal Games on Linux
Best Terminal Games on Linux

Software requirements and conventions used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Distribution-independent, but installation on Debian/Ubuntu, Arch, and RHEL are explicitly covered where possible
Software bsdgames, bsd-games, adventure, hangman, snake, rogue, emacs, tetris, doctor, dunnet, ninvaders, nethack, pacman4console, fortune
Other Root privileges will be required to install games with your package manager
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

BSD Games

BSD Games is a Linux port of classic text based games that were/are distributed with BSD systems. The BSD-games package may include up to 40 different executable games. Which ones are included vary slightly based on the distribution.

Installing BSD Games

On Debian and Debian based systems such as Ubuntu, use apt.

# apt install bsdgames

On Red Hat Enterprise Linux and Red Hat based systems the bsdgames package does not appear to be available in the official repositories or in the Extra Packages for Enterprise Linux (EPEL) Repository. This is the case for all sections of this article where a Red Hat based installation method is not provided. If you know of a good way to get these packages on Red Hat systems, please comment below.

On Arch based systems, use pacman.

# pacman -S bsd-games

Here are a few highlights of games included with BSD-games

Adventure

Adventure, also known as Colossal Cave Adventure, is invoked by typing the adventure command into the terminal. It was originally developed in the 1970’s. In this game you control an adventurer’s actions by issuing commands as he seeks out the rumored treasure within the colossal cave.

Adventure gameplay
Adventure gameplay

Hangman

Many of us may remember playing hangman on the blackboard in school during our youth. This is simply a digital text based version of the same game. It is invoked by typing hangman at the terminal.

Hangman gameplay
Hangman gameplay

Snake

The object of this game is to collect as much money as possible without getting eaten by the snake. The game ends either when you exit by moving onto the # character or when you are eaten by the snake. It is invoked by typing the snake command at the terminal.

Snake gameplay
Snake gameplay

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


Rogue

This game, originally created in the 1980’s, started the genre of “roguelike” games. You control a player represented by the @ character, as you crawl through a dungeon collecting treasure and fighting foes. The maps are procedurally generated, which ensures a unique play through each time. The main objective is to obtain the Amulet of Yendor which is located in the dungeon’s lowest level. Although this game is also one of the classic BSD games, it is typically not included in the bsdgames package due to a licensing difference and it must be installed separately.

Installing Rouge

On Debian and Debian based systems such as Ubuntu, use apt.

# apt install bsdgames-nonfree

On Arch based systems, use pacman.

# pacman -S rogue
Rogue gameplay
Rogue gameplay

Emacs Games

The venerable emacs text editor comes bundled with some games that you can readily launch from within it. Notable ones include tetris, doctor and dunnet.

Installing Emacs

On Debian/Ubuntu based distros:

# apt install emacs

On Red Hat based distros:

# yum install emacs

On Arch based distros:

# pacman -S emacs


Tetris

This is the classic tetris game that we all know and love. Tetris is launched by typing emacs -nw at the terminal and then entering M-x tetris into emacs. This is done by holding the Meta key (typically alt by default) and x then typing tetris and pressing enter. The -nw flag ensures that you are getting the terminal version of emacs rather than the GUI.

Tetris gameplay
Tetris gameplay

Doctor

This game lets you talk to a Rogerian psychotherapist who will help you with your problems. It is based on ELIZA, the AI program created at MIT in the 1960s. Doctor is launched by typing emacs -nw at the terminal and then entering M-x doctor into emacs. This is done by holding the Meta key (typically alt by default) and x then typing doctor and pressing enter.

Doctor gameplay
Doctor gameplay

Dunnet

This is another text adventure game where you play by typing commands and the objective is to collect treasure. This may sound a lot like the Adventure game mentioned at the beginning of the article, but this game has a twist. What is that twist you ask? I’m not going to ruin it for you. You need to play it to find out. Dunnet is launched by typing emacs -nw at the terminal and then entering M-x dunnet into emacs. This is done by holding the Meta key (typically alt by default) and x then typing dunnet and pressing enter.

Dunnet gameplay
Dunnet gameplay

nInvaders

This is an ncurses based clone of the famous 1978 Space Invaders arcade game. You get to control your laser cannon with the arrow keys and you shoot using the space bar. The gameplay experience is pretty true to the original.

Installing nInvaders

On Debian and Debian based systems such as Ubuntu, use apt.

# apt install ninvaders

For Arch based systems nInvaders is available to install from the AUR. We previously covered how to install a package from AUR on Manjaro Linux and how to install a package from AUR on Arch Linux.

nInvaders gameplay
nInvaders gameplay

Nethack

No, this game is not a network hacking simulator. It’s a roguelike game and as such the gameplay is a lot like Rogue. However, Nethack expands greatly on the genre by introducing multiple class options along with a wider array of game mechanics and objects.

Installing Nethack

On Debian and Debian based systems such as Ubuntu, use apt.

# apt install nethack-console

On Arch based systems, use pacman.

# pacman -S nethack

In RHEL based distros it can be installed with the following command after enabling the Extra Packages for Enterprise Linux (EPEL) Repository

# yum install nethack
Nethack gameplay
Nethack gameplay

Pacman4console

No list of games would be complete without the arcade classic Pacman. This is a console version of Pacman and it’s gameplay is pretty intuitive to anyone who has ever played the original. Pacman is represented by a C, ghosts are represented by &, pellets by . and power pellets by *. The objective is simple; eat the pellets, avoid the ghosts and eat the power pellets to become invincible for a short period of time.

Installing Pacman4console

On Debian and Debian based systems such as Ubuntu, use apt.

# apt install pacman4console


For Arch based systems pacman4console is available to install from the AUR. We previously covered how to install a package from AUR on Manjaro Linux and how to install a package from AUR on Arch Linux.

pacman4console gameplay
pacman4console gameplay

Fortune

Have you ever wanted to unwrap a terminal command like a fortune cookie and reveal profound truths about life? Now you can with the fortune command. It does exactly what you would expect. Technically this is another BSD game, but it stands apart and is distributed independently.

Installing Pacman4console

On Debian and Debian based systems such as Ubuntu, use apt.

# apt install fortune-mod

On Arch based systems, use pacman.

# pacman -S fortune-mod
fortune output
fortune output

Conclusion

In this article we discussed various terminal based games and how to install them on GNU/Linux. Hopefully, you had the chance to try some of them out and you see how they can be a welcome diversion from the sensory overload of modern mass media. When deciding which distribution is best for playing terminal based games it seems hard to ignore the greater availability of them in the official Debian and Ubuntu repositories.

When it comes to console based games, this article just scratches the tip of the iceberg. In fact, Debian maintains a list of console based games available through their official repos. If this article has sparked an interest then I recommend checking there to get ideas for your next game to play. Also, we would love to hear about your favorite terminal based games in the comments below!

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions