cse332: Laboratory Exercise 1
Becoming Acquainted with Linux

Due: During your lab section (1/20)

The purpose of this lab is to familiarize you with the Linux lab and ensure everyone is able to perform simple operations and compile a basic C++ program. To receive a grade for this lab you must demonstrate to a TA (or myself) that you are able to perform each of the below steps.
  1. Login: Login to a host in the Linux lab.
  2. Create course directories: If you don't already have a directory for course related material, create it now.
    mkdir classes
    mkdir classes/cse332
  3. Add new environment variables: Edit your login script and add an environment variable for this class then source this file to update your current shell environment. Each shell has a slightly different way of defining environment variables and for including commands defined in a file into the current environment. Below I give a table describing each:
    shell
    tcsh and csh bash sh and korn
    Define env. variable setenv CSE332 ~/classes/cse332 export CSE332=~/classes/cse332 export CSE332=~/classes/cse332
    Include in current shell source script source script or . script . script
    Login script ~/.cshrc ~/.bashrc ~/.profile
  4. Create lab directory: Create a new directory for this lab and change the current working directory to this new directory (i.e. cd into the new directory):
        mkdir $CSE332/lab1
        cd $CSE332/lab1
      
  5. Common tools: Demonstrate proper use of the following tools:
  6. Create a simple C++ program: Write a simple C++ program that prints the string "Hello World".
      #include <iostream>
    
      int
      main (int argc, char **argv)
      {
        std::cout << "Hello World" << std::endl;
        return 0;
      }
    
      g++ -Wall -o hello hello.cc
    Then execute the program you just created by typing its filename at the shell command line (notice that I generally include the absolute path to the executable):
    ./hello
    Be able to explain the purpose of each command line option used for g++ (use the man pages).