Description
Ex. 1 — Familiarising with the File System (7 Points) 1. (3 Points) 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) Projects COMP206 asgn1 archive backup docs html txt assets database src sh c 2. (2 Points) 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. (2 Points) 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 (9 Points) 1. (a) (4 Points) In the docs directory, create a file by name license.txt using the vi editor. Enter the following contents in it. Copyright : , – All Rights Reserved Email : Dept : (b) (1 Point) From inside the docs directory, execute the pwd command. (c) (1 Point) 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) (1 Point) 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) (1 Point) From within the docs directory, execute the pwd command. (b) (1 Point) 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 (4 Points) 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 Turn in a screen shot that shows the command you executed and the output that it produces as EX3.PNG or EX3.JPG. WHAT TO HAND IN Turn in the 4 screen shots, named properly as mentioned above (so that the TA can identify which screen shot is for which which question. You do not have to zip all of the images together. FOOD FOR THOUGHT! The following discussion is meant to encourage you to search independently for creative and optimal ways to perform rudimentary tasks with less effort and does not impact the points that you can achieve in the above questions. • Can you find a way in which you can create all the directories using a single command in Exercise 1.1? • Can you execute the copy command in such a way so that the timestamp of license old.txt ends up being the same as that of license.txt in Exercise 2.2? 2