Starting from:

$25

COMP206-Assignment 1 Familiarising with File System, Editing Files with vi and Using Grep Solved

Ex. 1 —                               Familiarising with the File System 

1.    Your first task is to create a folder structure similar to the one given below, immediately under your home directory. The structure below represents a typical directory heirarchy that can be employed in developing complex software applications. Below, Projects is a subdirectory of your home directory, COMP206 is a subdirectory of Projects, asgn1 is a subdirectory of COMP206, and so forth. Nothing to be turned in for this question.

(Your Home Directory)

 

2.    Next, starting from you home directory (i.e., pwd shows that you are in your home directory), perform the change directory command, cd, to the asgn1 directory that you just created in the above step (i.e., now the pwd command should show that you are in the asgn1 directory). You MUST perform this using a single cd command execution that will take you directly from your home directory to the asgn1 directory.

1

3.    Now use the ls command to list all the directories that are immediately under the asgn1 directory. The listing should also include the permissions and the owner/group names associated each directory. (Therefore, this should demonstrate that you are the owner of these directories).

Turn in a screen shot of your shell that shows clearly that you executed the cd command from the previous question and the ls command. The screenshot must be an image, either EX1.PNG or EX1.JPG.

Ex. 2 —                              Editing Files with vi 

(a) In the docs directory, create a file by name license.txt using the vi editor. Enter the following contents in it.

Copyright : <your full name, <year - All Rights Reserved

Email                 : <your email address

Dept                  : <name of your department
(b)  From inside the docs directory, execute the pwd command.

(c)   From within the docs directory, execute the ls command. Make sure that the ls command show that the file was created by your user id, and its time stamp.

(d)  Next, cat the license file you just created to display its contents.

Turn in a screen shot that shows the pwd, ls, and cat commands and the output that they produce. Include all of it in a single screen shot, EX2  1.PNG or EX2 1.JPG.

2.     (a) From within the docs directory, execute the pwd command.

(b)   Now make a copy of the license file to the backup directory that you had created before, with a new name, license old.txt, by using the cp command (You MUST execute the cp command from the docs directory).

Turn in a screen shot that shows the pwd, cp commands and the output (if any) that they produce. Include all of it in a single screen shot, EX2  2.PNG or EX2 2.JPG.

Ex. 3 —                             Using grep 

From the docs directory, use pipe to make the ls and grep commands (with appropriate arguments to them) to interact such that it produces the following output. (You would of course have different owner/group names, permissions, file sizes and time stamp for your output. However, the names and order of the files and the content format of the output should be the same.)

-rw------- 1 jdsilv2 root 133 Dec 20 12:21 license.txt drwx------ 2 jdsilv2 root     2 Dec 20 11:24 txt

More products