Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Similar documents
CS 261 Recitation 1 Compiling C on UNIX

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C

CSC111 Computer Science II

Intermediate Programming, Spring Misha Kazhdan

CS CS Tutorial 2 2 Winter 2018

Introduction to the Linux Command Line

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

Basic Unix Commands. CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

Parallel Programming Pre-Assignment. Setting up the Software Environment

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Laboratory 1 Semester 1 11/12

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry

CS Fundamentals of Programming II Fall Very Basic UNIX

Exercise 1: Basic Tools

CS 246 Winter Tutorial 1

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

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

CMPT 300. Operating Systems. Brief Intro to UNIX and C

Introduction to Linux

LAB #5 Intro to Linux and Python on ENGR

Practical Session 0 Introduction to Linux

Lab 1: Introduction to C, ASCII ART & the Linux Command Line

Introduction: The Unix shell and C programming

Hand-on Labs for Chapter 1 and Appendix A CSCE 212 Introduction to Computer Architecture, Spring

mkdir Phys338 s2017 Draw the tree of the directories and files for this step and all the following cd Phys338 s2017

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

Session 1: Accessing MUGrid and Command Line Basics

CSE 351. Introduction & Course Tools

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University

Linux at the Command Line Don Johnson of BU IS&T

Introduction to Linux. Fundamentals of Computer Science

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

CISC 220 fall 2011, set 1: Linux basics

Linux File System and Basic Commands

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

The Command Shell. Fundamentals of Computer Science

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

COMP s1 Lecture 1

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

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Introduction to Supercomputing

User Guide Version 2.0

CSC116: Introduction to Computing - Java

Development Environment & Linux Guide

Dalhousie University CSCI 2132 Software Development Winter 2018 Lab 8, March 22

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Laboratory Assignment #3 Eclipse CDT

Recitation #1 Unix Boot Camp. August 29th, 2017

Introduction to Linux for BlueBEAR. January

CMSC 201 Spring 2018 Lab 01 Hello World

Helpful Tips for Labs. CS140, Spring 2015

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to the UNIX command line

Lecture 2: Tools & Concepts

Week 2 Lecture 3. Unix

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

Working with Basic Linux. Daniel Balagué

Assignment 1: Build Environment

CSCI2467: Systems Programming Concepts

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

Unix Basics. Systems Programming Concepts

C++ Programming on Linux

Computer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: C and Unix Overview

ENERGY 211 / CME 211. Evolution

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

Introduction to Linux Environment. Yun-Wen Chen

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Linux/Cygwin Practice Computer Architecture

Programming and Data Structure Laboratory (CS13002)

Intro to Linux & Command Line

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Using the Zoo Workstations

AMS 200: Working on Linux/Unix Machines

Recitation #1 Boot Camp. August 30th, 2016

1. The Mac Environment in Sierra Hall 1242

Systems Programming Advanced Software Development

Introduction to Linux

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

CENG393 Computer Networks Labwork 1

COMS 6100 Class Notes 3

CMPUT 201: Practical Programming Methodology. Guohui Lin Department of Computing Science University of Alberta September 2018

Introduction: What is Unix?

1. The Mac Environment in SIE 1222

CHE3935. Lecture 1. Introduction to Linux

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

bwunicluster Tutorial Access, Data Transfer, Compiling, Modulefiles, Batch Jobs

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

Getting Started with UNIX

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Programming Studio #1 ECE 190

Introduction to Linux

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)

Introduction. Overview of 201 Lab and Linux Tutorials. Stef Nychka. September 10, Department of Computing Science University of Alberta

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

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

Transcription:

Oregon State University School of Electrical Engineering and Computer Science CS 261 Recitation 1 Spring 2011

Outline Using Secure Shell Clients GCC Some Examples Intro to C * *

Windows File transfer client: WinSCP Already installed in EECS lab machines Download WinSCP Terminal client for windows: PuTTY Already installed in EECS lab machines Download PuTTY installer * *

