Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions 03_homework/homework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@
# On your terminal, input all the commands you have used to create the following:

# 1. How would you create 5 directories? Feel free to use any name for your directories.

mkdir dir1 dir2 dir3 dir4 dir5
# 2. How would you verify the creation of all 5 directories?

ls
# 3. In each directory, how would you create 5 .txt files and write "I love data" into each within the directories?

echo "I love data" > dir1/1.txt
cp dir1/1.txt dir2/2.txt
cp dir1/1.txt dir3/3.txt
cp dir1/1.txt dir4/4.txt
cp dir1/1.txt dir5/5.txt
# 4. How would you verify the presence of all 5 files?

ls *
# 5. How would you append to one of the existing files " and machine learning!"?

cd dir1
echo " and machine learning!" >> 1.txt
# 6. How would you verify that the text was indeed appended to the existing file?

cat 1.txt
# 7. How would you delete all files except for the one with the appended text?

rm ../dir2/* ../dir3/* ../dir4/* ../dir5/*
# 8. How would you navigate back to the parent directory containing all the directories?

cd ..
# 9. How would you remove each directory along with its contents?

rm -r dir1 dir2 dir3 dir4 dir5
# 10. How would you verify that all directories and files have been deleted?
ls