Cityscape
Girl

Web Hacking Fundamentals

Linux basics - Practice

Easy
15 min

In this module, you will now apply everything you have learned and solve the final task! Start by creating a new file in the /tmp/ directory named script.sh.

Write the following commands inside this file on separate lines, in the given order:

  • A command that creates the directories hakatemia_1, hakatemia_2, and hakatemia_3 in the directory where the command is executed (no need to specify a path for these).
  • A command that creates a file named info.txt inside each of these directories.
  • A command that writes the following text into each info.txt file:
    For your information: This is a note!
  • A command that grants execution permission to the script.sh file.
  • A command that copies the script.sh file into each of the created directories.

Finally, you can test that the commands work and everything is in order by executing the /tmp/script.sh file. You can do this, for example, with the command: bash script.sh

However, ensure that your working directory is always the same as where the file is located. In other words, when writing the file in the /tmp/ directory, execute it with your working directory set to /tmp/.

Once you are sure that the script's commands are ready and everything works, create a directory ~/completed and move the script.sh file into this directory.

Exercises

Completed

hakatemia pro

Ready to become an ethical hacker?
Start today.

As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.