01. Basic commands

Practice

Author: Dr. Alejandra Rougon

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

🚴 Exercise 1

  1. Go to your terminal either create a new one on CS50 or enter the already created virtual terminal

  2. Create a new directory called Lab1, then change directory to Lab1 and create the directory plants

  3. Change to the directory plants

  4. Once you are there, print the working directory

🚴 Exercise 2

  1. Inside Lab1 create another directory called animals

  2. Change to directory called root using the absolute path

  3. Change to the animals directory using the relative path

  4. Verify that you are in the directory animals

  5. Now move to the directory plants using the relative path

  6. Verify that you are in the directory plants

  7. Change to the sandbox directory using the relative path

🚴 Exercise 3

  1. Create a new directory called fruits and go inside fruits

  2. From there, create a file inside the directory animals called fish

  3. Move to the directory fish

  4. From there, create a directory called vegetables inside plants

  5. Move to the directory vegetables

Your file tree should look like this:

🚴 Exercise 4

  1. Create a file called my_fruits inside the folder fruits containing the following data: apple banana

  2. Verify it was created by listing the contents of the folder

  3. View the contents of the file with less, more and cat

  4. Remove the word banana from the file my_fruits and add two more lines: blueberries mango

  5. Make a copy of my_fruits in the directory Lab1 with the name my_fruits.copy

  6. Create the file my_vegetables in the directory vegetables that contains two vegetables.

  7. Concatenate both files my_fruits and my_vegetables in a new file called my_species in the directory plants.


Thank you for completing this activity!