You should see something like this, called the prompt :

Similar documents
Refresher workshop in programming for polytechnic graduates General Java Program Compilation Guide

Guided Tour (Version 3.3) By Steven Castellucci as Modified by Brandon Haworth

Computer Science 62 Lab 8

Lab 1 Introduction to UNIX and C

Check the entries in the home directory again with an ls command and then change to the java directory:

Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

CSC116: Introduction to Computing - Java

Unit 10. Linux Operating System

UNIX Tutorial One

Introduction to Linux. Fundamentals of Computer Science

CSC116: Introduction to Computing - Java

SECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a

CSE115 Lab exercises for week 1 of recitations Spring 2011

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CSC116: Introduction to Computing - Java

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Tutorial 1: Unix Basics

Setting up your Computer

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

Introduction to Unix - Lab Exercise 0

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

Working with Basic Linux. Daniel Balagué

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

Lab 1 Introduction to UNIX and C

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

Department of Computer Science University of Pretoria. Introduction to Computer Science COS 151

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Java: Comment Text. Introduction. Concepts

Lab Working with Linux Command Line

Essential Linux Shell Commands

C02: Overview of Software Development and Java

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Guided Tour (Version 3.4) By Steven Castellucci

Laboratory 1 Semester 1 11/12

Basics. proper programmers write commands

The Command Shell. Fundamentals of Computer Science

Physics REU Unix Tutorial

Instructions PLEASE READ (notice bold and underlined phrases)

Working with the Command Line

Unit 13. Linux Operating System Debugging Programs

Introduction to Linux Spring 2014, Section 02, Lecture 3 Jason Tang

last time in cs recitations. computer commands. today s topics.

LAB 0: LINUX COMMAND LINE AND SVN

Unix Basics. Systems Programming Concepts

The Directory Structure

The Unix Shell & Shell Scripts

Linux File System and Basic Commands

Programming Studio #1 ECE 190

CS4023 Week04 Lab Exercise

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Java Reference Card. 1. Classes. 2. Methods. 3. Conditionals. 4. Operators

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

ASSIGNMENT 5 Objects, Files, and a Music Player

CSC111 Computer Science II

Unix Tutorial Haverford Astronomy 2014/2015

CS 261 Recitation 1 Compiling C on UNIX

Linux/Unix Filesystems

1 Getting Started with Linux.

Welcome (back) to CS1007!

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Computers and Computation. The Modern Computer. The Operating System. The Operating System

Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation

Linux/Cygwin Practice Computer Architecture

A Guide to Running Map Reduce Jobs in Java University of Stirling, Computing Science

User Guide Version 2.0

Running Sentaurus on the DOE Network

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

Introduction: What is Unix?

ASSIGNMENT 5 Objects, Files, and More Garage Management

Getting Started With UNIX Lab Exercises

The Unix Shell. Pipes and Filters

CMSC 201 Spring 2018 Lab 01 Hello World

FILE MAINTENANCE COMMANDS

AMS 200: Working on Linux/Unix Machines

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

Temple University Computer Science Programming Under the Linux Operating System January 2017

STA 303 / 1002 Using SAS on CQUEST

CMSC 201 Spring 2017 Lab 01 Hello World

C++ For Science and Engineering Lecture 2

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

When you first log in, you will be placed in your home directory. To see what this directory is named, type:

Programming Studio #1 ECE 190

genome[phd14]:/home/people/phd14/alignment >

Introduction to the UNIX command line

Command Line Interface The basics

Shell Interface Assignment

COSC UNIX. Textbook. Grading Scheme

LAB 1 INTRODUCTION TO LINUX ENVIRONMENT AND C COMPILER

Introduction to Linux Workshop 1

CS CS Tutorial 2 2 Winter 2018

Lab 2 Building on Linux

This is a combination of a programming assignment and ungraded exercises

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

Some Linux (Unix) Commands that might help you in ENSC351

CSC209. Software Tools and Systems Programming.

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

Transcription:

CSE 1030 Lab 1 Basic Use of the Command Line PLEASE NOTE this lab will not be graded and does not count towards your final grade. However, all of these techniques are considered testable in a labtest. Machines in the PRISM lab use Linux, a variant of the UNIX family of operating systems. UNIX systems are known for their heavy use of the command line, meaning the commands that can be entered at a prompt in the terminal window. In this lab, we will go through some of the common commands that you can use. We will also review how to write, compile, and run a Java program from the command line. Navigating the File System Hierarchy Here we will review some basic tools for navigating the file system on the command line. Log in to a PRISM machine and open a terminal, if one is not open already. You should see something like this, called the prompt : jun01 1 % You start out in your home directory. Type pwd at the prompt and press enter. Write down the result here: The pwd command, short for print working directory, will tell you the current folder, i.e., where you are in the file system right now. On unix, nested folders are separated by the / character. Thus, e.g., /cse/home/myfolder represents the myfolder directory, within the home directory, within the cse directory. Now let s figure out what files are already in your home directory. Type ls at the prompt and press enter. ls is short for list, and lists all files in the working directory. You might not have much in there right now. Now let s try creating a new folder. Type mkdir cse1030 at the prompt and press enter (make sure cse is lower case); mkdir is short for make directory, and

creates a new folder with the given name. Then enter ls you should see the new directory in the listing. Let s navigate to the new directory. Type cd cse1030 at the prompt and press enter; cd is short for change directory. Then type pwd and write the result below. List the files in the new directory. You should see nothing, as this is a new directory! Now let s navigate to the directory we just came from. Type cd.. and press enter (that s cd, followed by a space, followed by two periods in a row). This is a special command that goes up to the next higher directory in the folder hierarchy. Type pwd to figure out where you are and write the result here: Another trick if you get lost: if you type just cd and press enter, it changes to your home directory, i.e., the starting directory when you start the terminal. Now, from your home directory, type cd CSE1030 and press enter. What happens, and why? A couple more useful commands for you: o cp copies files o mv moves files from one place to another o rm deletes files Note that cp and rm only work on regular files, not directories.

Another hint: The tilde (~) refers to your home directory. If you want to directly access your cse1030 directory from anywhere, you can type: cd ~/cse1030 Entering, compiling, and executing a simple Java program Change to your cse1030 directory. You will need to enter the following simple Java program: public class Lab1 { public static void main(string[] args) { System.out.println( This is Lab 1 ) } } You need a text editor there are lots available, but two good examples are jedit (with a window) and nano (which just runs in the terminal). There is a deliberate error in this file. LEAVE THE ERROR IN. What error is it? When you save this file, use the filename Lab1.java. Why? Now let s compile this file. At the command prompt, type: javac cp. Lab1.java javac is the name of the java compiler the - cp. is an option that tells javac to look in the current directory for any additional source files that it needs (not needed in this case, but good to get in the habit of doing this). Lab1.java is the file you want to compile What is the output?

Correct the error and compile again. What happens this time? Now type ls. You should see a file: Lab1.class this is the compiled output of your java program. To run the java program, type: java cp. Lab1 java is the name of the Java Virtual Machine the program that executes the class file the - cp. has the same meaning as for the compiler (again not needed here, but a good habit) Lab1 is the class file extension is not needed, it will automatically look for Lab1.class. What do you see on the screen? Submitting your files We will now review how to submit your files. Verify your current directory with pwd if it is not your cse1030 directory, then change to that directory. To submit, execute the command: submit 1030 lab1 Lab1.java The correct form of the command will normally be given to you. Submit commands are of the form: submit (course number) (assignment name) (file to submit) If the result is something other than All files submitted successfully, ask the TA for assistance.