1 Introduction: Unix Software Project – Autumn 2008/2009.

Slides:



Advertisements
Similar presentations
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
1 Reading Assignments Linux, g++ & dropboxes Simple C/C++ Program (again) Edit, Compile, Test, Submit CSE Lecture 2 – More Preliminaries.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Preparation for working in the CSIL Basic LINUX operations.
Introduction to C Programming CE Lecture 1 Introduction to C.
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
1 Introduction: Unix and C Software Project – Winter 2007 / 2008.
Course Introduction and Getting Started with C 1 USF - COP C for Engineers Summer 2008.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
CMPE 151: Network Administration Spring Class Description Focus: system and network administration. Sequence of exercises. E.g., installing/configuring.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
1 CS 240 Programming in C and UNIX Lecturer: Bob Wilson Office: S Phone:
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Unix Basics Chapter 4.
CENT 305 Information Systems Security Linux Introduction.
2INC0 Operating Systems Introduction to Linux
Instructor: Tina Tian. About me Office: RLC 203A Office Hours: Wednesday 1:30 - 4:30 PM or .
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
리눅스 : Lecture 5 UNIX 유틸리티 : text editor, compilation (make), …
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
LINUX Tuesday, 5 July :00 pm. Remote Login l Use Secure Shell (ssh) l Machine name/IP address E.g. ssh hydra.sma.nus.edu.sg Or ssh
Cygwin Linux for Windows Desktop Paul Stuyvesant.
TAMU CSCE 313 (the basics). Basic Unix/Linux programming Accessing CS systems  PuTTY (putty.exe) – a Telnet and SSH client  Common hosts: unix.cs.tamu.edu.
CS240 Computer Science II Introduction the Unix File System and File Related Utilities Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
ENEE150 – 0202 ANDREW GOFFIN Introduction to ENEE150.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
A Tutorial on Introduction to gdb By Sasanka Madiraju Graduate Assistant Center for Computation and Technology.
Just Enough Unix, Chapter 1
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
Introduction to Programming Using C An Introduction to Operating Systems.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Introduction to UNIX and Linux.  Written by Dennis Ritchie and Ken Thomsom at Bell Labs in 1969  Initially written in assembly language and a high-level.
C Programming Lecture 3 : C Introduction 1 Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo.
Learning Unix/Linux Based on slides from: Eric Bishop.
Object Oriented Programming COP3330 / CGS5409.  Assignment Submission Overview  Compiling with g++  Using Makefiles  Misc. Review.
 CSC 215 : Procedural Programming with C C Compilers.
Assignprelim.1 Assignment Preliminaries © 2012 B. Wilkinson/Clayton Ferner. Modification date: Jan 16a, 2014.
1 2INC0 Operating Systems practical (part 1) Joris Geurts.
Overview of Linux Fall 2016 Dr. Donghyun Kim
Precept I : Lab Environment, Unix, Bash, Emacs
CSC 215 : Procedural Programming with C
ENEE150 Discussion 01 Section 0101 Adam Wang.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Class Projects and Environment
SEEM3460 Tutorial Unix Introduction.
Tutorial of Unix Command & shell scriptS 5027
CS1010: Intro Workshop.
How to Start Programming in Linux Environment
Useful Linux Commands.
Software Tools Recitation 1
Shell Script Assignment 1.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
C Programming Lecture Series
Tutorial of Unix Command & shell scriptS 5027
ברוכים הבאים למת"ם מבוא לתכנות מערכות
Getting Started: Developing Code with Cloud9
Video Notes.
Presentation transcript:

1 Introduction: Unix Software Project – Autumn 2008/2009

2 Administration

3 Teaching Assistant  Michal Ozery-Flato Website: courses/soft-project09/ Office Hours: by appointment

4 The goals of the course  Learning C  Learning (a bit) Unix  Practicing software development: Understanding software requirements Implementation Testing Deployment (i.e. installation, setting permissions, verification) Working in small teams (submission is in pairs)

