Dana Vrajitoru
C151 Multi-User Operating Systems

C151 Lab 3

Due date: Tuesday, February 15, 2021.

Ex. 1. Extracting Archived Files.

Just as before, create a folder called week3 inside your folder c151. Go to that folder.

Copy the file
/home/dvrajito/c1/clipart.tar.gz
into the current directory (week3), or download it there from here.

Check the content of this archive file without extracting the files with the command

tar tfz clipart.tar.gz

Then extract these files with the command

tar xfz clipart.tar.gz

Make sure you have these files now in your account. Use the command display to view each of these files. You will need Xming or an X11-enabled connection for the display to work (see last week's lab).

Ex. 2 Archiving files.

List all the files starting with "k" from the directory /bin. Suppose that we want to create an archive of these files. Without changing your current directory (c151/week3), create the archive with the following command:

tar cf bink.tar /bin/k*

List the files in the current directory to see if the archive was created correctly. List the files contained in the archive with the following command:

tar tf bink.tar

List all the files in the current directory with a long list of attributes.

Compress the tar file created at the previous step with the command gzip:

gzip bink.tar

List the files again with the option -l to compare the size of the archive before and after the compression with gzip. You will need to submit this archive file as part of your lab.

Ex. 3. Setting File Permissions

Use the ~ character to copy the file icing.jpg that you can find in the relative path temp/c151/ from my home directory. My username is dvrajito, so you can identify my home folder by ~dvrajito. Place this file inside your c151/week3 folder.

View the content of the file with the command

display icing.jpg

You'll need to be in an X11 environment for that (see Lab 2 for explanations about X11 clients).

Change the permissions to the file icing.jpg such that anybody can read it. You can review this command by reading pages 92-94 from the textbook and it is shown in the demos and explained in the lecture for this week.

Change the permission to the week3 and c151 folders to be accessible for executing to anybody. You can change the permission of a folder while it is your current directory by using the "." notation, as for example:

chmod ugo+x .

Or you can change your working directory to its parent folder and change the permission from there using the name, such as

chmod ugo+x week3

Do the same with your home directory (but do not give everybody read or write permissions to either of these folders).

Create a symbolic link to the file icing.jpg that can be found in my home directory under temp/c151 and call it ice.jpg. List the content of the folder to show that the link was created properly. Display the file itself using this link.

Canvas Upload

At this point copy the content of the terminal to the file lab3.txt. You will also need to get the archive file created for Exercise 2 to a place from where you can upload it to Canvas. If you were working on a Linux system locally (not a remote connection), then you should be able to open a browser (such as firefox) and upload it directly from the hard drive. Note that you can open the browser directly from the terminal with the command firefox.

Otherwise here are some possible options to transfer it to your local machine so that you can upload it to Canvas in a browser:

Submit: to Canvas, Assignments, Lab 3, the file lab3.txt, and the archive file created for Exercise 2, bink.tar.gz.