CMSC 291u - Introduction to UNIX - Spring 2003 - HW 2
Out: Friday January 31st       Due: Monday February 3rd

In order for the whole assignment to be logged to a file, you will need to sit down and complete the whole thing from beginning to end without logging out. If you make mistakes or typos as you go, do not worry about it. Fix and re-issue the command.

I strongly recommend that you figure out what command and what arguments you are going to be typing for each step before you actually issue the command. This way you can test out the command before you actually sit down and log the entire assignment.

  1. Connect via SSH to linux.gl.umbc.edu. You will be doing this assignment via a SSH connection to one of the Linux servers. You may use the SSH client of your choice.
     
  2. Make sure that you are in you home directory. You should know how to do this. There are several ways of accomplishing this, take a look at the notes if you need to find out.
     
  3. First type script at the command prompt. This will allow for the entire interaction that you have with the UNIX environment to be logged to a file called "typescript". You should see the message "Script started, file is typescript".
     
  4. Verify that you are in your home directory. Meaning issue the command that prints out the current working directory.
     
  5. Make a directory called "courses". If for whatever reason this directory already exists (you already created it as part of organizing your account) then simply skip this step.
     
  6. Change the current working directory to this newly created directory called "courses".
     
  7. Again issue the command to verify that the current working directory is now in this "courses" directory.
     
  8. From within this directory make 2 different directories called "cmsc291u" and "temp".
     
  9. Now do a normal listing of this directory. You should note the 2 new directories now show up in this listing.
     
  10. Now let's create an empty file called "file0".
     
  11. Now do a long directory listing.
     
  12. Copy "file0" into the directory "cmsc291u"
     
  13. Let's copy some more files. This time we will get them out of my public directory. Copy the "file1" from /afs/umbc.edu/users/d/h/dhood2/pub/cmsc291u/hw2/ into the directory called "cmsc291u"
     
  14. Now copy all 3 of these files out of my public directory. Copy "file1", "file2" and "file3" all into the directory called "temp".
     
  15. Now do a directory listing of each of the 2 directories "cmsc291u" and "temp"
     
  16. Move "file0" (the one that is in this current directory) into the "temp" directory.
     
  17. Copy "file3" (which is in the "temp" directory) into the "cmsc291u" directory
     
  18. Change directories into the "temp" directory
     .
  19. Show the contents of both of "file2" and "file3" using the command of your choice.
     
  20. There is 1 slight difference between these 2 files. Use the UNIX command that will show the differences between these 2 files to show us what it is.
     
  21. Change the directories to the parent of the current directory. You can do this using one of the special arguments that I showed you for the change directory command or you can type in the full absolute pathname. So once this command is done you should be in the "courses" directory.
     
  22. Now let's issue the command to remove a directory. Let's try to remove the this "temp". Issue the command to remove a directory and note what happens. We get yelled at because the directory is not empty.
     
  23. So let's fix this. Remove all files that are in the "temp" using the commands of your choice. If you changed directories to accomplish this, return back to the "courses" directory.
     
  24. Now you should be able to remove the "temp" directory. Try again to issue the command that will remove this directory. Sine the directory is empty it should work.
     
  25. Go ahead and do a directory listing to verify that the directory has been removed.
     
  26. Now change directories into the remaining "cmsc291u" directory.
     
  27. There should be 3 files in this directory. Verify that by doing a directory listing.
     
  28. Let's see how large each of these files are. Do a long directory listing.
     
  29. The numbers that are given as the file size are in bytes. We talked about a flag that will allow us to print this out in a more human readable format. Issue the directory listing command again, thus time using the human readable and longoptions. Note that filesize are now given in Kilobytes where applicable. Had we had files that were several Megabytes in size we would see the size being reported in with an M for Megabytes.
     
  30. Go ahead and issue the command to print out the file called "file1". Note: You will not be charged for this printout. OIT now has the printer system setup so that your job does not actually print until you go in and ask a person at the counter for it. At which point the job is sent from a waiting queue off to the printer.
     
  31. Now that we know the sizes of these files let's get some other statistics on them. Issuse the command to get the total number of words, characters and bytes for the file called "file3". You should see that the total number of bytes matches what the long directory listing showed.
     
  32. Now using a wildcard, issue a command that will get the total number of words, characters and bytes for all files in this directory. Notice now that this command has also returned us grand totals for all of the files combined.
     
  33. Let's go ahead and remove all 3 of the files that are in this current working directory (which is "cmsc291u").
     
  34. This directory should now be empty. Verify that using by listing the contents of the directory.
     
  35. Change directories back to your home directory. You could do this using the ..characters, but instead show me another way to change back to your home directory. Do not use an absolute path either (/afs/umbc.edu/users/u/s/username/home/). Part of the goal of this course is to get you to work more efficiently. There are many shortcuts to achieve the same effect.
     
  36. Issue the directory listing command in such a way that you see some of the hidden files and directories that exist in your home directory.
     
  37. Now issue the command that will print out the current date and time
     
  38. Issue the command that will print a list out of all the users that are logged onto the computer that you are.
     
  39. Almost finished, type exit at the command prompt. This will close the session that logged all of your activity to a file. You should see something like "Script done, file is typescript".
     
  40. Now that all of the assignment has been logged to the file called "typescript", I want you to make sure that it logged everything correctly. Use one of the commands that we discussed to see the contents of the file.
     

Finally you will hand in the typescript file that you created. You will not email me this project, instead we will use UMBC's submit command. You will issue the following command to submit the typescript file: "submit cs291u proj2 typescript". You can then issue the submitls command "submitls cs291u proj2" to see what you submitted. If you messed up and would like to re-submit you can simply issue the submit command again, and the file that you previously submitted will be overwritten. Like demonstrated...

linux1 [4]# submit cs291u proj2 typescript 
Submitting typescript...OK
linux1 [5]# submitls cs291u proj2
total 4
drwx------    2 dhood2   general      2048 Jan 16 12:24 .
drwxr-xr-x   14 dhood2   general      2048 Jan 16 12:24 ..
-rw-------    1 dhood2   general         0 Jan 16 12:24 typescript
linux1 [6]# submit cs291u proj2 typescript
It seems you have already submitted a file named typescript.
Do you wish to overwrite? (y/n): 
y
Submitting typescript...OK
linux1 [7]# 

Daniel J. Hood
Last modified: Fri Jan 31 13:39:36 EST 2003