Lab 1 - Hello world

1. Start cygwin

2. Use unix commands to put yourself in a folder for comporg

You probably want to make yourself a directory to hold computer organization labs. Use mkdir to create it and cd to change to it. Stay away from spaces in your file names as unix does not handle them gracefully.

The following commands are useful:

3. Learn to use the vi editor

vi is a very simplistic (read stupid) editor that is very quick and lightweight to use. It is available on all unix platforms.

vi has two modes, insert mode and command mode. In insert mode, everything you type is inserted into the file. You exit insert mode using the escape key. In command mode, each letter you type performs some command. One command you can use is i, which starts insert mode wherever you are in the file.

You can start vi with the command

   vi new-file
Which will create a new file named new-file and start you in insert mode at the top of the new file.

You can also start vi with the command

   vi old-file
Which will open the existing file named old-file and start you in command mode at the top of the new file.

You can also start vi with the command

   view old-file
Which will open the existing file named old-file and not let you save any changes to the file.

The following vi commands are useful:

4. use vi to write hello.c

hello.c should contain the C code for a simple hello world program.

5. use gcc to compile and link your hello program

6. run your hello world program

To run, use the command
./hello.exe

fixing as needed to get it to work

7. change your hello world program to say "goodbye lab"

you may leave once that works