1. Windows Essentials
2. Opening multiple windows (applications) at once in Windows
3. Logging onto the UNIX machine, cs, and changing user password
4. Some UNIX commands
5. Email on cs using pine; compose, send, receive, reply, ...
In addition, a homework assignment described at the end of the lab will
help you familiarize with the vile(vi) text editors and Pine mail software
To "drag" an object means to move the mouse pointer over the object, click once with the left mouse button and hold the button down (don't release it), then while the button is still depressed move the mouse. The object is moved with the mouse. We'll see how to move a window by dragging in just a bit.
The title bar at the top of a window has special properties. The three buttons in the upper right corner are used as follows:
Figure (1) - An example of a window (Netscape browser screen)
Figure (2) - Taskbar of Windows
2. Opening Multiple Windows (Applications) at Once
For most of the labs in this course, you will use (at least) two windows at once: a Netscape window similar to the one shown on Figure (1) to see the description of the lab, and a terminal window similar to the the one shown on Figure (3), for writing and running programs and for other activities. You can switch between tasks by clicking the appropriate task button in the taskbar at the bottom of the screen, or by moving your mouse to any portion of the window that you want to use and activating the window by clicking on it.
Figure (3) - Terminal window (Telnet screen)
First, you'll log onto the UNIX machine, cs. Once again, click on the Start button in the taskbar at the bottom of the screen, point to Run to open the Run screen. This screen is shown on Figure (4). At the field Open type:
Figure (4) - The Run screen (e.g., running telent to cs machine)
After you ran the telnet you will get the telnet screen shown on Figure (5).
Figure (5) - Telnet Screen
Figure (6) - Telnet Screen with connection options
You have two options for connecting to the desired Unix machine. If the name of the machine that you are connecting to is appearing in the list, simply click on it and you will be connected to that machine. Please note that the cs machine may appear either as cs or cs.appstate.edu. The second option for connecting to another system is to click on the Remote System tab to get the Connect screen shown on Figure (7).
Figure (7) - The Connect screen from Remote Connection tab
The Host Name is the name of the machine to which you want to connect (in our case, cs). By clicking on Connect button, your computer will try to establish a connection with the requested machine . Once you are connected, you will get a screen similar to the one shown on Figure (8).
Figure (8) - The cs login screen
Type your login name (same as the one you have on the university's VAX system) on cs, press enter, then enter the your password (same as the one you have on VAX) and press enter to open your account on the cs system. Note: if you do not know your username I will try to get it for you.
After you type your initial password, you will be logged into the system and will be asked to change your password. Follow the directions on the screen to change your password. Please note that to improve security of your account, your password should consist letters, special characters such as !,@,#,..., and numbers. A reasonable length for password could is 6-8 characters. Be sure to remember the password that you selected. From now on you will use the new password to login to the system. If you decide to change your password again, type passwd and follow the directions on the screen.
Once you are logged in to cs, you will get a screen similar to
the one shown on Figure (3).
cs)~% or cs.cs.appstate.edu>
We refer to the prompt that you get as the command prompt. From the command prompt you will be communicating with the UNIX operating system by entering your UNIX commands. On some machines, the command prompt will appear with a "$" character at the end.
4. Some Unix Commands
Let's experiment with the commands on the UNIX operating system. Note that anytime you need help with a Unix command, nothing that Type
cs)~% lsto see the list of files in your directory ("ls" stands for "list"). UNIX, like C++, is case sensitive so be careful of the CAPS LOCK key. Most UNIX commands are in lower case.
You'll probably spend most of your online time this term in an editor, writing and modifying computer programs. There are several editors on cs. We will use vile, a derivative of the vi editor. Note that vi is pronounced as an acronym, "V I", not as a word that rhymes with hi. But vile is pronounced like the word that means "evil".
The name "vi" comes from the word "visual" When vi was written it was a big deal to see more than one line of a file at a time, and the name conveys that idea. The advantages of using vi (or vile) are:
Now that you're motivated to use a somewhat rusty editor, type the following at the UNIX prompt:
vile temp.txtNow you have told UNIX to run the vile program to edit a file called "temp.txt". If you already owned a file by that name, that file would be loaded into the vile editor. Since you do not have a file called "temp.txt" already, an empty one is created.
Like UNIX and C++, the vile editor DOES CARE ABOUT CASE and can do truly vile things to you if you're careless with the CAPS LOCK key. So in the following description, if I say type "i" don't type "I".
The vile editor has two modes, insert mode and command mode. If you have the editor in insert mode, then whatever you type becomes a part of the file you are creating. If you have it in command mode, then the letter you type issues a command to the editor. For example, the letter "i" tells the editor to enter insert mode. Press "i" (the letter i without the quote marks). The "i" is a command to vile, but if you were to press "i" again (don't), you would actually enter the character into your document.
You'll have to know whether you're in command mode or insert mode to use the vile editor properly. This is probably the biggest drawback of using vi or vile -- more modern word processors are always in insert mode and use moused menus and hot keys to enter commands. With vi, it is up to you to remember which mode you're in. My favorite thing about vile (as opposed to vi) is that it tells you which mode it is in. Down in the lower left corner of the screen an "I" will appear if vile is in insert mode.
Now that you're in insert mode, type a couple of lines of text. Type something like:
This is my first vile editing session. It's OK so far.When you are finished typing, you need to go back to command mode so you can save your work. Press the Escape key (Esc); this puts the editor back in command mode. Now press the colon key ":". Pressing the colon key causes the cursor to jump down to the line at the bottom of the screen. Now type "wq" (without the quotes). This tells vile to write the file (the w) and quit (the q). If you typed a w by itself, you would cause vile to save the file, but you would not end your editing session. A q by itself would quit the editor without saving the file.
After exiting the editor you should find yourself back at the familiar UNIX "%" prompt. Type "ls" again to see all your files. Added to the list you saw previously should be the file "temp.txt".
Let's make a copy of this file and then list all our files again. Copying a file is done with the "cp" command. You type cp followed by the name of the file you want to copy, then the name by which you want to call the copy. Type (at the UNIX prompt):
cp temp.txt temp2.txt lsWhat do you see? Now enter
mv temp2.txt temp1.txtThe "mv" command stands for the word "move"; it renames a file. We just told UNIX to change the name of "temp2.txt" to "temp1.txt".
We also need to know how to delete files. In UNIX the "rm" command deletes files; rm stands for "remove". If we type
rm temp.*it will delete any file whose first name is "temp" regardless of what its extension is. Try it and then list your files again to see if it worked.
This lab is to teach you:
pineIf this is the first time you've ever used pine, it will ask you if you want to receive a copy of some documentation that comes with the program. Choose yes or no. Then use the arrow keys to select the I FOLDER INDEX menu entry and hit return. Pine automatically opens your INBOX which holds new messages and also old messages that you haven't deleted or moved to another box.
You should have one email message from me. If that is the only email
message that you have, then that one should be highlighted and you can
simply hit return to read my message. If you have multiple email messages,
use the down arrow key to highlight the message from me and hit return.
(If you don't have any mail, you're not on my distribution list -- tell
me and I'll fix the problem.) While you're looking at my message, notice
the bottom few lines of the screen contain information about available
commands. Sometimes there are more commands available than can fit on the
two lines. Enter
Oto get to some of these other commands and then enter
Eto export the message into a text file. When it prompts you for a file name, type
temp.txtThis makes a copy of the mail and saves it in a file called temp.txt. (I tend to use "temp" in my file names if I intend to delete them soon.) We'll come back to this new file later, but now read the mail message and follow its instructions to reply to me. After you've replied to me, type "m" to return to the main menu.
Next, you'll send a message to another student in the class. Look at this list of user ids and send an email to the student whose name follows yours on the list. Then from pine's main menu, choose "c" for "compose message".
In the "To:" field, enter the other person's login name and press Enter. Keep pressing Enter until you get to the "Subject:" field. Always give a brief subject description, since subjects help the recipient find old mail. Enter a subject and press Enter. Then type your message and press "Ctrl-x" (and then "y") to send the message. Try to put enough information in the message that the student you are sending mail to can identify you. Have the student to whom you sent mail show you what the message looks like once it is received. Then type "q" to leave pine.
Now, verify that the export command you issued earlier actually saved the mail message by listing your files (use the
lscommand) and then display the file by entering:
cat temp.txtYou'll notice that this command assumes you have passed a speed reading course! This time enter,
more temp.txtYou'll notice that the 'more' program displays a screenful of text at a time. To advance the display by a single line, press Enter. To advance to the next screenful of text, use the space key. To go back up one screenful, type "b". To quit the 'more' program, type the letter "q".
Let's return to mail -- type "pine" again. It is a good idea to keep your INBOX relatively clean. That way new email messages are easier to spot. So what can we do with email we've read and want to keep? Well, we've already experimented with the Export command. However, pine offers another capability - mail folders. In reality, your INBOX is a mail folder. You can create and manage your own mail folders. Let's create a mail folder for this class. From pine's main menu select "L" for "Folder List". Enter "a" to add a folder to your list of current folders. Enter cs1440 when pine prompts you for a folder name. Use the arrow keys to highlight our new cs1440 folder. Use the Enter key to open the folder. Notice that there are no mail messages in this folder - yet. Return to your INBOX folder (by returning to the main menu, listing your folders again, and selecting INBOX). Now, use the arrow keys if necessary to highlight the email message from me. Use the "o" key to see other commands. Let's use the Save command. This is how you can save a message from your INBOX to another pine mail folder. At the prompt, enter our new folder cs1440. It is important to realize that there are now 2 copies of this message. One in the cs1440 folder and one still in the INBOX folder. However, notice that the INBOX message has been marked for deletion (a "D" is now visible in the third column). When pine exits, it will delete this copy and then there will be only one copy of the message (in the cs1440 folder).
We can delete messages from folders that we don't want by highlighting the message and pressing the letter "D".
By the way, my username is rt. Throughout the term, you can send email to me for help on your programs. (Please don't abuse this! When you want help, send specific questions about specific problems -- don't just send mail saying your program doesn't work and you don't know what is wrong.)
When you're done, type "q" if you're still in pine, then logout to leave cs. At the UNIX prompt, type
logoutand press Enter.
tutorial.vileLeave pine by typing "q" then type. You need to delete some lines that are printed by pine at the top of this file. Use vile to delete those lines:
vile tutorial.vileat the UNIX prompt. Delete the email header lines placed there by pine, by typing
ddwhen the cursor is positioned on top of a line you want to delete. Delete all of the lines up to the
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*Save this file and exit :wq. This file is an important tutorial for vile. You need to read and understand the function of vile.
I will e-mail you a file called sample.C. Use Pine to copy this file to your directory. You need to delete the header of this file using vile.
In order for you to recognize how many lines to delete I have put a
marker at the place where stop deleting the lines. So delete lines up to
Save the file and exit (:wq)
Compile the code by typing % g++ sample.C
Execute the program by typing % a.out
Execute the program and create an output file called samp_out: % a.out > sam_out
E-mail me the sam_out file.