(Updated: 2007/01/15)

CPSC 101 Lab: Getting Started

Last updated by: Michael Chiang (mchc at cs dot ubc dot ca)

Comments to: Steve Wolfman (wolf at cs dot ubc dot ca)

 


Sources and contributions: Some of the lab materials were taken from the CPSC 100-101 lab manual. The first version of this lab was created by Shelly Zhao. Revisions were made by Tanya Ellchuk, Holger Hoos and Steve Wolfman.

 


Contents

 


Objectives

The purpose of this lab session is to acquaint you with basic things you should know to do when using a computer to create documents or explore the web. You will learn how to interact with different elements of the Graphical User Interface (GUI). These include icons, windows, menus, files, folders, documents, and applications. The main activity of the lab will be to create a simple document about you and your interests. The lab covers the following topics:

 


Before the Lab

Read through all of the lab instructions prior to your lab session. Fully understand the lab etiquette described below. Chapters 2 and 3 of the textbook provide useful background.

 

Lab Etiquette

Things you should do:

You will not hurt or damage the equipment through normal use.

Things you shouldn't do:

Getting Comfortable

Long sessions with the computer can cause you physical discomfort or even harm if you're not careful. Learn how to take care of yourself by reading up on how to get comfortable while using the computer (also known as ergonomics).

 


During the Lab

 

Start the Computer

Before you begin work, you may need to swtich the computer on. As each lab computer is shared by all account holders, you must first log in. If you already have an account, enter your username and password in the login dialog box. Keep your password a secret!

If you don't have an account yet, the following section will show you how to set one up.

 

Create an Account

In the initial menu, choose any one of the UNIX machines (those marked with an "X" on the left hand side) by double clicking on its name. As you don't yet have a login id, at the log in prompt, type getacct. Follow the instructions on screen. You will be prompted to enter your student number and last name and will then be asked to create a password. The password should be 8 characters long. Once this process is complete, you can log out, and use the username and password you have just created to log into the Windows environment, as opposed to UNIX as done before. (Making a good password can be challenging! Check out the References section for more information on passwords.)

IMPORTANT: The login ID assigned to you by 'getacct' then forms your UBC computer science email address, please make note of this. For example, if your login ID is "r2d2", then your new email address is "r2d2@ugrad.cs.ubc.ca", without the quotation marks. Remember this ID, and keep you password safe! You will need both of these everytime you log in.

 

Logging out of your account

To log out of your account when you are finished, click the start button at the bottom-left of your screen and choose shutdown then log off in the next dialog. A more visual description is available here.

 

Use Notepad to create a text file

A file is a collection of bytes stored as an individual entity. All data on disk is stored as a file with an assigned file name that is unique within the folder (directory) it resides in. Different types of files are used for different purposes. A text file is a file that contains only characters meant for displaying and formatting text. In this lab we will create a simple text file using Notepad.

Open Notepad: click , , ,

Type the following information about yourself into the document:

After finishing all the input, click File from the menu bar, choose Save or Save as,

 

Next choose disk/drive Z in the Save in box, and click on the Create New Folder Icon , type lab0 and press enter.

 

There should be a folder called "lab0" now. Double click on this folder to open it and type lab0.txt as your File name. Then click Save.

Close the file by choosing File -> Exit, if it asks "Do you want to save the change?" Click Yes.

Find the "My Computer" icon on the desktop.  Double click on My Computer, find Disk Z, make sure there is a folder "lab0" that has a file lab0.txt in it. If not, you need to create the file again.

IMPORTANT: Please note Disk Z represents the storage space you are allocated with the creation of your computer science account. Aside from what you place in this space, administrative files will also exist (which you should not remove/alter).

 

 

Create directories (folders)

