UNIX Operating System

Reviews
Shared by: XIAOHUI MA
Stats
views:
6
rating:
not rated
reviews:
0
posted:
10/27/2009
language:
ENGLISH
pages:
0
UNIX Operating System 1st Assignment WEEK 8 This assignment consists of 50 questions spread over 10 topics that have been covered in the lectures and tutorials to date. You must have a terminal window open to accomplish the tasks set. You must show the commands and options used to accomplish each task, so that they can be verified. Each task must be completed in turn as work completed in earlier questions will be required to complete later tasks. Please write your student number, date and name on your answer sheet. You may submit your answers on a sheet of paper. Your solutions will be collected at the end of the tutorial. Student Name: Registration Number: Questions Directory navigation 1: In a terminal window. What command would you use to determine your current working directory? [2 Marks] 2: What command would you use to list the files in your current directory? [2 Marks] 3: What command options would be used to display all files (excluding hidden files) showing (at a minimum) their permissions, owner and size. You may use a command option that shows extra information also.? [2 Marks] 4: Create a directory in your current working directory called, myTest. List all commands you used. [2 Marks] 5: Change your current working directory to myTest. Create a new subdirectory called quickTest. List all commands you used. [2 Marks] 6: Delete the subdirectory called quickTest. List all commands you used. [2 Marks] File management. 7: Using the cal command, display each of the following and note the commands you used. (a) Display the month of January 2004, (b) display your birthday month (i.e. the month you were born in) for 2003 and (c) display the calendar for the current year. [2 Marks] 8: Create a file called myFile1 by redirecting the output of any command. Show the exact commands and options you used to accomplish this. [2 Marks] 9: Copy the file called myFile1 to a file called myFile2. Show the exact commands and options you used to accomplish this. [2 Marks] 10: Copy the file called myFile1 to a file called oldFile1. Show the exact commands and options you used to accomplish this. [2 Marks] 11: Move the file called myFile2 from the current working directory to one directory above. [2 Marks] 12: Delete/remove the file called myFile2. [2 Marks] 13: Which options would you pass to the ls command to : (a) list all files in the current directory (including hidden files), (b) list all files in the current directory (excluding hidden files) and list all files in the current directory beginning with o. [4 Marks] 14: Using the chmod command, detail how you would change permissions to achieve the following file permissions on the file myFile? myUsername & myUsergroup represent your actual username and group.  (a) -rwxr---w- myUsername myUsergroup 22 Feb 36 11:11 myFile [2 Marks]  (b) -rwxrw-rw- myUsername myUsergroup 22 Feb 36 11:11 myFile [2 Marks]  (c) -rwxrw---- myUsername myUsergroup 22 Feb 36 11:11 myFile [2 Marks]  (d) -rwxrwx--- myUsername myUsergroup 22 Feb 36 11:11 myFile [2 Marks] General commands [14 Marks] 15: You have just written an essay in a file called myEssay.txt. What command would you use to check the spelling of the text within this file? Please provide the commands required to perform this task. [2 Marks] 16: You have just written an essay in a file called myEssay.txt. What command would you use to display the contents of the file to the screen? Please provide the commands required to perform this task. [2 Marks] 17: You have just written an essay in a file called myEssay.txt. What command would you use to display the contents of the file to the screen? Please provide the commands required to perform this task. [2 Marks] 18: A colleague has provided you with an updated version of your file, it is called myEssay2.txt. What command would you use to see what the differences are between your version myEssay.txt and the new version myEssay2.txt? Please provide the commands required to perform this task. [2 Marks] 19: What command would you use to change your password? Please provide the commands required to perform this task. [2 Marks] 20: What command would you use to print a file called myEssay.txt to a printer called myPrinter? What does the myEssay.txt do? Hint : Consult the system manual [4 Marks] Background processing 21: What would you place at the end of a command to have it run as a background process? [2 Marks] 22: What will the following command accomplish? xbiff&[2 Marks] 23: What does the kill command do? How would you terminate a process with ID 6079? [2 Marks] Pipes and redirection 24: What command would you use to display a file's contents, where the lines are displayed sorted alphanumerically? You must use one command line and make use of a pipe. [2 Marks] 25: What commands would you use to search a file for every occurrence of the letter "a" and sort the list in reverse alphabetical order? You must use one command line and make use of a pipe(s). [4 Marks] Shell scripting 26: The following is a simple sheel script which shows which users are logged in. Line numbers are provided in brackets for simplicity. (1) #!/bin/sh (2) #Show who is logged in. (3) who (4) #End of script. Extend this script to display the current time? You need only to supply the lines you add and indicate between which line numbers they will appear [5 Marks] 27: Remember the chex script from tutorial 5? It is provided below. Modify this script make a file (rw-) only by the user. Please indicate which line(s) need to be changed and what changes are required. (1) #!/bin/sh (2) # Gine the user rw- and remove all other group & everyone permissions (3) chmod ?????? (4) echo $1 is now executable: (5) ls -l $1 Extend this script to display the current time? You need only to supply the line(s) you add and indicate between which line numbers they will appear [5 Marks] 28: Write a script that displays the calendar for a given month? (1) #!/bin/sh (2) # Display the calendar for a given month ... ... (5) #End of script. You need only to supply the line(s) you add and indicate between which line numbers they will appear [6 Marks] 29: Write a script that deletes all files ending with .o or called core from the current directory? (1) #!/bin/sh (2) # Remove all .o and files called core ... ... (5) #End of script. You need only to supply the line(s) you add and indicate between which line numbers they will appear [6 Marks] 30: Modify your answer to question 41 to have the script recursively serach sub-directories to remove .o and files called core? You need only to supply the line(s) you add and indicate between which line numbers they will appear [6 Marks] 31: Write a script to remove all group and everyone permissions on files in the current directory. Make sure the users permissions remain unchanged. (1) #!/bin/sh (2) # Remove all group and everyone permissions ... ... (5) #End of script. You need only to supply the line(s) you add and indicate between which line numbers they will appear [6 Marks] 32: What is wrong with the following script, you must note a minimum of 3 errors. (1) !/bin/sh (2) My general script (3) Who -T (4) date | (5) ls -z Indicate the line number,the error and the correction. [6 Marks] UNIX Operating System 1st Assignment WEEK 8 Student Name: Registration Number: Answers: Directory navigation 1: 2: 3: 4: 5: 6: File management. 7: (a) (b) (c) 8: 9: 10: 11: 12: 13: 14: (a) (b) (c) (d) General commands 15: 16: 17: 18: 19: 20: Background processing 21: 22: 23: Pipes and redirection 24: 25: Shell scripting 26: 27: 28: 29: 30: 31: 32: DATE:

