Completing your Coursework on Linux

These instructions assume that you have already activated your CS account.

  1. Login to one of the Linux workstations.
  2. Create folders for your coursework.
  3. Create documents using LibreWriter.
  4. Create Java projects using Eclipse.
  5. Run Java programs from the command line.
  6. Logout when you're done.

Login to one of the Linux workstations

See CS Instructional Labs page for room numbers.

    1. Select an open workstation (computer).
    2. Move mouse or type key to wake up the computer and get a login prompt.  If the computer is locked, choose a different workstation.  If there is no other workstation, email lab that there is a computer locked without a user.
    3. Type your CS username and press Enter.
    4. [First login only] choose a desktop environment. This document assumes the Ubuntu (default) desktop is chosen.
    5. Type your CS password and press Enter.
    6. Wait for the chosen environment to finish setting up.
    7. [Optional] Read keyboard shortcuts page for some ideas about what shortcuts are available.

Create folders for your course work

    1. Click the File icon. (2nd from top of left navigation menu)
    2. Click the private folder to open this file folder. (files and folders in private are not visible to other users)
    3. Right-click in the blank space of your private folder.
    4. Select New Folder option to create a new folder within your private folder.
    5. Type cs400 and press Enter to create a folder for your cs400 work.  Create folders for other courses if you like.
    6. Double-click the cs400 folder to open the folder you just created.
    7. Create a folder named programs (to store programming project work).
    8. Create a folder named homeworks (to store your homework solution work).

Create a homework document using LibreWriter

    1. Click the LibreWriter icon. (looks like text document in left nav menu--hover to confirm)
    2. Type the following information at the top of the homework page:
      1. Homework #1
      2. Your name
      3. Your NetID
      4. Homework 1
      5. Due Date and Time. 
    3. Save the file. (Click the Save icon)
    4. Select your private/homeworks folder (that you created earlier).
    5. Type h1 for the name of your file.
      Note: it aids our grading process "scripts" for all students to use the same file names -- trust us, h1 is a good name for this file.
    6. Click the Save button to save the file with this name in the chosen folder.
    7. Export to PDF (this is required for homework submissions)
      1. Re-Open your private/cs400/homeworks/h1.odt file.
        (This is your LibreWriter file in private/cs400/homeworks folder)
      2. Click Export Directly as PDF.
      3. Keep h1 as the file name.  It will save as h1.pdf.
      4. Keep file type as Portable Document Format (pdf).
      5. Click Save to generate the pdf for your homework file.
      6. Check that h1.pdf is in your private/homeworks folder.
      7. Upload your h1.pdf file to your Homework 1 handin folder on Canvas.
      8. Note: any time you make changes to your h1.odt document, you must re-save and re-export to PDF for the changes to be re-published to the PDF format.
    8. Return to this file, double-click to open, and then continue work on your homework assignment document.  Be sure to save often while working on your homework documents.

Create a programming project using Eclipse

    1. Open a terminal window
    2. Type eclipse &
    3. Select a workspace folder  (I recommend ~/private/cs400/workspace)
    4. Create a Java Project named prep2
    5. Add classes as needed for your project.
    6. Edit
    7. Compile and Run your program

Run a Java program from the command line

Try It! You'll Like It!

  1. Open a terminal window
  2. cd to your program project's folder if it is already written (linux command is:  cd ~/private/cs400/workspace/prep2/ )
  3. If you must edit your program source code, try one of these editors
    1. pico (very easy to use)
      pico MyProgram.java
    2. nino (also easy to use)
      nino MyProgram.java
    3. emacs (many like this editor)
      emacs MyProgram.java
    4. vi (or vim - my personal favorite)
      vi MyProgram.java
      You will need to learn about modes to use vi - here's a tutorial to help you get started.  Or, google vi tutorial to find many more.
  4. Java programs must be compiled and linked before they can be run.  One command compiles and links all source in the current directory.
    javac *.java
  5. Use Java to run your program with command line arguments.  This example has three command-line arguments (1 2 3).
    java MyProgram 1 2 3

 

Logout

    1. Click the Settings gear icon. (Upper right corner of the desktop window)
    2. Click the Log Out option
    3. Confirm Log Out (Don't lock CS workstations unless you are just going to get printout or to a restroom).