Lab notes for 6/10


Ctrl means press the control key.

Esc means press the esc key (on your emacs card they write M or meta instead of esc)

For example if in the following instructions you see the instruction "type ctrl-x-f" it means while holding down the ctrl key press the "x" key and then the "f" key.


A. Logging into UNIX from the DSH Computer Pod:


            1. Login to a Windows NT computer at the pod.

            2. Start the SSH program.

            3. Click the “quick connect” button.

4. Enter you UNM ID. This is the part of your UNM email address before the @ symbol.

5. Enter your password and hit “enter.” If your password was invalid you will get a “connection closed” message. Talk to a CIRT staff member at the Pod if this happens to you.

6. You should now be in UNIX. Press enter to accept the default terminal type (VT100).


B. Starting a local x server. This is required to run emacs with the graphical interface.

You can skip the x server section and go straight to starting emacs but you will have no graphical support. This means you will not get syntax highlighting or any user friendly menus. All commands have to be issued with key combinations if you don't load the xwin32 x-server before running emacs. You also get no graphical support when you use SSH to run emacs from your home computer.


7. Press the “start” button, go to “Programs,” select xwin23 5 and then press xwin32.

8. Starting xwin32 may obscure the rest of your display. Press Alt-tab to cycle through the programs you have running and select the SSH client. This will return you to the UNIX command prompt.


C. Starting Emacs


9. Type “emacs

10. Type esc-x to go into command mode in emacs, then enter “global-font-lock” and hit enter. This will turn on syntax highlighting.

11. Type ctrl-x-f to open a file or start a new one.

12. You should have the words Find File:/ in your emacs command window. Type the name of the file you want to create or open after those words. Make sure you end the file name with “.cpp” if it you want it to be a C++ source file, i.e. if you intend to compile it into a program.

13. The file you want should now be displayed in the main window.

14. Edit your C++ program.

15. To save your source file type ctrl-x-s.


D. Compiling your C++ program


16. To compile your source file type esc-x and “compile”

17. Emacs will display the default compile command in the command window (“make –k”) replace that with “g++ yourfilename.cpp –o yourprogamname” and press enter.

18. A new subwindow will appear in emacs that displays the progress of the compiler as it reads your source file and generates a machine language file that you can run.


E. Running your program


19. Once the source file has been compiled without any errors you are ready to run it. To do this we need to go to a UNIX “shell.” You can either close emacs (ctrl-x-c) or go to a shell within emacs.

20. To open the shell within emacs type esc-x and “shell”

21. You should see the UNIX prompt in a new subwindow. Type the name of your program. You may need to prefix your program name with “./” This will depend on your individual path settings. Try it with “./” and without and see which works.