How to Play Rubik’s Cube in Linux Terminal with nrubik

Rubik's Cube

Through the past decade, inventive games such as Portal and The Room have pushed the boundaries of what’s possible for puzzles in PC, console, and mobile. Even with those and other excellent developments, however, a glaring chasm has remained: There were no n-curses-based Rubik’s Cube for the Unix console.

Github developer calebabutler has filled that gap. Their nrubik project has given the world an option for its need of digital, colorized 3x3x3 puzzles.

In this article we will briefly discuss the installation and gameplay mechanics of this rethink of the classic cubed mindbender.


The first step in installation is to grab the source code from calebabutler’s git repository:

git clone

From the directory in which you run this command, git will build an “nrubik” folder with the necessary source code.

Move into that directory:

cd nrubik

and make the nrubik binary an executable file with

chmod +x nrubik

You can now either run the program from that folder – ./nrubik – or install the package to your system. You will need a curses-supported Python2 or Python3 interpreter on your system to run the code.

Install globally with

sudo cp nrubik /usr/bin

or locally with

cp nrubik $HOME/.local/bin


When you first start nrubik, your terminal will show a randomized layout of a new digital Rubik’s Cube.

nrubiks starting screen

You can see the available controls on the left side of the screen. The cube itself sits on the right.

Use the keys w, x, a, d, s, and e to move the cube clockwise along its axes.

The faces of the cube shown on your screen are displayed in a logical order.

Moving from the top down, you see the “back” face just above the “top” face. The row of three blocks shows, from left to right, the “left,” “right,” and “front” faces. The “bottom” face sits at the bottom of the collection.

If you finish a puzzle or just want to try a new cube, hit m to scramble the cube.

You can always turn the command list on and off with the h key.


The colors of the cube itself may also provide a challenge. In order to accommodate eight-color terminals, nrubik replaces the original orange color with magenta. Still, the program lists it as “Orange” and represents the cube face with an “O.”

You may also see some differences when it comes to the type of terminal colors you use. I prefer the Solarized scheme, so his default terminal displays nrubik like the following image:

nrubiks start screen Solarized

Those colors differ even further with respect to “White” being shown as close to black in the terminal. Your experience may also change slightly, but the alphabetical representations – “W,” “Y,” “O,” “R,” “G,” and “B” – will not change from user to user.


Solving the digital nrubik cube is possible, even if I have no chance for such a victory. Take a peek at calebabutler’s screenshot of their win.

nrubik solved


If you’re looking for a new in-terminal puzzle challenge, nrubik could offer a nice fix. Try not to judge the interface too harshly before giving it a few minutes of your time.

With only ten minutes of practice, movement in the ncurses interface will become much easier, allowing you to focus on solving the cube. Good luck.

Casey Houser

I have worked as a professional writer since 2011. I like to compose my articles in Vim, which I also use for hobbyist C and Ruby projects. When I'm not in front of a text editor, I run, bike, and play tennis until I'm too tired to move.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox