HW2: Some basic Unix exercises. Purpose: get you geared up for using Unix as a platform for C program development. (To print this assignment out, type "laser2 hw2") IMPORTANT: DO NOT REMOVE ANY OF THE FILES YOU HAVE CREATED HERE UNTIL ***AFTER*** TOTEACH HAS ACCEPTED YOUR SUBMISSION. THE TOTEACH PROGRAM REQUIRES THAT YOU SUBMIT ALL THE FILES AT THE SAME TIME AND WILL NOT "REMEMBER" EARLIER SUBMISSIONS. SUGGESTION: READ THROUGH THIS ENTIRE ASSIGNMENT FIRST BEFORE ACTUALLY STARTING. (1) If you haven't already done so, type "hw 2" to get this file into your directory. (2) Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out1". (See chapter 1, pg. 10) (3) Make 2 copies of ls.out1: call them "ls.out2" and "ls.out3". (See chapter4, pgs 53-55) (4) Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out4". (5) Remove the file ls.out2 and rename the ls.out3 file: call it "fileX". (See chapter 4, pgs 57-58) (6) Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out6". (7) Use the echo command to display your name on the screen. Then execute the same command and redirect its output to a file called "me". (echo name, for redirection see chapter 5, pgs. 68-70.) (8) Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out8". (9) Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out9". (10) Use the cmp command to see if ls.out8 and ls.out9 are identical. Then execute the same command but redirect its output to a file called "cmp1.out". (cmp file1 file2) (11) Use a Unix command to display on the screen the differences between file ls.out8 and ls.out9. Then execute the same command but redirect its output to a file called "differences.out". (diff file1 file2) (12) Repeat steps (10) and (11) for the two files ls.out1 and fileX. Call the new files you create "cmp2.out" and "differences2.out". (13) Create a file consisting of all the lines from THIS file (that you are reading, the one called "hw2") that have the word "command" in them. Call the new file "command.out". (See chapter 5, pgs. 71-73) (14) Execute a command that will tell you how many lines, words and characters there are in the "message of the day file", which is named "/etc/motd". Then execute the same command but redirect its output to a file called "motd.out". (wc filename) (15) Create a file called hw2.tail consisting of the last 13 lines of THIS file (see step 13). Use a unix command, but do not use vi (or any other editor). (tail -n filename, where n is the number of lines) (16) Create a directory called "tempdir". Copy all files that have the letters "ls" in their name to this directory-- try to use shell metacharacters (wildcards) to help you do this. (See chapter 4, pgs. 51-53, you will use the mkdir command.) (17) Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out10". (18) Execute the command "ls -l tempdir". Then execute it again and redirect its output to a file called "ls.out11". (19) Change directory to tempdir. Execute the command "ls -l". Then execute it again and redirect its output to a file called "ls.out12". (See chapter 4, pg. 52. Use cd to change directory) (20) Change back to your original directory. Use the cat command to display the ls.out12 file that you created in step 19. (Note that you cannot just type "cat ls.out12" because ls.out12 is in the tempdir directory-- see chapter 4. to learn how to reference the file ls.out12 that is in tempdir when you are not in that directory.) Then execute it again and redirect its output to a file called "cat.out". (21) Use the date command to display the date into a file called "date.out"; Use the command options so that the format is exactly like mm/dd/yy format. (date +%m/%d/%y) (22) The motd command gives you the "message of the day". Try it. Now redirect its output to a file called "motd.out". Use the head command to display out the first 3 lines of motd.out. Now repeat that command, but redirect the output to a file called motd3.out. (23) Use toteach to submit all the files that have "out" in their name as well as me, fileX and hw2.tail. toteach 2 ... Try to use shell metacharacters (wildcards) to help you do this. (See pg. 51) (24) Remove all the files you created in this exercise. BUT DON'T DO THIS UNTIL YOUR TOTEACH SUBMISSION (from 23) IS ACCEPTED!!!!! HINT: remove all those files whose names contain "out" as well as me, fileX and hw2.tail (see chapter 4, pgs 59-60) WHAT TO SUBMIT VIA TOTEACH: Just follow (step 23) above.