5 Course grade  Exam (30%)  Assignments and final project (70%): “Black box” tests: automatic tests that run the program and check its output Code review

6 Overview (for the rest of this lesson)  Introduction to Unix  Development environments for C Basic tools in UNIX Eclipse Visual Studio  Submission of assignments and project

7 Introduction to UNIX (and Linux…)

8 Operating Systems  An operating system (OS) is a software that: manages the resources of a computer: CPU, memory, devices provides programmers and users with an interface to access those resources. may support/provide: multi-tasking, multi-users, GUI, security, etc.  Interfaces:  Shell: a user interface based on a command- line interpreter. Users Application User Interface Program User Interface OS Kernal Hardware

9 The Unix OS  Unix: multi-user, multi-tasking OS; open source. Case sensitive (commands, filenames...)  History: 1969 – Initial version by Thompson & Ritchie at AT&T Bell Labs. 70’s – Rewritten in C (enables portability). 80’s – System-V (AT&T) and BSD (Berkeley) versions. 90’s – Linux by Linus Torvalds. For basic introduction and commands - see course web-page (unix.doc)unix.doc

10 Basic commands in Unix shells CommandShort explanation ls -lprints the content of a directory pwdprints the name of the current directory cdchange directory mkdircreates a new directory cpcopies a file mvmoves a file/directory rmremoves (deletes) a file rmdirremoves an empty directory manhelp (manual) on a command

11 Additional Unix commands  cat – concatenate files and print to standard output cat file1 cat file1 file2 file3  less – file viewer (“less” is better than “more”)  which – locate a command  groups – prints the groups the user in (permission...)  grep – prints lines matching to a pattern grep –i “.*lib.*” foo.bar  find – search for a file in a directory find. –name “*.txt” –print find ~/ –name “*.o” -exec rm {} \;  clear – clears the terminal screen  finger – prints information about a user  who – shows who is logged in  whoami – identifies the current user

12 File and directory permissions in Unix  permissions = bits 2-10 (bit 1: “d”=directory, “-” = file) bit 1 = whether is a directory (d) or not (-) bits 2-4: owner permissions bits 5-7: group permissions bits 8-10: other permissions  rwx: r – read permission w – write permission x – execute (file)/ enter (cd directory)  changing permissions: chmod chmod go+rx a.out chmod –R 755 mydir group permissions

13 Editing text files in Unix  Common text editors: pico - simple but very basic vi, vim - two modes: command / write emacs, xemacs (GUI) - see course webpage for a simple tutorial  More info: man pico, man vi, man vim man emacs

14 Pipes and redirections to/from files  Pipe: prog1 | prog2 – the output of prog1 is redirected to the input of prog2 Example: ls –l | less  Output redirection to file prog > foo.out :may cause an error if foo.out exists prog >! foo.out :truncates foo.out if exists prog >> foo.out :may cause error if foo.out does NOT exist prog >>! foo.out :does not check whether foo.out exists  Input redirection (read from file) prog < foo.in

15 Comparing files (program tests)  prog ! my1.out : reading from 1.in and writing to 1.out  diff my1.out 1.out –compares files line by line  Ignoring all whitespaces: diff –w my1.out 1.out

16 Working from home...  Putty - shell window  Winscp - copying files  Links: 7%A9%D7%94_%D7%9C%D7%A9%D7%A8%D7%AA%D7 %99%D7%9D 7%A9%D7%94_%D7%9C%D7%A9%D7%A8%D7%AA%D7 %99%D7%9D

17 Development environments for C

18 Printing "Hello World” in C #include int main(void) { printf(“Hello world!\n”); return 0; } Include the standard function declarations (prototypes) print to standard output (declared in stdio.h)

19 C programming process Hello.c Edit Compile Link Hello.o Hello C Libraries (machine code) Run Hello World! Source code (High-level language) Object file (Machine code) ExecutableOutput

