Good, you got here. Now continue.
4. Create Terminal windows by clicking with the right mouse button on the "desktop" (the blue background) and selecting "Open Terminal".
5. Become familiar with the mouse now. Click with the left mouse button to select windows. Experiment with moving windows around, changing their size, raising them (so that they seem to be on top of the other windows, in the places where they overlap), and directing the "focus" (which controls the window where your typing goes).
6. Move your mouse to the Terminal window and change your password by typing "passwd" at the prompt. (Answer yes to the "authentication" question, if asked). Why does it prompt for your old password first? Why does it ask for your new password twice?
7. To create and modify your computer programs you will have to use an application program called an "editor". You can use any available editor you like, but a nice one to start with is called "nedit". Type "nedit welcome.c" in a Terminal window to begin editing a new file called "welcome.c". (Click "create" in response to the message telling you "welcome.c" does not exist.)
8. Here is a little C program:
#include <stdio.h>
int main() {
printf("Welcome to CSC 180.\n");
return 0;
}
Type this in as the contents of welcome.c, save the file by pressing
<control>-s (on the keyboard), and exit nedit by pressing
<control>-q (for quit).
Pay attention to all of the punctuation symbols in the program; they
are crucial. For one, note that there is a difference between the
"curly braces" (set brackets) and the parentheses.
9. The "cat" command is the easiest way to display a short file on the screen in unix. Type "cat welcome.c" to see your new file. To display long files, you can use the command "more", as in "more welcome.c". Even better, use the command "less", which allows you to scroll backwards through the file. ("more" allows forward scrolling only.) To see a list of your files so far, type "ls" (the letter "ell", not the number one). To see a more detailed listing, type "ls -l" ("ls" stands for list).
10. To get a printout of your welcome.c file, enter one:
lpr -Psf1012 welcome.c
or
lpr -Psf1013a welcome.c
or
lpr -Psf1013b welcome.c
or
lpr -Psf1106 welcome.c
depending on the room that you are working in. Note that room SF1013
has two printers, with labels A and B.
11. To translate your C program into a machine language program that you can run, you need to execute the C compiler, which is named "gcc". Type "gcc -Wall welcome.c". Note that capitalization matters in Linux. If you do not get any error messages, you will now have a compiled version of the program in a file named "a.out". Type "ls" to check. If you do get error messages, go back to step 8 and make sure that you entered the program correctly. (It is also possible to get warning messages, instead of error messages. In that case the file a.out is created, but the compiler is warning you to take another look at something unusual in your program. Adding the option "-Wall" tells gcc to check your program for all the warnings it can.)
12. Run the welcome program by typing "./a.out" (Note that this is a "forward slash" -- MS-DOS's use of the backslash here is idiosyncratic). If you simply type "a.out", it may or may not work; more about this at a later date. The "./" in front of the file name indicates the file a.out located in the current directory (called a "folder" in Windows).
13. You can save the output from your program in a file by using the greater-than symbol; think of it as an arrow. Type "./a.out >x" to "redirect" the output to a file named "x". Type "ls" to see a list of all the files you now have. Type "cat x" to see the contents of the file "x".
14. Type "mv x welcome.out" to rename the file "x" to "welcome.out". (If you're wondering, "mv" stands for "move".) Then try typing "ls", "cat welcome.out", and "cat x". Now type "cat wel" and then press TAB; then type "o" and press TAB again. This is called "file name completion", and it can be quite handy! Type "rm welcome.out" to delete the file ("rm" stands for "remove".) Type "ls". Also try the copy command "cp" which is like the "mv" command except it creates a new, duplicate, file.
15. Now create a new directory called lab1 by typing "mkdir lab1". Display a detailed list of your files with "ls -l" and notice the "d" in the first column of the output. It indicates that lab1 is a directory, not a regular file. Copy welcome.c to the new directory with the command "cp welcome.c lab1/welcome.c". Now move to the new directory with the command "cd lab1". ("cd" stands for current directory.) Now type "ls". To return to the "parent" directory, type "cd .." (The symbol ".." always indicates the directory that is one higher in the directory structure than where you currently are.) We think of the original directory as "above" the directory lab1 because lab1 is located inside the original directory -- which is also called your "home" directory. To ask which directory you are currently working in, type "pwd", which stands for "present working directory".
Note that creating separate directories to contain files associated with separate projects (or homeworks) is a nice way to stay organized!
Also, creating a directory called "trash", and moving unwanted files there, is safer then deleting unwanted files. (It is very easy to make a typing mistake and delete the wrong thing. This system helps protect against such mistakes.)
16. Open welcome.c in nedit again. Now check out some of its menu options. For example, you can search for text in your file by pressing [SHIFT]<control>-F, or you can search for a particular line number in your file by pressing <control>-L. You may find this useful in the future; when gcc gives you compiler errors, they will include line numbers.
17. Next we'll set some default preferences in nedit that make it nicer for writing programs. Select "preferences" and then "default settings". Next select "tabs" and set the tab spacing to 3. This will make your programs much easier to read than they would be with the original setting of 8 spaces. (Hint: I really mean it. Please do this. Your TA's will appreciate it, and you want to keep them happy!)
Next select "syntax highlighting". This causes nedit to colour-code various parts of your program, which also makes your code more readable. Finally, select "show line numbers". These two preferences are suggested, but optional.
You may have to exit nedit and re-start it before these preference settings take effect.
18. As with editors, there are several available e-mail reading programs. The mail reader called "pine" is a good but simple one. Type "pine" to start it. Beware its habit of displaying important messages at the bottom.
Your own e-mail address consists of your username, an 'at' sign, and then "ecf.utoronto.ca". For example, if your username is "betty", then your e-mail address is "betty@ecf.utoronto.ca". Compose and Send an e-mail message to a friend. (Type "C" to start the composition step.) Read an e-mail message sent by a friend.
If you also have a different email address (outside ECF), it is possible to have all the email you receive in your ECF account "forwarded" to your other address. Some people like to do this so that they can read all their email in one place. Others like to keep separate email addresses for separate purposes. To learn more about how to do this, follow these links starting at our course webpage: ECF => Engineering Computing Facility => Using E-mail.
19. Now explore the course website (ccnet). Log in as a student by following the Students menu item.
If this is the first time you have logged into this site, click on the link marked "Click here to register." Choose a password, fill in the registration form, and click on "Register." Note that your ccnet account for the course website is different from your ECF account. You may use the same password or a different one. Your password should always be something you can remember but others will not be able to guess.
Assignments, assignment solutions, and tutorial notes will be posted as Course Handouts as the course progresses. Note that most of these handouts will not be available to the public, so you must be logged in as a student to access them. Similarly, you will be able to view your own Grades when logged in, but they will not be accessible to others. Announcements about the course can be seen by following the Announcements link.
20. The bulletin board on the course webpage is a facility somewhat similar to e-mail except that the messages are not personal; all messages that are posted are available for everyone in the course to read. To read messages or post messages to the bulletin board, log into the course webpage and then click on "Bulletin Board."
Do not post a test message. Wait until you have something interesting to say and then post it.
The bulletin board does not have any official status, and your course instructor may or may not have time to read it or to respond to messages there. But it can be a useful resource for students to help each other, and your course instructor will read it as time permits.
21. There is a lot more that you could learn today. If you have time, play around and see what you discover.
22. Follow the ECF link on the course web page and learn more about ECF.
23. When you are done with the computer, don't forget to "Log out". If you don't log out, then whoever next uses the computer has access to your account, your files, and your email. On the other hand, if you come upon a computer on which someone has forgotten to log out, you must log them out and log in as yourself. You can log out by clicking on "Actions" at the bottom left of your window and selecting "Log out".
By the way, you must never turn off the computers in any of the ECF labs when you are done. According to the ECF website, this can damage the software on the disk.