CS 107 Labs, Spring 2003

Friday, April 4

This lab exercise is intended to introduce you to the command-line interface of Unix systems (including Linux). You need not hand in anything for this lab, but you should work through the lab thoroughly enough to make sure you understand the commands introduced. A lot of your work later in the course will be easier if you study this lab carefully.

If you find yourself wondering what happens if you do this or that, by all means try it and see.

Have fun. Let me know if you have questions.

  1. Work through Tutorials One through Three at http://www.ee.surrey.ac.uk/Teaching/Unix/, a collection of tutorials provided by the Electrical Engineering department at the University of Surrey. (You should probably read through the "Typographical Conventions" and "Introduction to the UNIX operating system" sections before starting the tutorials themselves.) Try all the commands that the tutorials introduce. If you have questions that experimentation does not answer, ask them or write them down.

    In Tutorial 2, you will need a file the authors named "science.txt". The tutorial text describes how to obtain and save this file in your account.

  2. After you're done with the University of Surrey tutorials, go to your home directory and create a new subdirectory called "web_pages". Enter the web_pages directory and type "pico example.html". Pico is a simple text editor that you use in your terminal window. To add text, you just type. To move around, use the arrow keys. To save your work, type Ctrl-O. To exit, type Ctrl-X. If you want more information, there's a nice description of pico at http://www.indiana.edu/~ucspubs/b103/.

    Using pico, type the following text into example.html:

    
    	<html>
    	<head>
    	<title>A simple web page</title>
    	</head>
    
    	<body>
    	<h1>This is the heading</h1>
    
    	<p>This is a paragraph</p>
    
    	</body>
    	</html>
    

    Save your file and exit pico.

    Now, launch Mozilla (the dragon icon on the bottom of your screen). Once Mozilla gets around to starting up, go to the File menu, select Open, and find example.html. Select it, and see what happens.

  3. Have a good weekend.

Once you're done with the labs above, you should be at least a little bit comfortable with these Unix commands: ls, cd, pwd, less, rm, cp, mv, mkdir, rmdir, man, pico, and grep.

In case you're dying for more, some other decent Unix tutorials include http://unixhelp.ed.ac.uk/, http://www.math.utah.edu/lab/unix/unix-tutorial.html, and http://www1.appstate.edu/~krb/syllabus/unixtutor.html.

Wednesday, April 9

Today, you'll start learning the fundamental features of HTML. As a first step, let's take the file that you created last Friday (see the discussion of example.html above) and make it available via the web rather than just via your account.

  1. If you do not have a copy of example.html in your account, create one as described in Friday's lab. There are point-and-click editors that you could use in Linux, but I would like you to continue using pico for now. This early practice with the Unix command line will pay off later in the term when we start investigating the Internet with more sophisticated tools.

  2. Make sure you are in the same directory as example.html, and then execute the command

    cp example.html /Accounts/courses/cs107/web-pages/yourusername/

    Note that "yourusername" should be replaced by your user name.

  3. Launch Mozilla and go to http://prism.mathcs.carleton.edu/cs107/yourusername/example.html. You should see the file you just copied.

  4. Use pico to modify your copy of example.html. Add a sentence or something. Make sure to save your changes with Ctrl-O.

    Now pay attention for a second: When you copy example.html to /Accounts/courses/cs107/web-pages/yourusername/, you are making the file available to the entire Internet. Google and other web search tools will eventually find whatever you place in this directory. Therefore, I strongly recommend that you show some discretion about what you say on your web pages, and that you use the rm or mv command to delete or move any files that you no longer want to be in the public space. Your home directory and its subdirectories are not accessible from the Internet, but all subdirectories of /Accounts/courses/cs107/web-pages/ are.

  5. Execute the cp command again. Here's a hint: you can use the up-arrow key to cycle through recent Unix commands, so you won't have to re-type that nasty long command.

  6. Go back to Mozilla and re-load the page.

As you work through the tutorial, experiment with each new tag by using this "Edit-Save-Copy-Reload" procedure. (Why do you think you need to copy the file from your account to the /Accounts/courses/cs107/web-pages/yourusername/ directory? We'll discuss this and many other questions in class on Friday.)

One last thing: as you work through the tutorial, you will see all the tags shown in capital letters (e.g. <HEAD>). For reasons that I will explain Friday, you should use lower case tags instead (<head>).

Now, on to the main event. Work through this HTML tutorial. It's an old one (written in 1995), but it's still an excellent introduction. Many thanks to Eric A. Meyer at Case Western Reserve University for making it freely available.

Friday, April 25

Do this lab on various topics. Have fun.

By Friday, May 9

Do this lab on MySQL and this other lab on MySQL, and bring your questions to class on Friday.