Mac SSH built into Terminal Search (Command + F) for Terminal Use a file transfer client such as Cyberduck. Or use scp command. Meet me in my office hours if you don t know scp.

Username: Your alias Password: password Private Key file: Ignore WinSCP

After Login

PuTTY

PuTTY Login as your alias with your password

PuTTY After Login, you will see terminal like the one below

Basic Linux commands pwd Present working directory ls list files and directories in current directory % ls la : el denotes long listing a including all hidden files cd Change directory mkdir make new directory cp copy <srcfilename> <desfilename> mv Moves / renames <srcfilename> <desfilename> rm remove file cat show file content exit exit the session chmod Change permissions * *

Basic Linux Commands Linux has great help man (short manual) command Try man pwd command on your terminal. Similarly try man ls man cd

Basic Linux Commands. (single dot) Represents current directory.. (two dots) Represents parent directory Use Internet to know more about these commands. You will get used to them. More information on how to use gcc and vim editor, please refer to 2010 Fall CS151 * *

Text Editors Use your favourite text editor to write programs. Here are a few recommendations Windows Notepad++ Download Notepad++. Linux Gedit Kate There are lots of other editors You can even use IDEs like Visual Studio or Eclipse If you write programs using these IDEs, make sure your programs work as expected by the homework. You are on your own when it comes to IDE features. * *

Compiler Your program should be compilable by gcc Version: (GCC) 4.4.6 (as available on EECS machines) Run this command to know gcc version gcc - - version Make sure your program compiles/runs on EECS lab machines or flip/flop machines before submitting them. Compilation errors mean Zero marks.

gcc Gnu Compiler Collection Think of compiler as a language translator between you and the computer. Think of Linker as a automobile engineer who assembles different parts to create a vehicle that runs. Individual parts don t run. Even engine cannot run on its own. Compiling with GCC: Output: gcc <list of options> sourcefile.c gcc - o hello.o hello.c Compiling the code converts it into object files (*.o) Linking the code uses the information from the object code to build executable. * *

gcc Gnu compiler Collection Sometimes all you want to see is if your code compiles. On large projects linking object code takes significant time. Just compile Example: gcc c code1.c code2.c code3.c This Code produces three object files: code1.o code2.o code3.o To link the individual.o files to generate the executable: gcc o executable code1.o code2.o code3.o The same can be done in a single step : gcc o executor code1.c code2.c code3.c * *

make (also called Gnu make) Think of make as an organizer Good organizing saves you time Lets you not worry about repeated work make makes your coding life simple by Running all the commands using a simple Makefile Write a makefile and run make You need not spend your time on writing makefile or about make. We will give you makefile. Follow the instructions and run make.

Sample Makefile Lets say you are asked write a program in a file named hello.c Then content of makefile would be: Tabs are very important in make. Don t mess with Tabs. default:main main: hello.c gcc hello.c o hello clean: rm hello hello.o Simply running make runs the section main Because default is main Running make clean runs clean section. * *

The C Programming Language Best way to learn C would be to get a textbook and follow the lecture notes. Any textbook should be fine.

Headers in C Essential header: #include <stdio.h> :Includes the standard Input/ output library. Without this statement the program will not be able to print/read data. Other headers & including any files : (Next class..) * *

Variables & function declaration All the variables/functions are required to be declared prior to its use in the program. int add (int, int); // function declaration /prototyping void main(){ } int var1 = 10; printf( %d, var1); int var2=20; printf( %d, var2); int result = add(var1, var2); int add(int a, int b){ } return (a+b); * *

Coding Guidelines Write comments. Maintain readable indentation. Should be readable by others. Remember that you are writing code which will be evaluated by someone else. Follow the instructor guidelines on naming conventions. For files and functions.

Hello CS 261 /* Filename: hello.c Author: kranti Output: prints a message on the console. */ #include <stdio.h> int main (void) { printf( Hello CS 261!!!!\n ); return 0; } Compile gcc o hello hello.c Runnnn!!!

That s all for today. * *