When it comes to Linux, the terminal might be one of the most used tools of the operating system. From simple tasks like copying files to running network forensics, there's a command-line tool for almost everything.
But what may come as a surprise is that you can even play simple games like Tetris on the Linux terminal. Yes, games aren't just restricted to the graphical user interface. Curious to find out how? Let's get started.
Tetris on the Command Line
Through an ASCII rendition of the traditional Tetris game and a bit of programming, it is now possible to play this retro game on a terminal. To start, you'll need to have Git installed on your Linux system to clone the repository.
Open up the terminal and run the following commands one by one to clone the remote repository to your computer:
git clone 'https://github.com/k-vernooy/tetris' && cd tetris
make
sudo make install
Output:
Once the installation process finishes, you can start a new game of Tetris by running the following command:
tetris
Output:
Refer to the table given below to understand the controls:
Key |
Operation |
---|---|
e |
Enable or disable ghost block |
Ctrl + C |
Quit game |
↑ |
Rotate the falling block |
↓ |
Soft drop |
← |
Move left |
→ |
Move right |
Space |
Hard drop |
You can optionally select a specific level if the game is too hard or easy for you. To do this, use the --start-level <level> flag, where you can replace <level> with any number between 1 to 25. Here's an example of how you can play the 21st level:
tetris --start-level 21
The Linux Command Line Can Be Fun
As daunting as the Linux terminal might seem at first, the command line is not just for running complex commands that can be hard to understand as a beginner. Simple yet fun tools can help you get accustomed while slowly enjoy the power of using the command line over GUI.
Looking for more such fun commands for your macOS terminal? We've got just the perfect roundup for you.