Linux


CybHer CTF.

What is Linux?

Linux is an operating system — like Windows or macOS — that helps your computer run and lets you interact with files, programs, and hardware. It's used all over the world in servers, phones, computers, and even robots! Many programmers, scientists, and developers like Linux because it's free, powerful, and customizable.

What is the Command Line?

The command line (also called the terminal or shell) is a way to control your computer by typing instructions instead of clicking on buttons. You type a command, press Enter, and the computer follows your instructions — like opening a file, moving something, or searching for a word. It might look plain, but it's a powerful tool!

Linux Commands Cheat Sheet


Challenges

Challenge Description

In this challenge, you will learn to run some Linux commands! When using the terminal, the main way to interact with your computer is to type commands. Instead of clicking buttons, these commands tell your computer what you want to do.

We will focus on two commands for this challenge:

  • ls - the "list" command allows you to list or view the files in your current folder.
    • usage: type ls and press Enter
    • This will show all files in your current directory
  • cd - the "change directory" command allows you to move to a different folder.
    • usage: type cd new_folder and press Enter
    • replace "new_folder" with the name of the folder/directory you want to navigate to
    • This will move you to the new folder. You should see your terminal prompt change to show the folder you're currently in.

This challenge will require you to run the challenge file - but you don't know the file name this time! You will need to navigate to the /challenge directory, find the file, and run it.

Challenge Steps

  1. Open a terminal in the Desktop
  2. Navigate to the /challenge directory (Hint: Type cd /challenge and press Enter)
  3. Use the ls command to find the challenge file (Hint: it is NOT the DESCRIPTION.md file)
  4. To run this challenge, type the filename and press Enter!
  5. Submit your flag!

Before you start this challenge, you should have some understanding of how Linux works.

The Linux Filesystem

In Linux, the filesystem is structured like a tree, starting from the root directory (denoted by the character '/'), which is the base of everything. A 'directory' is just a folder. Think of / as the foundation that holds every file and folder on the system. Here are a few essential directories to get familiar with:

  • / (Root): The top level of the filesystem. All other files and folders are organized underneath it.
  • /home Directory: This is where personal files and folders for each user are stored. Each user has their own folder inside /home, such as /home/username, which is like a private workspace.
  • /tmp Directory: Stores temporary files that are deleted when the machine is restarted. Don't store important things here!

As an example, if you're a Linux user with the account name 'wkiffin', your home directory would be: /home/wkiffin

  • / at the beginning is the root of the directory tree, where all paths start.
  • home is the folder inside '/' that all Linux users home directories are stored.
  • wkiffin is the directory where our specific user files are stored.

Understanding this structure helps you know where to find your files, system settings, and applications on Linux.

This challenge will continue using the cd and ls commands as you traverse the Linux filesystem.

Challenge Steps

  1. Start the challenge and open a terminal
  2. Run /challenge/solve (This means you're running a file named 'solve' found within the 'challenge' directory that is held within the root '/' directory!)
  3. Follow the instructions given in /challenge/solve (It may be a bit tricky! Read all instructions carefully!)
  4. Submit the flag once you find it!

In this challenge you will be learning how to create and delete files on the command line.

Challenge Steps

  1. Start the challenge and open a terminal
  2. Run /challenge/solve
  3. Follow the instructions
  4. Submit the flag once you find it!

In this challenge you will be learning how to move, rename, and copy files.

Challenge Steps

  1. Start the challenge and open a terminal
  2. Run /challenge/solve
  3. Follow the instructions
  4. Submit the flag once you find it!

In this challenge you will be learning how to display the contents of a file within the linux terminal.

Challenge Steps

  1. Start the challenge and open a terminal
  2. Run /challenge/solve
  3. Follow the instructions
  4. Submit the flag once you find it!

Nano Text Editor

In Linux, while you're using the command line, you'll probably need a way to edit files. On Windows we can use an app like notepad or Microsoft Word to edit files. Unfortunately, we don't have access to tools like this in the terminal because they are graphical tools. However, the Linux command line offers a wide range of text editors that we can use - one option is called nano.

You can use Nano by typing the command nano {filename} in the terminal. If that filename already exists, it will open the existing file. Otherwise, it will create a new file with whatever filename you used. For example: nano myfile.txt will create a new text file named myfile.txt.

You can then begin writing text to the screen as if you were using notepad on Windows. To move around in nano you will have to use the arrow keys. In nano, you can't use your mouse to click buttons like 'file' and 'save as' - you have to use Keyboard shortcuts. You're probably already familiar with certain keybaord shortcuts such as CTRL+C to copy, and CTRL+V to paste.

In nano, they provide you with all of the keyboard shortcuts you will need to use at the bottom of your screen. It shows you the shortcut you need to enter with the syntax of up carrot '^' and then a letter following it. The up carrot ('^') means you have to hold the control key and then hit the letter that follows to execute the proper function.

To save and close a file, you will use the 'Exit' shortcut to save your file - CTRL+X. You will then be prompted if you want to "Save modified buffer", you can hit the 'y' key for yes to save your changes. Next it will ask you to confirm your filename at the bottom of the screen. It will be the filename you used when you ran nano, in our example "myfile.txt". To confirm your filename, press Enter. Or, if you'd like to change your filename, use the backspace button to delete it and then create a new name.

To put that all together for you, when you're done editing your file and are ready to save and close it: CTRL+X -> y -> Enter.

To complete this challenge you will use nano to create a file named my_nano_file.txt in your home directory (when you open the terminal, you will be in your home directory by default). This file should contain the phrase "CybHer 2025!". When you have put the text in your file, save and close it, then run /challenge/solve to verify that your file was made properly.

Challenge Steps

  1. Start the challenge and open a terminal
  2. Use nano to create a file named my_nano_file.txt
  3. Type the phrase "CybHer 2025!" in your file
  4. Save and close your file: CTRL+X -> y -> Enter
  5. Run /challenge/solve to verify your solution
  6. Submit your flag

In the previous challenge you saw how to create a file with nano. In this challenge you will see how to edit an existing file. Spoiler Alert: It's easy!

Challenge Steps

  1. Start the challenge and open a terminal
  2. Open the file you created in the previous challenge by typing nano [your_file]
  3. Edit the current line to say anything you want in the file, just change it
  4. Save and close, then run /challenge/solve to verify your solution
  5. Submit the flag!

This challenge will teach you to find information in a file - you will learn to search for a string. (A string is just a sequence of characters - like a word or a phrase!) More detailed instructions will be given in /challenge/solve.

Challenge Steps

  1. Start the challenge and open a terminal
  2. Run /challenge/solve
  3. Follow the instructions given
  4. Submit the flag!


30-Day Scoreboard:

This scoreboard reflects solves for challenges in this module after the module launched in this dojo.

Rank Hacker Badges Score