Related docs
Unix System
Views: 3  |  Downloads: 0
unix
Views: 55  |  Downloads: 9
The UNIX System
Views: 5  |  Downloads: 0
Unix a operating system
Views: 1  |  Downloads: 0
The UNIX Operating System UNIX Overview
Views: 0  |  Downloads: 0
The UNIX Operating System
Views: 0  |  Downloads: 0
_________________ UNIX
Views: 3  |  Downloads: 0
______ _-UNIX
Views: 7  |  Downloads: 0
___ UNIX __ ____ ______ _____
Views: 2  |  Downloads: 0
_____ _____ ____ _- unix
Views: 2  |  Downloads: 0
UNIX
Views: 3  |  Downloads: 0
unix ________
Views: 3  |  Downloads: 0
UNIX __
Views: 1  |  Downloads: 0
premium docs
Other docs by XIAOHUI MA
Group Exercise Schedule - ymcadcorg
Views: 45  |  Downloads: 0
FT 240
Views: 38  |  Downloads: 0
Fitness-Pilates for Pregnancy Handout
Views: 40  |  Downloads: 0
Fitness-Pilates Exercises
Views: 41  |  Downloads: 0
FINAL PARADE LINEUP 2006 - City Of Belvedere
Views: 40  |  Downloads: 0
Exercise for Life
Views: 43  |  Downloads: 0
Directory - cmslgflnet - LGfL
Views: 60  |  Downloads: 0
CSP Student Representatives Conference
Views: 43  |  Downloads: 0
Covenant Wellness Center Schedule
Views: 46  |  Downloads: 0