Reference no: EM131021607
Assignment -1
Purpose: To create links and test their properties.
NOTE: These instructions reflect the user interface in version 12.04LTS of Ubuntu.
1. Boot your Ubuntu system and open three command shells. In one of the shells, change your user identity to the root identity. In another, change your user identity to one of the alternate user identities you created during Week 1. Verify that you have a directory named CourseNotes in your home directory. Make sure that the permissions on the directories will not interfere with our experiments by setting the permissions on CourseNotes and Desktop to 777. Open a browser window.
NOTE: You will do most of your work with the shell recognizing you as your primary student identity.
2. Download the files named assign04_sample1.txt and assign04_sample2.txt and save them in CourseNotes. (NOTE: Your browser may save the files in your home directory by default; you can either change the save location or move the files with an mv command after they are downloaded.)
3. Use the cd command to move into the CourseNotes directory. Use the chmod command to change the permissions on the two lecture files. Change the permissions on one of them to allow all three categories of user to read and write. On the other, change the permissions so that only the owner can read and write to the file, leaving no permissions to the other two categories.
4. Get a listing of the lecture files which will provide information about permissions, file sizes, and inodes.
(try this command: ls -il). Write that information on the blanks below:
Permissions File Sizes Inodes
file 1: ____________ ____________ ____________
file 2: ____________ ____________ ____________
5. Use the cd command to move to your Desktop directory. (Try this command: cd ../Desktop).
6. Create one hard link (in the Desktop directory) for each of the two files located in the CourseNotes directory. To name your links, use the base name you used for the original files, but give them the file extension hlnk. Consider the following questions: What options will you give the ln commands? How will you specify the location of the files, since you are not in the same directory? (Instruction #5 should give you a hint.)
7. Get a listing of the links which will provide information about permissions, file sizes, and inodes.
Write that information on the blanks below:
Permissions File Sizes Inodes
file 1: ____________ ____________ ____________
file 2: ____________ ____________ ____________
8. Now create a symbolic link (in the Desktop directory) for each of the files in your CourseNotes directory. Use the same base names again, but this time use the extension slnk.
9. Get a listing of the links which will provide information about permissions, file sizes, and inodes.
Write that information on the blanks below:
Permissions File Sizes Inodes
file 1: ____________ ____________ ____________
file 2: ____________ ____________ ____________
10. Minimize all of your windows and study your screen Desktop. Do you see the links there?
11. Bring up your other two command shells, the ones which recognize you as different users. In each of those, move to the Desktop directory of your primary student user. (cd /home/userid/Desktop)
12. In each of the windows, try to read and edit all four of the links. Notice that the root user is able to do anything; this should reinforce the permissions topic that was discussed last week.
The operating system is enforcing some kind of permissions - are they the permissions defined by the link, or the ones defined by the files located in CourseNotes?
13. Using the window that recognizes you under your primary student identity, make sure you are in your Desktop directory. Create a new link to a non-existent file:
ln -s ../CourseNotes/lecture0x.txt lecture0x.slnk
Get a long listing of the directory. Describe the appearance of your link:
____________________________________________________________
14. Edit your broken link:
vi lecture0x.slnk
Type some information about your three favorite colors, explaining why you like them. Exit vi and obtain a listing of the directory. Describe the appearance of your link now:
Assignment -2
Purpose: To gain experience starting, viewing, and administering processes.
NOTE: These instructions reflect the user interface in version 12.04LTS of Ubuntu.
1. Boot your system and log in. Open a command shell and a web browser.
2. Create a new directory named bin in your home directory.
3. Using your web browser, navigate to the web site specified by your instructor and download the scripts named schedule.sh, sleeper.sh, and zombie.sh. (You will not use the schedule.sh script for this lab, but you will need it in the future.) Save them in your bin directory. Use the chmod command to give read, write, and execute permissions on each of those files to all three categories of user.
4. Type ~/bin/sleeper.sh at the command prompt. (What is the ~ doing?) This causes the command shell to execute (run) the instructions you placed in the file. Record the results
____________________________________________________________
____________________________________________________________
Re-run the script and IMMEDIATELY try to run the ls command. Does the ls command
run right away? Why not?
____________________________________________________________
5. Navigate to your ~/bin directory, where the scripts are located. Try these two commands:
sleeper.sh
./sleeper.sh
Do both commands work?
____________
What is the meaning of the ./ in the second command?
____________
View your search PATH - is ~/bin included in it?
____________
6. Run sleeper.sh again - this time in the background. (Place an & after the command.) Once again, run an ls command immediately. Notice that now the command executes right away.
7. Run sleeper.sh in the background again, and while it is running enter the jobs command. Find the process ID for sleeper.sh using the ps -a command. (NOTE: If you are not quick enough in running these commands, you may have to do the exercise again.)
____________
8. Re-run sleeper in the background. As soon as the command prompt reappears, use the <UPARROW> key to go back to the previous command, then start another process by pressing the <ENTER> key. Repeat until the first sleeper.sh process terminates. How many were you able to start?
____________
9. Open a new terminal window, and in that window execute the top command. Leave it running.
10. Run zombie.sh in the FOREground. Watch your top window for at least 20 seconds. How much CPU time is being occupied by the script?
____________
11. In the window which is now locked by the zombie.sh process, type <CTRL>c.
12. Run sleeper.sh in the foreground, but this time use <CTRL>z immediately. This will stop the process and move it into the background.
13. Type the ps -a command and get the process IDs associated with your sleeper process. You should find TWO of them - one should be given the name sleep, while the other will be identified either as sleeper.sh or as bash. The latter process is the parent process; on some Linux distributions that process is identified by the name of the script, while on others it is identified using the name of the shell invoked by the script. The other process, which should be identified with the name sleep, is a child process started by the script.
What are their process IDs?
____________ ____________
Try using the kill command on the process named sleep (use the PID number as the argument). Then run the ps -a command. Do you see any change?
____________
Now use the kill -9 command on that same process, then run the ps -a command. Describe what you see:
____________________________________________________________
Now use the kill -9 command on the parent process, and run the ps -a command. Describe what you see:
____________________________________________________________
14. Run zombie.sh in the background, then use the ps -a command to obtain the PID of your zombie.sh.
15. In your top window type the letter 'k', then enter the PID of your zombie.sh process. Use a signal of 9, when you are prompted. Observe the way the process disappears from the top window.
16. Shut down top by typing a 'q' in that window.
What are the differences between Windows shortcuts and UNIX symbolic links? Are there any? Please be sure to cite your sources to support your position.
Attachment:- OS.rar