DEV Community

Cover image for Creating a Fun Terminal-Based Treasure Hunt Game Using Simple Linux Commands
Rajpreet Gill
Rajpreet Gill

Posted on

1 1

Creating a Fun Terminal-Based Treasure Hunt Game Using Simple Linux Commands

Ever wanted to create a fun, interactive game that you can play directly in your terminal? In this blog, Iโ€™ll show you how to build a simple, yet exciting treasure hunt game using basic Linux commands.

Why Terminal-Based Games?

Terminal-based games are a great way to practice your Linux command-line skills while having fun. By using simple commands like ls, cat, cd, and base64, you can create a text-based game that runs entirely in your terminal.

What Youโ€™ll Need

  • Linux-based terminal (you can also use macOS Terminal or Windows Subsystem for Linux (WSL)).
  • Basic knowledge of the terminal commands like ls, cd, cat, echo, and base64.

๐Ÿ“š Table of Contents

  1. ๐Ÿ›  Step 1: Setting Up the Folder
  2. ๐Ÿงฉ Step 2: Creating the Clues
  3. ๐ŸŽฎ Step 3: Playing the Game
  4. ๐Ÿ Step 4: Conclusion

Step 1: Setting Up the Folders

Letโ€™s start by setting up the folder structure for our game. Open your terminal and run the following commands:

Image description

This will create three levels of the game, with one hidden folder inside level2. Now, navigate to the treasure-hunt directory:

Image description

Step 2: Creating the Clues

Weโ€™ll create a text file with a clue for each level. The first clue will guide the player to level 2. Here's how you can do that:

1. Create the first clue in level1/clue.txt:

Image description

2. Create the hidden second clue in the .secret folder inside level2:

Image description

3. Create a fake clue in level3/fake.txt:

Image description

4. Create the final clue in level3/real_clue.txt:

Image description

Step 3: Playing the Game

Now, let's dive into the game! You will navigate through the levels, read the clues, and decode the hidden message.

1. Start at level1 by reading the first clue:

By going with Folder cd ~/treasure-hunt/level1

You should see:

Image description

2. Move to level2:

You should see the hidden .secret folder. Now, go into the .secret folder:

Image description

Now go, CD .Secret

3. Read the hidden clue in clue2.txt:

Image description

4. Decode the base64 message to get the next path:

Image description

5. Move to level3:

Image description

6. Read the fake clue:

Image description

7. Finally, read the real clue:

Image description

Step 4: Conclusion

Congrats, youโ€™ve completed the treasure hunt! ๐ŸŽ‰. You used basic Linux commands to navigate through directories, read files, and decode hidden messages. The best part? You can easily modify and expand this game with more levels, harder clues, or even new challenges like encrypted passwords.

Image description

But this is just the beginning...

You can level up the game by:

๐Ÿ” Hiding clues behind encrypted files or password-protected archives

๐Ÿง  Adding logic-based riddles that require scripting to solve

๐ŸŒ Spanning clues across remote servers using ssh or scp

๐ŸŽฏ Introducing time-based challenges with bash scripts

This kind of hands-on terminal game is a great way to learn while playing โ€” perfect for beginners, workshops, or even team-building exercises for developers.

So what are you waiting for? Create your own quest, share it with friends, and keep hacking your way to victory! ๐Ÿš€

#30DaysLinuxChallenge #CloudWhisler
DevOps #Linux #RHCSA #Opensource #AWS #CloudComputing

Catch out by My LinkedIn profile
https://www.linkedin.com/in/rajpreet-gill-4569b4161/

ACI image

ACI.dev: The Only MCP Server Your AI Agents Need

ACI.devโ€™s open-source tool-use platform and Unified MCP Server turns 600+ functions into two simple MCP tools on one serverโ€”search and execute. Comes with multi-tenant auth and natural-language permission scopes. 100% open-source under Apache 2.0.

Star our GitHub!

Top comments (0)

ITRS image

See What Users Experience in The Browser โ€” Anywhere, Anytime

Simulate logins, checkouts, and payments on SaaS, APIs, and internal apps. Catch issues early, baseline web performance, and stay ahead of incidents. Easily record user journeys right from your browser.

Start Free Trial

DEV Launches and Announcements

๐Ÿฏ ๐Ÿš€ Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

TL;DR: Eight years ago, we launched Timescale to bring time-series to PostgreSQL. Our mission was simple: help developers building time-series applications.

Check out the challenge

DEV is bringing live events to the community. Dismiss if you're not interested. โค๏ธ