In a graphical user interface (GUI), a folder holds data, applications and other folders. Folders were introduced on the Xerox Star, then popularized on the Macintosh and later adapted to Windows and UNIX. In Unix, DOS and Windows 3.1 (an old Windows), a folder is known as a directory, and a subfolder (folder within a folder) is a subdirectory. (Folders aren't the only metaphor for arranging information, however! Check out the References section for more information on Flickr and tagging.)

Windows Folders:
Folders on the hard disk are pictured as manila file folders, but they are not fixed in size and can hold as much data as there is room on the entire disk.

You can use My Computer in future labs when you will need to create folders (directories).  As described above, double click the My Computer icon, double click Disk Z.  All file and folders that belong to your home directory will be displayed.  To select a directory to see its contents, double click on it.  To create a new directory, click on the File menu, select New, then select Folder and give your new folder a name.  To rename an existing folder, select it (by clicking on it once).  Once selected, you can do one of the following:

and enter the new name for your folder.  You can also use Windows Explorer to view, rename, or delete your files, as well as create new ones.  To open Windows Explorer click  Start  --  Programs  --  Accessories  --  Windows Explorer

 

 

Open a new file or existing file

Open a new file:

Open an existing file:

Tip: To open a document you've used recently, click History on the Places Bar in the Open dialog box.

Now, open the file lab0.txt you just created, and add more content by answering each of the questions listed below.  Each question will need to be started with a separate paragraph. Press the "Enter" key at the end of each paragraph. Don't worry about the format of the file; we will take care of it in later labs. Remember to save the file after finishing each paragraph. See the next section for how to save a document as you work.

Answer the following to add content to your lab0.txt file:

 

 

Save files

 

Locate a folder

When you open or save a file, you can locate a folder in the following ways.

To Do this
Go to any location available from your computer Click a drive, folder, or Internet location in the Look in box (Open or Insert dialog box) or Save in drop-down list box (Save As dialog box).
Create a new folder Click Create New Folder .
Open a folder in the folder list Double-click the folder.

 

Close files and applications

To close a file, choose File on your application's menu bar, and choose close in the pop-up menu. Ctrl-F4 has the same function in most applications.

To close an application, choose File on your application's menu bar, and choose Exit in the pop-up menu. Alt-F4 has the same function in most applications.

In some applications, there may not be a close, you can always choose Exit after you save.

You can also click the icon on the top right of your window to close an application or a window.

 

Internet basics

Several web browsers are available on this system, including Mozilla/Firefox, Netscape, or Internet Explorer (IE). The following steps are written for Mozilla/Firefox, but are applicable to other browsers. For the purposes of this lab, choose Firefox (located on 'desktop').

 

UNIX introduction and SecureCRT

We won't learn Unix in this course, however, we may need to use some of its features through our labs. If you are out of time to do this in the first lab, don't worry - you know where to find the information when you need it. Here is what you need to do.

SecureCRT

SecureCRT (found by clicking on Start) will enable you to work in the Unix environment while still in Windows. Your lab TA will help you set up the connection for the first time.

When you first open SecureCRT you will most likely see the following:

If you see

instead, pressing the right mouse button on the word Sessions and selecting Quick Connect from the shortcut menu that pops up should give you the following

Changing the protocol to ssh2 will change the window to reflect the first Quick Connect window shown.

Alternatively, you can select Quick Connect from the File menu to get the windows described above.

Once you have a Quick Connect window open, change the Protocol to ssh2;  the content of the window should change.  Complete the fields to reflect this sample below:

Press OK when you are finished.  Make sure that you save this session; otherwise you will have to go through this process each time you open SecureCRT.

You will need to provide your username and password again to login to the server. They are the same ones you use to login to the PC.

 

Unix commands

Just as in Windows, we can organise our folders and files in UNIX. However, instead of dragging and dropping items in and out of different explorer windows, in UNIX we make use of the command line, where specific commands are available to perform the aforementioned tasks.

> Viewing files and directories

Type the following at the xterm window:

ls -l

then the following information might be displayed:

    -rw-r--r-- 4 a1a1 guest 9512 May 10 15:21   banner.gif
drwx------ 1 a1a1 guest 512 May 13 09:59   document
-rwx------ 1 a1a1 guest 5275326 May 27 15:53   emacs
-rw------- 5 a1a1 guest 11512 May 28 15:28 hello.cpp
-rw-r--r-- 4 a1a1 guest 512 May 19 15:27   homepage.html
drwx------ 1 a1a1 guest 25194 Jun 16 09:59   temp

If you want to learn more about what the output means, try typing ls --help or man ls. The man command (short for "instruction manual") can also give you help on other commands. Try man for more information!

NOTE: "ls" is an important and often-used command. For example, whenever you have modified the contents of a directory (e.g. added a new file), and want to confirm that the modifications were done correctly, the "ls" command can help you check this.

> Making and removing directories

The Command "mkdir"

As you start a new project, you might need to create a new directory for storing files. To make a new directory, use the make directory command, mkdir. The directory will be created as a subdirectory of the current working directory. If you want to create the directory "cs101" inside your home directory, then while you are in your home directory, you should type:

mkdir cs101

Unix makes a new directory named "cs101", located in your home directory.

The Command "rmdir"

To remove a directory, you use the remove directory command, rmdir. The command name is followed by the name of the target directory. For example,

rmdir ~/cs101

will remove the "cs101" directory located in the home directory. If the target directory contains files or subdirectories, rmdir will display the error message:

Directory not empty

Sometimes rmdir will report a more cryptic error, such as:

rmdir: cs101: File exists

You must delete all the files and subdirectories in the target directory before removing the directory.

> Copying, moving and removing files

Unix allows you to copy, move, rename, and remove files. You can make a copy of a document before experimenting with format changes. You can move files into or out of a directory, and rename files to better organize them. When a file is no longer needed, you can remove it.

Copying Files

To duplicate a file, use the copy command, cp. The format of the command is:

cp source_filename destination_filename

where source_filename is the name of the original file and destination_filename is the name of the resulting copy.

Moving (or Renaming) Files

To move a file to a different location, use the move command, mv. The format of the command is:

mv source_filename destination_filename

where source_filename is the name of the original file and destination_filename is the name of the file to move to.

Removing Files

To remove a file, use the remove command rm. This command has the following form:

rm filename

where filename is the name of a file you want to remove.

Note: rm is very powerful and permanent; use it with extreme caution. It is difficult and sometimes impossible to recover a removed file in a Unix system!

Click here for a summary of basic UNIX commands.

 


Deliverables

  1. A self-introduction (contents of lab0.txt) post in the CPSC101 WebCT discussion boards.
  2. Keep your lab0.txt file under your lab0 folder/directory.
  3. Your TA may ask you to demonstrate some of the things you've learned in this lab. Be prepared to do so.

 


Resources and Reference Links

  1. CPSC 101 / WMST 201 Course Web Page
  2. The Computer Science Undergraduate Student Web Page: has information about the CS undergraduate program and facilities For problems with your undergraduate account, e-mail help@ugrad.cs.ubc.ca or ask your TA.
  3. You will be provided 30 units of printing quota for the first lab. You can purchase more printing coupons from the bookstore or Copyright.
  4. For more information on undergraduate accounts, printing, and lab availability, check www.ugrad.cs.ubc.ca or ask your TA for details.
  5. Computer Ergonomics:

    Ergonomics is the study of the relationship between people and their work with the goal of designing job tasks, work stations, tools and equipment to fit the physical capabilities of people. Creating a good ergonomic working arrangement is important to protecting your health. Following is a useful link for information on computer ergonomics:

    Cornell University Ergonomics Web: http://ergo.human.cornell.edu/ergoguide.html

  6. Making a good password is a difficult task. The CS department has some advice on passwords. The need for good passwords is often at odds with the human mind's ability to create and recall them, as described in The Strong Password Dilemma by Richard Smith. One solution called biometrics moves toward using people's physical properties (from fingerprints to physical dimensions of the body to voice patterns and beyond). Another solution is to let people create passwords using more expressive media than text.. art to the rescue! For example, Vibha Sazawal did some preliminary work on using doodles for passwords. You should be able to access that last paper from the lab, but you may not be able to get at it from home. (Vibha also works on getting diverse groups of students interested in Computer Science!)
  7. The "folder" metaphor lets us arrange files in a manageable way. (For example, Holger currently has 59088 files in his account. (How did he count them? Check out the "find" and "wc" commands on UNIX.) If he didn't have folders, he'd have to sift through all of those at once! Instead, he has only 91 files and folders in the "root" of his account. The other files are somewhere inside the subfolders.) However, folders aren't the ONLY solution to organizing our data. "Tagging" is becoming more and more popular. In tagging, you define attributes of a file that are important, and you can find the file based on those attributes later. Flickr uses tagging to organize a huge, collaborative database of images. Try finding puppies!
  8. Bookmarks are a bit like files and folders. (In fact, many browsers store their bookmars as files and folders!) So, naturally, there are also alternatives to traditional bookmarks out there. Check out del.icio.us for a huge, collaborative database of bookmarks.