01. Basic commands¶
Practice¶
Author: Dr. Alejandra Rougon
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
🚴 Exercise 1¶
Go to your terminal either create a new one on CS50 or enter the already created virtual terminal
Create a new directory called
Lab1
, then change directory toLab1
and create the directoryplants
Change to the directory
plants
Once you are there, print the working directory
🚴 Exercise 2¶
Inside
Lab1
create another directory calledanimals
Change to directory called
root
using the absolute pathChange to the
animals
directory using the relative pathVerify that you are in the directory
animals
Now move to the directory
plants
using the relative pathVerify that you are in the directory
plants
Change to the
sandbox
directory using the relative path
🚴 Exercise 3¶
Create a new directory called
fruits
and go insidefruits
From there, create a file inside the directory
animals
calledfish
Move to the directory
fish
From there, create a directory called
vegetables
insideplants
Move to the directory
vegetables
Your file tree should look like this:
🚴 Exercise 4¶
Create a file called
my_fruits
inside the folderfruits
containing the following data: apple bananaVerify it was created by listing the contents of the folder
View the contents of the file with
less
,more
andcat
Remove the word
banana
from the filemy_fruits
and add two more lines: blueberries mangoMake a copy of
my_fruits
in the directoryLab1
with the namemy_fruits.copy
Create the file
my_vegetables
in the directoryvegetables
that contains two vegetables.Concatenate both files
my_fruits
andmy_vegetables
in a new file calledmy_species
in the directoryplants
.
Thank you for completing this activity!