Helpful information and tutorial for new MoCoSIN users

Accessing the Computer Science Laboratory

During construction of the new academic building, the Computer Science lab is located in Room 123 in the basement of the Collier Hall of Science. No food or drink is allowed in the CS lab. Everyone with permission to use the lab should know the combination; do not prop open the door, or share the combination.

You can sit down at any of the Sun workstations 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. If you have problems with the computers, contact Myron Kowalski (the MoCoSIN network administrator) or one of the CS faculty. Myron's office is 125 Collier, and his email address is myron@cs.moravian.edu. His job is to keep the network and computers running, though, not to help you design or debug programs...

All of the Sun workstations 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, a direct ancestor of Java.) 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. If you have an account on the CIT computers, you will have a different username and password in the CS lab. Do not share your password with anyone.

The Suns use a graphical user interface (GUI) called the Common Desktop Environment (CDE), which is based on X Windows (developed at MIT). 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.

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 a menu of choices. Click on "Desktop Introduction".

Follow the tutorial 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.)

Netscape and the World-Wide Web

Netscape may start automatically when you login; if not, move the mouse away from any windows or icons, hold down the right mouse button, and choose "Netscape". (The right button is usually used to access menus.)

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. Here are some interesting sites to explore:

 
Google search engine to find other sites
Amazon Books bookstore with online book reviews
MapBlast street maps for addresses in the US
StockMaster current prices for stocks and mutual funds
Vote Smart voting records for elected officials

CS Lab Computers and Printers

If you haven't already, look at the different models of Sun workstations in the CS lab. All of the computers are on a network with a very fast server which has software and user files, so you can access your own files and configurations from any machine in the lab. Each computer has a name; if you have problems, be sure to tell Myron or a faculty member which machine you were using.

By now you'll probably also have recognized a few familiar names among the computers. Since its inception, almost all of MoCoSIN's computer names have been taken from the Batman comics series.

There is one printer 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 the 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.

Other Useful Programs

Look at the various menus and submenus of applications and tools (which appears when the mouse is over the background and you press the menu button). There are a variety of programs you may find useful. If you went through the tutorial, you've already used the File Manager and Text Editor. For example, there are clocks, calendars, calculators, word processors, and drawing programs.

You should use folders (also known as directories) to keep track of your files; for instance, you should have a folder for your Computer Science 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.

The Korn Shell

There is a common tradeoff in computer science; often there is a difference between programs that are easy for occasional users to learn and use, and programs that are flexible and powerful for frequent users. GUIs (Graphical User Interfaces) are useful for some purposes, but for other purposes it may be faster and more effective to use a command-line interface. This requires a bit more expertise, but often makes it possible to do things you couldn't do with a GUI. 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.
 
Start a shell window (also called a terminal window, since it is similar to old fashioned terminals) by holding 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!

As a side note, be sure to check out MoCoSIN's Remote access page for instructions on how to access your MoCoSIN shell account from anywhere in the world!

Reference Manual

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!

The first, and perhaps most useful, Unix command you should know is man, which is used to find and display pages from the online reference manual.

Type man, and hit return; you should see a short usage message like this:
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. (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.
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 are for advanced users. 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.

Changing Your Password

One thing you should do now, and at least once a semester in the future, is to change your password. Your initial password probably isn't very easy to remember, so choose another password that is easy for you to remember but not easy for someone else to guess. Your password must meet the following requirements:
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 Myron and include the exact error message (you should be able to copy and paste it from the shell window into your email message).

Manipulating Directories

Files are stored in a tree-like structure of directories (also called folders). All of your files are stored in your home directory, and by default the shell programs start running in your home directory.
Type pwd (which stands for print working directory) to see what the current directory is.
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.
Type 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.) 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.

Manipulating Files

Go to your home directory, and use the ls command to print a list of files and directories in a particular directory. Depending on which tutorials you completed, and what else you've been doing with your account, there may be a variety of files in your home directory. If you type ls and nothing appears, there are probably no files in the directory.
The ls command accepts an argument to specify that you want to list the files in another directory; type ls temp to see the contents of temp, for example. ls also accepts options to specify what sorts of information to display about each file, so that you can see how big the file is, when it was created, who can access it, etc; check the man page if you're curious...

Usually you will use a text editor to create files containing programs for homework assignments. You may use any text editor on the system, but the one called nedit is easy to use and includes some special features to help programmers. It can be started from the command line by typing nedit, and  it may also appear in a menu.

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. Don't create files with names that contain spaces (such as test 1) since you will trouble using them at the shell prompt. (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 to 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.

Summary of Commands

In this lab you've been introduced to the following commands; remember that you can read the manual pages to learn more about them:
 
Command
What it does
cd
change the current working directory
cp
copy a file
grade
list or turn in an assignment
ls
list files
man
look up topic in online manual
mkdir
make a new directory (or folder)
mv
move a file
passwd
change your password
pwd
print working (current) directory
rm
remove a file
rmdir
remove a directory

Email

To read and send electronic mail (email) you can use Netscape (which has a separate mail window), or the Mail Tool ("Mailer") in the Programs menu. In either case, your MoCoSIN email address is simply your user name followed by @cs.moravian.edu. This email account is different from your CIT account, if you have one. However, it is possible to automatically forward mail from one account to another account. Once you've learned how to edit text files, Myron can tell you how to forward mail from your Unix account; CIT has a policy of not forwarding e-mail to anywhere else, including MoCoSIN.
To use the Netscape mail program, you need to change your default email address. Go to the Edit menu in Netscape and select Preferences. Click on the triangle next to Mail & Newsgroups, and then click on Identity. Add "@cs.moravian.edu" to your user name in the field labeled Email address. For example, if your username is someuser, your email address will be someuser@cs.moravian.edu. Leave the Reply-to address field empty.

Of course, the Netscape program can't be accessed remotely, so if you plan to use your shell account from somewhere else, you should check out the pine program, which is an easy and fast way to read mail remotely.

General Advice

Computers and programs are always changing; old programs are ``improved'', and new programs are developed which adapt the best features of previous programs. Thus, one aspect of ``problem-solving'' in computer science is figuring out how to use unfamiliar programs or features. (In most cases, a computer ``expert'' is simply someone who has encountered your problem many times.)  Please make an honest effort to solve problems on your own before seeking help. When you ask for help, describe how you tried to solve the problem on your own; the more information you provide, the more help you will get. If you haven't bothered to read the documentation, you may not get much sympathy when you ask for assistance.

Where to Find More Information

One of the great things about Unix systems is the availability of vast amounts of useful documentation about their minutest detail, and at every level of expertise. Programs like man and info are a great place to start, and can be supplemented by searches on the Internet. Also, don't neglect the other documents in the ``Useful Local Documentation'' section of the MoCoSIN homepage; they contain some particular information you just can't find anywhere else.

Summary

So far, so good! Depending on your prior experience, and how much time you spent in the tutorials, you should have a basic idea of how to get around on the Suns. There should be a Logout or Exit command on a menu somewhere, or an EXIT sign on the toolbar; it's a good idea to wait until you see a new login prompt to be sure you're no longer logged in. 

This page was written by Clif Kussmaul, and is now maintained by Myron Kowalski, myron@cs.moravian.edu.