CMPU-101, Fall 2012 Lab 1 Instructions Welcome to the first lab session! You will be given an account name and password in the first lab. Sit down at one of the lab computers. Log into your CS account by typing your username and then your password. During this lab, you will learn the basics of using your computer science account, creating files and directories, and submitting directories electronically. In the directions, names and commands are capitalized for emphasis only. All commands made at the command line (also known as the system prompt) in your cs account are entirely lowercase. ----------------------------- Part One: Your CS account ----------------------------- When the Desktop appears, click on the TERMINAL icon on your TASKBAR (either at the top or bottom of the screen). A blank window with a prompt in the upper left should appear. This is the terminal window. The terminal window acts a lot like DrRacket's Interactions Window in that you type characters at the prompt, press "Enter", and then something happens. In the case of the terminal window, you type "commands" at the prompt. When you press the "Enter" key, the terminal program (the operating system) tries to execute the command you entered. Of course, if you enter something wrong, it may complain. You will first need to change your password to something unique (if you have not done so already). Follow these general password guidelines: - Use a mix of letters, numbers and special characters: (!@#$%^&*~[]{}) - Use mIxED caSE - Avoid dictionary words - Do not set your password to “password”, “changeme”, your username or your actual name - Make sure you memorize your password To change your password from the command line, enter: yppasswd You will be prompted for the old password and then twice for your new one. Here are some other useful linux commands: pwd --- Print the Working Directory (i.e., display where you are in the tree of directories in your CS account). The working directory is often referred to as your "current directory". ls --- LiSt the contents of the current directory. mkdir --- MaKe (i.e., create) a new DIRectory. This command takes one input: a name for the directory you want to create (leave out spaces). cd --- Change Directory. If used by itself, this command returns you to your "home directory" (i.e., the directory where you started out). If you give it an input, it will try to change to the directory you specify. rm --- ReMove file. This command takes one input: a name for the file you want to remove. Be careful with this command, it does not ask if you are sure you want to delete the given file, it just makes the file disappear. mv --- MoVe contents of file to different name. This command takes two inputs, the old and the new file name. cp --- CoPy given file to name specified. This command takes two inputs, the original and the copy file name. When you log in, your current working directory should be your home directory. Try the following commands at the prompt (one at a time, in the order given, pressing enter after each); do not type the semicolon or anything that comes to the right of the semicolon in the lines below--these are just explanations. pwd ls mkdir cs101 ; make a new subdirectory for cs101 files ls ; you should see an entry called cs101 cd cs101 ; change into your new cs101 subdirectory pwd ls mkdir labs ; make a new subdirectory for lab files ls ; you should see an entry called labs cd labs ; change into your new labs subdirectory pwd ls mkdir lab1 ; make a new subdirectory for lab1 (ell-ay-bee-one) ls ; you should see an entry called lab1 cd lab1 ; change into your new lab1 subdirectory pwd Make sure the last character in lab1 is a one and not an ell. After this sequence of commands, your terminal session should be set to a new directory called "lab1". The "path" to this directory should be "~/cs101/labs/lab1". The "~" character stands for your home directory. It is essential that you create a new directory to hold the files for each lab and assignment because only directories can be submitted (not individual files). The directories must be named EXACTLY as specified (i.e., lab1 is not the same as Lab1 or lab01). If you want to "back up" to the "parent" of your current directory, use the following command (note the space and 2 periods after cd): cd .. If you get lost and want to return to your home directory, use the CD command without any inputs: cd It is also a good idea to ask for help if you are really lost. Anything can be undone and redone except if you delete a file, so be careful with the rm command (use it sparingly or with supervision). _______________________ | YOUR HOME DIRECTORY | ----------------------- | ____________ | cs101 | ------------ | ________ | labs | -------- | _________ | lab1 | --------- | lab1.rkt After you are done with this part, you will have created the directory tree shown above in your CS account. You will add new subdirectories as the semester progresses. ------------------------------ Part Two: Using DrRacket ------------------------------ * DOWNLOADING THE LAB STARTER FILE: Go to our course web page at www.cs.vassar.edu/courses/cs101-201301/labs/top where you found these instructions. Under the heading for Lab 1, download lab1.rkt. To save this file in your cs101/labs/lab1 directory, right click on the "lab1.rkt" link, choose "save link as" and navigate to save it in your cs101/labs/lab1 directory. This step is VERY IMPORTANT, so ask a coach or your professor to verify you have done it right. You will create and submit a new directory for every assignment and lab. * OPENING DRRACKET: Meanwhile, back at the terminal window, type the following command: drracket & If you forget to type the & character, then the terminal window will freeze until the DrRacket program is closed. If you include the & character, you can use the terminal window and DrRacket at the same time. Under the "File" menu of DrRacket, choose "Open". When prompted, navigate to your cs101/labs/lab1 directory and select the file "lab1.rkt". The contents of the file should appear in DrRacket's Definitions window. Normally, the definitions window occupies the top half of DrRacket's main window, with the interactions window in the bottom half. However, until you click the "Run" button, the definitions window may be all you see. After you click the "Run" icon, the interactions window should appear with some purple text in it. Follow the directions in the lab1.rkt file (read through the whole file). NOTE: From time to time, you should press the SAVE button so that the contents of the definitions window are saved. The SAVE icon is only visible, on the top left part of the window, after you make a change to the contents of the definitions window. After you SAVE the program, all your changes will have been stored in your ~/cs101/labs/lab1 directory in a file called lab1.rkt. ***IMPORTANT*** Make sure you have a coach or your professor check you off as completing the lab when you are finished and before you exit DrRacket. --------------------------------------- Part Three: Submit your lab1 directory --------------------------------------- Exit DrRacket by pulling down the DrRacket menu and choosing Quit DrRacket. In the Terminal window, make sure that you are in your "labs" directory (the parent directory of lab1) by typing by starting from your home directory and moving into the labs directory by entering the following sequence of commands (don't type the semicolon or anything to the right of the semicolon): cd ; change to your home directory cd cs101 ; change into cs101 subdirectory cd labs ; change into labs subdirectory ls lab1 ; print list of files in the lab1 subdirectory; ; verify your lab1 subdirectory contains lab1.rkt The last command will list all the files in your lab1 directory, so you should see a file called lab1.rkt (and one called lab1.rkt~ -- this is an older version of your lab and is OK to leave there for now.) Your prompt should now end in labs. Enter the following command at the Linux prompt in your labs directory to submit your lab1 directory: submit101 lab1 lab1 The "lab1" is repeated twice in the command above because the first instance tells the submit101 script which folder (on a different machine) all the lab1 submissions should be stored in. The second instance of lab1 is the actual folder you are submitting. After entering the submit101 command, you should see a message confirming a successful submission (DONE) along with a list of files that have been submitted. Now is the time to ask your professor or a coach to verify your submission was successful. Don't log out before you ask either a coach or your prof to verify your submission...they will want to see you submit the directory again. You may resubmit any number of times with no problems. NOTE: The "submit101" command automatically submits a directory to a "dropbox" with your name on it. ***IMPORTANT*** Make sure you have a coach or your professor check you off as completing the lab when you submit the lab and before you logout. ---------------------------- FINALLY... ---------------------------- Be sure to log out of your account before leaving the lab. If you don't, someone else could use your account (or even trash it)!