Welcome to Lab 1

By the end of this Lab you should be able to do the following.


Lab Topics

Log on to and off of a Linux workstation

The lab instructor will show you how to log on and off your work station. You will need your regular UNBC login and password.

Simple LINUX Commands

The following are a selection of the most commonly used LINUX commands. This is the minimum list of commands you will need to know for the course.

pwd - return working directory name

The pwd utility writes an absolute path name of the current working directory to standard output.

ls - list contents of directory

For each file that is a directory, ls lists the contents of the directory. For each file that is an ordinary file, ls repeats its name and any other information requested. The output is sorted alphabetically by default. When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments appear before directories and their contents.

mkdir - make directories

The mkdir command creates the named directories.

cd - change working directory

The cd command changes the current directory.

rmdir - remove an empty directory

rm - remove a file

Create a source code file

Comments become more and more important as we go along, so please type in all the comments. Of course you should enter your name as the author, the correct date, etc.

/**
 * HelloWorld is a simple java demo program.
 * 
 * @author Allan Kranz
 * @version 1.0.0.0
 * date 13 Jan 2011
 * name HelloWorld.java
 */
public class HelloWorld
{
    public static void main(String[] args)
    {
        System.out.println("Hello World");
    }
}

Using the Compiler

The lab instuctor will show you how to compile your file. The basic commands are...

javac HelloWorld.java
java HelloWorld

Writing the Report

Your lab instructor will show you how to script your lab session. The basic commands are...

script lab0.script
cat HelloWorld.java
javac HelloWorld.java
java HelloWorld
exit
/opt/scriptfix/scriptfix lab0.script > lab0.clean
enscript -2rG -P csprn3 lab0.clean

Programming Problem

Using your text editor, create file called HelloWorld.java, using the example above, and compile it using the javac compiler and run it in the terminal window. Script your source code and turn it in.