"

Lab #1: Getting Started with Linux

Linux & Vim Lab #1 – Exercises

BEGIN HERE for LAB #1

This phase of Lab #1 has you learn how to login and enter a program. These instructions will also help you prepare when it is time to submit programming assignments to D2L. All steps should be completed! Pay close attention to the instructions

  1. Get set up to use the lab system
  2. Learn how to create and submit programming assignments for this course
  3. Become familiar with the linux operating system

Getting Starting with LABS:

  1. Power-up your computer
  2. Connect to PSU’s network (PSU or PSU Secure) using your CS login and password
  3. PC using Windows:
    1. Install ssh or putty
    2. Double click on the ssh or putty icon
    3. For putty, experiment with different colors and text sizes (Window – Appearance)
    4. Use Host name of cs162lab.cs.pdx.edu if you are in CS162. Otherwise, use the appropriate host name for your class.
      • CS162 labs will use cs162lab.cs.pdx.edu
      • CS163 labs will use cs163lab.cs.pdx.edu
      • CS202 labs will use cs202lab.cs.pdx.edu
      • CS299 labs will use cs299lab.cs.pdx.edu
    5. Open a session and login
  4. MAC OS X Only:
    1. Open Finder and navigate to Applications.
    2. In Applications, navigate to Utilities.
    3. Find Terminal and double-click it.
    4. Use Host name of cs162lab.cs.pdx.edu if you are in CS162. Otherwise, use the appropriate host name for your class as described earlier.
    5. Once you have a Terminal open, simply type (using the correct host:
      ssh username@cs162lab.cs.pdx.edu
  5. Linux Only:
    1. Open Terminal (control t on PSU’s chromebooks)
    2. Use Host name of cs162lab.cs.pdx.edu if you are in CS162. Otherwise, use the appropriate host name for your class as described earlier.
      • CS162 labs will use cs162lab.cs.pdx.edu
      • CS163 labs will use cs163lab.cs.pdx.edu
      • CS202 labs will use cs202lab.cs.pdx.edu
      • CS299 labs will use cs299lab.cs.pdx.edu
    3. Type at the linux prompt based on the class you are in:
      ssh username@cs162lab.cs.pdx.edu
  6. Navigate to the directory for the first lab
    • CS162 Students: cd CS162/Lab1
    • CS163 Students:cd CS163/Lab1
    • CS202 Students:cd CS202/Lab1
    • CS299 Students:cd CS299/Lab1
  7. Now, create a program get familiar with a linux editor, C++ compiler that we will be using, and how to run a program. Enter in the following program using one of the following editors:
    • CS162 students may use: nano, pico, vi, vim or emacs
    • CS163, CS202, and CS299 students need to use: vi, vim or emacs

Start by editing a C++ file: nano cs162_lab1.cpp

Type in the following sample program using a linux editor

//My name:_______________
//Sample program to get familiar with linux
#include <iostream>
using namespace std;
int main()
{
 //Output a message to welcome the user!
 cout << “Welcome to Computer Science!”;
 return 0;
}
  1. When done entering the program, save your work.
    • We recommend saving work frequently
    • Start small and incrementally build your programs
    • Never write more than a single function without compiling and running your program!
  2. Compile your C++ source code file. “No news is good news!”
    g++ cs*_lab1.cpp
  3. If there are errors, use the editor again to modify your program
  4. Once the errors are corrected, save your work and exit the editor
  5. Re-compile your C++ program: g++ cs*_lab1.cpp
  6. Once there are no compile errors, run your program by typing:

    ./a.out

  7. Submit your program by typing ./submit from the Lab1 directory

 

Next… Learn about Assignments!

 

License

CS Linux & Vim Manual Copyright © by Karla Fant. All Rights Reserved.

Share This Book