Remember to start a Docker container before beginning the lab exercises, and save your work in the mounted directory. Lab files
for each week are provided inside the /lab directory.
It is recommended that you create a new directory for each week (week1, week2, etc) within the mounted
directory to store any files you create for that week's lab. You may wish to copy the lab content into this directory using cp.
Questions
What does open source mean? How is that different from free-to-use?
What are the two meanings of / in the file path /lab/week2/thing.txt?
What is the absolute path of the home directory of the user stud?
What is the file called .? How is this different to a file called .stuff?
Create a directory called week2 in the mounted directory if you haven't already. Then create a file
in week2 using the following command:
/usr/games/cowsay "MOO" > lol.txt
Print the first 3 lines of lol.txt using a command ("print" means "display in the terminal", not
"send to a printer").
Print the last line of lol.txt using a command
How many lines are in lol.txt?
What is the difference between cat lol.txt and head lol.txt? Would this change on a larger file?
How many files are in /lab/week2? Don't count . or .. (why are we ignoring these?).
What does the -p option mean for ls?
List the contents of /lab/week2 in size order. Which is largest?
What command would you use to copy Alice_in_Wonderland.txt from /lab/week2 to your mounted directory?
How many words are in Alice_in_Wonderland.txt?
Open Alice_in_Wonderland.txt using the less. In less:
Space bar goes one page ahead, b goes one page back
G goes to end of file, gg goes to the start
To go to a line number, type the line number then G
To search for a string, type / then the string, then press enter. Press n
to cycle through results or N to cycle backwards.
Using less, answer the following:
What chapter begins on line 1252?
What food is described as rich and green?
How many times does the word "verdict" appear?
You've decided you don't want to keep a whole book in your mounted directory. How can you remove
Alice_in_Wonderland.txt from your mounted directory?
Department of Computer Science & Software Engineering
The University of Western Australia
Last modified: 8 February 2022
Modified By: Daniel Smith