Sit down at any of the computers in the lab; if the screen is dark, hit any key on the keyboard, and the screen should light up. Never attempt to reboot, turn on, or turn off any of the equipment in the CS lab; unlike Macs and PCs, they should be left running all of the time. If you have problems with the computers themselves, see Myron Kowalski (the MoCoSIN network administrator) or one of the CS faculty. Myron's office is 212 Collier, and his email address is myron@cs.moravian.edu. His job is to keep the network and computers running, not to help you design or debug programs...
All of the CS machines use the Unix operating system. Unix was developed in 1974 by Dennis Ritchie and Ken Thompson at Bell Laboratories. (Ritchie also designed and implemented the first version of the C programming language.) One of the main goals of Unix (and C) is to provide a powerful, flexible, computing environment for people who spend a great deal of time using computers.
Unix was designed to support many users with a reasonable level of security; in order for the system to know who you are (and thus what files and programs you can use), you must login by providing a username and password. The CS machines also use a windowing system called X Windows (developed at MIT), but some use a version called OpenWindows, and others use CDE, the Common Desktop Environment. Fortunately, there isn't much difference for our purposes. The newer computers have a graphical login screen, while some of the older computers have a uglier text-based login prompt. In the graphical login, you may have to use the mouse to move the pointer, and click with the left mouse button. (The left button is usually used to select icons, buttons, etc.) Both will prompt you for your password after you enter your username. Unix is case sensitive, so the difference between upper and lower cases letters is important. If you have an account on the CIT computers, you will have a different username and password in the CS lab.
Sharing or copying account information is a violation of the campus acceptable use policy, and will be treated as such.
Once you enter a valid username and password, a variety of windows and icons will appear on the screen. Don't worry if they don't all make sense right away. If you are asked to choose between "CDE" and "OpenWindows", choose "CDE". One of the windows may be a tutorial or introduction to the windowing system. If you don't see such a window, find the icon in the toolbar at the bottom of the screen that has books and a question mark. Click on the arrow above the icon, and you will see a menu of choices. Click on "Desktop Introduction". If your screen doesn't have a toolbar, move your mouse away from any window, click on the right mouse button, and look for a menu entry titled "Tutorial" or "Introduction".
However you get to the tutorial, follow it until you feel comfortable, and refer back to it in the future when you want to find out how to do something new. (If you have used other computers with graphical interfaces before, you may be able to go through this pretty quickly.)
Once the Netscape window appears, you should see the MoCoSIN homepage. If not, select Open and type http://www.cs.moravian.edu. Part way down the MoCoSIN page is a list of the science departments and faculty. Click on Tom Linton to go to my homepage; near the top of my page are the courses I am teaching. Click on CS 120 to go to the course homepage. Near the top of the page, click on Lab 01 to get to another familiar page (the handout you are currently reading), and scroll down until you reach this point in the text. From here on, you can use the electronic version.
If you have never used a web browser before, you should go through the Netscape Handbook, which can be accessed from the Netscape Help menu. You can save bookmarks in Netscape which point to web sites you'd like to go back to; for example, you should probably make a bookmark for the CS 120 homepage. Here are some other interesting sites to explore:
There are two printers in the CS lab, and a few others scattered around the building. Each printer is labeled with its name; there are several different ways to print files, depending on the software you are using. By default, anything you print should go to a printer in the CS lab. Please get help if one of the printers doesn't work; we can't fix problems unless we know they exist.
You should use folders (also known as directories) to keep track of your files; for instance, you could have a folder for this course, and separate folders within it for each homework assignment. It can be hard to keep track of everything if all of your files are in a single directory.
In Unix, command-line interfaces are called shells, and there are a number of different shells you can use. At Moravian, the korn shell (named for David Korn) is the default, but you can use others if you prefer. To start a shell window (also called a terminal window, since it is similar to old fashioned terminals), hold down the menu button (on the right of the mouse), and select Terminal from one of the submenus. You should get a window with a scroll-bar, and a prompt of some sort - it will probably contain your name or the name of your machine. You can type commands at this prompt, and the results will (usually) be displayed in the same window. Note that you can open several different shell windows so that you can work on several different projects at once (large monitors are very useful for this purpose!)
The more frequently a Unix command is used, the shorter its name; it may take a while to remember the commands, but you can type them very quickly. Many of the commands you will be learning in this lab are only two or three characters long; you will probably type them hundreds of times this semester!
usage: man [-] [-adFlrt] [-M path] [-T macro-package ] [ -s section ] name ... man [-M path] -k keyword ... man [-M path] -f file ...
Many (but not all) unix commands have such usage messages; the goal is to remind you how the command works, not to give you an exhaustive description. (Remember, most users already know what the command does, and simply want a reminder of the syntactic details.) Thus you probably won't learn how to use man from the message. Instead, type man man and hit return; we'd like to see the manual page for the man command itself! Read through the man page for man briefly, but don't worry if you don't understand the details; most of them won't concern us in this course. At the bottom of the screen you'll see a line like this:
All of the man pages have a similar format; they begin with a synopsis of how the command is used, followed by a more detailed description, and possibly a list of related files, error messages, etc. Remember that you can always open another shell window if you want to refer to a man page while you're running other commands or editing a file. (There are also graphical interfaces to the man pages if you prefer.)
Most Unix commands accept a series of optional arguments, possibly followed by one or more required arguments; the usage message puts square brackets around optional arguments. Optional arguments are often used to modify the default behavior of the program, so if you want a command to behave in a slightly different way, it's a good idea to check the man page for an appropriate option. The cd (change directory) and ls (list directory contents) commands (described below) will demonstrate this, and you can read their man pages to learn more about them.
Type passwd to change your password; the program will ask you to type your old password once (to prevent someone else from changing your password), and then ask you to type your new password twice (to make sure you haven't made a mistake in your new password). If you can't change your password, send email to me or Myron and include the exact error message (you should be able to copy and paste it from the shell window into your email message).
As of Solaris 2.6, your password must meet the following requirements:
You should see something like /users/clif, which means that /, the root directory, contains a directory named /users, which contains a directory with your user name. Type mkdir temp to make a new sub-directory called temp.
You can use the File Manager to create directories, and do most of the other things described in this lab, but you should learn the shell commands too, since there are times when you'll need to use them instead. Tpe cd temp to change the current directory to the new sub-directory (cd stands for change directory). Type pwd again to see the new working directory. There are several ways to get back to your home directory; you can type cd .. to go from any sub-directory to the enclosing directory, or you can type cd ~ to go directly to your home directory from anywhere else in the system.
Use rmdir to remove unwanted directories, but please don't remove the temp directory yet, and be careful about removing directories if you don't know what's in them. (Feel free to ask about specific files or directories.) Unlike most Macs and PCs, Unix prevents users from deleting directories or files that were created by other users, but you can create serious problems for yourself by removing directories or files in your home directory which are needed by other programs.
Usually you will use a text editor to create files containing programs for homework assignments. You may use any of the text editors on the system, but the one called nedit is easy to use and includes some special features to help programmers, and can be started from the command line by typing nedit. Start a text editor, type something simple, like a favorite verse or quotation, and then save the contents as a file called test1 in your home directory. (Hopefully you are starting to feel comfortable enough to do this without explicit instructions; if you can't figure out what to do, ask for help.) Once you've saved the file you can close the text editor and return to the shell window.
If you type ls now, you should see the file you just created. Use the mv command too move a file (or to change it's name); thus you would type mv test1 test2 to rename your file test2. Similarly, use the cp command to copy test2 to test3. Finally, type rm test2 to remove test2.
There should still be a file named test3 in your home directory, plus whatever other files you've created there in the past.
To let me know that you've finished this lab, please send me an email message and answer the following questions:
I'm confident that everyone is capable of doing well in this class, but it may take some time and effort to develop the necessary skills. By the end of the term, most of the material in these first few labs will be second nature to you.
This page maintained by Tom Linton, linton@cs.moravian.edu