HAKATEMIA
13Linux command line

Linux basics - Practice

Easy15MIN

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.

1 / 2
Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.