Part Two

Q1. Setting up a Linux Operating System

I chose to setup an Ubuntu 20.04.4 LTS virtual machine, the ISO file for this machine was downloaded from the official Ubuntu website. I used Oracle VirtualBox to create the virtual machine so the setup was fairly simple.




Q2. Manipulate Directory Structures in Unix/Linux

Use any OS (in my case this is Ubuntu 20.04.4 LTS) setup in Question 1.

Assume you are started at your home directory.

Perform a command that displays the absolute path of your home directory.

Unix 1

1. Create a new directory inside your home directory and name it “Jack”.

Unix 2

2. Now navigate to the “Jack” directory and create directory “Jack-COMP501WORK” and change your current working directory to “Jack-COMP501WORK”.

Unix 3

3. Create three new subdirectories called “Sec1”, “Sec2”, and “Sec3” in “Jack-COMP501WORK”.

Unix 4

4. Create a new file called “MyFave.txt”.

Unix 5

a. The first line should contain your name and ID number.

b. The second line should be the first sentence of your favourite song.

c. The third line should be the name of your favourite movie.

Unix 6

Display the contents of the file "MyFave.txt” to the standard output screen.

Unix 7

5. Display the number of words in the file “MyFave.txt”.

Unix 8

6. Copy the file “MyFave.txtto directorySec1” and rename it to “MyFaveCopy.txt”.

Unix 9

Make another copy of “MyFaveCopy.txt” just made in directory “Sec1” and name it “MyFaveCopyCopy.txt”.

Then, display the contents of the directory “Sec1” using ls.

Unix 10

7. Copy all the contents of directory “Sec1” to directory “Sec2” and display the contents of the directory “Sec2”.

Display a listing of all the files and directories in long format in the current working directory.

Unix 11

8. Assume that you are now at the current working directory “Jack-COMP501WORK”; create 15 new files.

Unix 12

9. Display a listing of all the files in the current working directory ending with the letter ‘t’ using one command.

Unix 13

10. Display a listing of all the files in the current working directory ending with the letter ‘T’ using one command.

Unix 14

11. Move everything (files/directories) containing the letter ‘t’ to the directory “Sec3” using one command.

Unix 15

12. Display a listing of the contents of the current directory “Jack-COMP501WORK”. All files that contain the letter ‘t’ should now be gone.

Unix 16