20 Basic tools in UNIX

21 Compiling and linking  Compiling and linking gcc hello.c –o hello  Only compiling (creating hello.o) gcc –c hello.c  Only linking gcc hello.o –o hello  Additional common flags to gcc: -ansi -pedantic-errors - verifies that the code is ANSI C compliant -g – allows debugging -l - linking with external librarie  -lm - if a math function is called (e.g. pow(x))

22 Make and makefiles (in short)  makefile: a file containing a collection of rules. Used for building applications The default name of a filename: "makefile"  make: a utility for “executing” makefiles Makefiles will be covered later in the course. Till then, makefiles will be supplied all: hello clean: -rm hello.o hello hello: hello.o gcc -g hello.o -o hello hello.o: hello.c gcc -ansi -pedantic-errors -g -c hello.c rule target name dependencies command makefile

23 How to use makefiles 1. Copy the makefile into the appropriate directory (e.g. the directory containing the source files) 2. In a shell window (e.g. putty) change to the directory containing the makefile 3. Use the commands: "make clean"+ "make all" to build the executable

24 gdb – the GNU debugger  Running gdb: gdb  Useful commands: help, quit, n, s, b /

25 Eclipse

26 Availability  Installed in the CS School LINUX lab (Linux) Including C/C++ projects  Working at home (Windows) - not recommended Code requires porting to LINUX Relatively complicated installation  Cygwin: Update PATH to contain c:\cygwin (or your alternative path)  CDT: No support from course staff / helpdesk for installations

27 Create a new workspace /a/home/cc/students/cs/ozery/soft-proj09

28 Create a new project-1 (Linux lab)

29 Create a new project -2 (Linux Lab)

30 create a new project (windows)

31 Add source file

32 Add makefile (a file named “makefile”)

33 Build the project in each save. (LINUX Lab)

34 Project properties (windows)

35 Build the project

36 Running and Debugging (LINUX lab)  Right click on the executable file (with the bug icon ): Run As->Local C/C++ Application Debug As->Local C/C++ Application  Set debugger to “GDB Debugger”

37 Debugging under Windows+cygwin Console in a new window

38 Microsoft Visual Studio

39 Advantages / disadvantage, download info  Advantages: A common and friendly IDE for C/C++. Recommended for development under Windows A relatively simple installation, good support in the internet  Disadvantage: requires porting to Linux  Free download: Visual Studio Express C++ (2008 edition) see

40 Creating a project (and a solution)

41 Adding new source files  Right click on project name: Add->New Item Write file name, including the.c suffix (e.g. file.c)

42 Build project

43 Compiling with debug information

44 Removing optimization

45 Linking with debug information

46 Debugging

47 Submission of assignments and project

48 Submission in pairs  The exercises and project are submitted in pairs If you do not have a partner – send me an (no single submissions) The exercise must be submitted in the home directories of both partners. The submitted directories of the two partners should be identical!

49 How to submit  Under ~/soft-proj09/ Strictly follow the provided file framework for each assignments / project Perform rebuild: make clean + make all Verify correct run: use given input/outfile + diff. Output should be exactly as specified! (do not add unnecessary friendly “printf” commands!) Before submission – give permission chmod 755 ~ chmod -R 755 ~/soft-proj09  Manual submission - one for each pair printouts of code Should include: name, user-name, and id-number – of both partners! submitted to the checker’s mail-box (details will be given later)

50 Grading policy  If you do not follow the submission guidelines and your exercise cannot be automatically checked  your grade will be zero!  No appeals with submission/compilation/execution problems will be considered!

51 Appeals  Once your code is submitted – do not touch it! (we check time stamps)  Appeals must be submitted within one week after grades publication.  To appeal : resubmit to the checker’s mail-box (Yehudit Hasson): 1. The original printout (with the checker’s comments). 2. A detailed description of your appeal