CMSC 104, Section 0501

Spring 2002

Laboratory Exercise 2

 

Objectives

Note that there is nothing that you must turn in associated with this exercise. If you do not finish the exercise during the lab session, it is to your benefit to finish it later on your own.

 

Part I - Printing Class Lecture Slides

We will learn how to do this together. To keep this procedure orderly, please pay close attention and try not to "experiment" with the software while I am talking.

  1. Log into your gl account.
  2. Start Internet Explorer
  3. Go to the class home page: http://www.csee.umbc.edu/courses/undergraduate/104/spring02/kuss
  4. You can now navigate to the link called Powerpoint version of Section 501 Lecture notes. Notice, I also included a link to the Lecture notes common to all sections.
  5. Select the lecture that you want to view or print, for example: L01.ppt , the first slide will appear.
  6. Select File / Print and a window comes up. Under "Print What" select Handouts , and Select 6 slides per page. Then hit OK. The output for printer P4P will be sent to room CMSC-019.

You could also print these slides directly from the Powerpoint software. The print options are the same.

 

Part II - Using Basic UNIX/Linux Commands

Commands you will use: pwd, ls, mkdir, cd, cat, more, rm, rmdir, mv

Follow the steps below in order. Notice that you are sometimes given the command to use in parentheses. As you move through the exercise, you are given fewer and fewer commands. It's time to think! Use your class notes as a reference. And make sure to take your time and really understand what you are doing.

Creating a Directory Hierarchy (Tree) To Use During the Semester

  1. Log into your gl account.
  2. Look at the name of your home directory (pwd).
  3. Look at the contents of your home directory (ls). It should contain the following subdirectories:
  4. Mail News bin

    (There may be additional files and subdirectories.)

  5. Look at the "long" contents of your home directory (ls -l). You should see the same subdirectories, but with more information about each.
  6. Create a subdirectory called CS104 (mkdir CS104). Verify that it has been created by again looking at the contents of your home directory.
  7. Move into the CS104 directory (cd CS104). Verify that your current directory is now indeed CS104.
  8. Create eight new subdirectories, one for each of the eight projects that you will be doing in this class. Call them Project1, Project2, ... Project8. Verify that each of the subdirectories has been created.
  9. Move your mybio.txt file from your home directory into the Project1 directory (mv ../mybio.txt Project1). Check to see that it is no longer in your home directory (ls ..). Now check to see that it is in the Project1 directory (ls Project1).
  10. Move back to your home directory. Verify that your current directory is now indeed your home directory. (pwd)

 

More Practice With Directory and File Commands

You should be back in your home directory. If you are not, move to it before beginning.

1. Create a subdirectory named "Myfiles". Verify that the subdirectory exists.

2. Move to the "Myfiles" directory. Verify that you are there.

3. Use the pico editor to create a file called "sam.txt". The contents of "sam.txt" should be as follows:

I am Sam. Sam I am.

Do you like green eggs and ham?

Save the file and exit pico.

4. Look at the contents of the current directory. It should contain just the "sam.txt" file.

5. Display the contents of "sam.txt" on the monitor (cat sam.txt OR more sam.txt).

6. Move back to your home directory. Verify that you are there.

7. List the contents of the "Myfiles" directory. It should contain only "sam.txt".

8. Create another subdirectory under your home directory called "Morefiles". Verify that it exists.

a. Copy the file "sam.txt" from "Myfiles" to "Morefiles" (cp Myfiles/sam.txt Morefiles).

b. Look at the contents of the "Morefiles" subdirectory. It should now contain "sam.txt".

9. Try to delete the "Myfiles" subdirectory (rmdir Myfiles). You will get a message that the directory is not empty. You must delete all files and subdirectories from a directory before deleting the directory itself. So,

  1. Delete "sam.txt" from "Myfiles" ( rm Myfiles/sam.txt ).
  2. Look at the contents of "Myfiles" to make sure that it is empty.
  3. Delete the "Myfiles" subdirectory ( rmdir Myfiles ).
  4. Look at the contents of your current (home) directory to make sure that "Myfiles" has been deleted.

10. Move "sam.txt" from the "Morefiles" directory to your current (home) directory

( mv Morefiles/sam.txt . ). (Don't forget the period!)

  1. Look at the contents of your home directory to be sure that "sam.txt" is there.
  2. Look at the contents of "Morefiles" to be sure that "sam.txt" is no longer there.

11. Delete the "Morefiles" subdirectory.

12. Delete "sam.txt".

 

Be sure to logout completely when you have finished.