Вы находитесь на странице: 1из 2

UNIX Assignment

UNIX Assignment Day 5


For the first five exercises, create a file called emp_data with the following format Emp#, Last Name, First Name, Marks Fill in a few rows in the file and save it. Create two copies of it called emp_data_copy and emp_data_modified. Edit a few lines of emp_data_modified to make it different. Do not change emp_data_copy. 1. Use the cmp command to compare the two copies you made (unchanged and modified) with the original. What is the output of the cmp command in both cases. Immediately after each invocation, run the echo $? Command to display the exit status. What does this exercise tell you? 2. Use the diff command to check the differences between emp_data and emp_data_modified. Save the output to a file. 3. Use the patch utility with the file you generated in the last step to modify the original file, emp_data. Save the output of patch in a file called emp_data_patch. Check the emp_data_modified and emp_data_patch to see if they are the same. 4. Use the comm command to compare the files emp_data with emp_data_copy and secondly, emp_data with emp_data_modified. What inference can you draw from this exercise? 5. Sort all the three files saving the sorted files with the file suffix _sorted. Use the comm command to compare the files emp_data_sorted with emp_data_copy_sorted and secondly, emp_data_sorted with emp_data_modified_sorted. How do you interpret the two outputs and what inference can you draw from this exercise? 6. Use the file command on an empty file. What does it report and what does this reveal about the nature of the file command? 7. Use the file command to find the nature of /bin/ls. Explain each field of the output. 8. Use the find command to locate a string Payroll_Calculator in all files under your home directory. Print only the names of all files where the string is found.

MLS/11/UX/OS/001

Melior Learning Solutions

Page 1

UNIX Assignment 9. Use the chmod command one after another, the sticky bit, setuid bit and setgid bit for a file. After setting each bit, check the permissions. Report your findings. 10. Change the permission of a directory to deny yourself x permission. Use the cd command to change to that directory. Record your observations. 11. Start the sleep command in the background with an argument of 30 seconds each time and use kill with signal 2, 8, 9, 11, 14, 15 and 18. What happens each time and why? 12. Start the tput script you wrote a few days ago with nohup. Explain the message displayed by nohup. 13. Design crontabs for the following situations: a. Run a job on the 30th June, 30th September, 31st December and 31st March at 3:00 am b. Run a job on the 30th of every month at 1:00 am c. Run a job at 1:00 am every week-night

MLS/11/UX/OS/001

Melior Learning Solutions

Page 2

Вам также может понравиться