Intermediate Programming, Spring Misha Kazhdan

Similar documents
Lab 1 Introduction to UNIX and C

CS 261 Recitation 1 Compiling C on UNIX

Lab 1 Introduction to UNIX and C

Intermediate Programming, Spring Misha Kazhdan

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

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

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

Laboratory 1 Semester 1 11/12

Intro to HPC Exercise

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

AMS 200: Working on Linux/Unix Machines

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

Intermediate Programming, Spring 2017*

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

EL2310 Scientific Programming

CS CS Tutorial 2 2 Winter 2018

Introduction: The Unix shell and C programming

Lecture 01 - Working with Linux Servers and Git

CS 246 Winter Tutorial 1

Using the Zoo Workstations

Introduction to Linux Environment. Yun-Wen Chen

Exercise 1: Basic Tools

Getting started with UNIX/Linux for G51PRG and G51CSA

Helpful Tips for Labs. CS140, Spring 2015

C++ Programming on Linux

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

LAB #5 Intro to Linux and Python on ENGR

We first learn one useful option of gcc. Copy the following C source file to your

15-122: Principles of Imperative Computation

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

CSE 351. Introduction & Course Tools

Lab 1 1 Due Wed., 2 Sept. 2015

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

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

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

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

Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon.

CSC111 Computer Science II

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

Linux/Cygwin Practice Computer Architecture

Unit 10. Linux Operating System

Intermediate Programming, Spring 2017*

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs

Unix and C Program Development SEEM

Practical Session 0 Introduction to Linux

Introduction to Supercomputing

Linux and Git Boot Camp

Recitation #1 Boot Camp. August 30th, 2016

Problem Set 1: Unix Commands 1

Lab 3a Using the vi editor

Introduction to Linux. Fundamentals of Computer Science

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

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

EL2310 Scientific Programming

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Linux Tutorial. Ken-ichi Nomura. 3 rd Magics Materials Software Workshop. Gaithersburg Marriott Washingtonian Center November 11-13, 2018

Getting Started with UNIX

Short Read Sequencing Analysis Workshop

Lecture 1. A. Sahu and S. V. Rao. Indian Institute of Technology Guwahati

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CSC116: Introduction to Computing - Java

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

Introduction to the Linux Command Line

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

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

CSE 391 Lecture 1. introduction to Linux/Unix environment

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

Using the Unix system. UNIX Introduction

CS Fundamentals of Programming II Fall Very Basic UNIX

Linux Survival Guide

Programming and Data Structure Laboratory (CS13002)

1. The Mac Environment in Sierra Hall 1242

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Linux Systems Administration Getting Started with Linux

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

Parallel Programming Pre-Assignment. Setting up the Software Environment

2 Compiling a C program

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

Introduction to Linux

User Guide Version 2.0

Command Line Interface The basics

CSE 391 Lecture 1. introduction to Linux/Unix environment

The Command Shell. Fundamentals of Computer Science

1. The Mac Environment in SIE 1222

Getting Started With UNIX Lab Exercises

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi and Cyrill Stachniss

Unit 13. Linux Operating System Debugging Programs

CSC116: Introduction to Computing - Java

CMSC 201 Spring 2017 Lab 01 Hello World

LAB 1 INTRODUCTION TO LINUX ENVIRONMENT AND C COMPILER

2 Initialize a git repository on your machine, add a README file, commit and push

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Introduction to Linux

Intermediate Programming, Spring 2017*

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

COMP s1 Lecture 1

Warm-up sheet: Programming in C

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

Introduction to Linux for BlueBEAR. January

Transcription:

600.120 Intermediate Programming, Spring 2017 Misha Kazhdan

Outline Unix/Linux command line Basics of the Emacs editor Compiling and running a simple C program Cloning a repository

Connecting to ugrad On lab computer or your Windows laptop Open PuTTy and connect to ugrad: Open connection with hostname ugradx.cs.jhu.edu Mac: open Terminal application and type: ssh <username>@ugradx.cs.jhu.edu ugradx.cs.jhu.edu

Unix / Linux Powerful class of operating systems Multiuser, unified file system Command-line interface text-based commands, no graphical user interface (GUI) allow for easy automation of series of commands

Unix / Linux When you login, you will be in your home directory. pwd: prints the name of the current directory ls: prints the contents of the current directory cd <(sub-)directory name>: changes the current directory to the specified (sub-)directory cd..: go up one directory (a single. indicates current directory) cd /: go to the root directory cd ~: go to the home directory mkdir <directory name>: create a new directory within the current directory

Unix / Linux cp <source> <target>: copy the source to the target mv <source> <target>: move the source to the target more <file-name>: displays the contents of a file, one screen at a time less<file-name>: a more powerful version of more emacs [<file-name>]*: my text editor of choice *feel free to use a different editor (e.g. VIM) if you prefer

Emacs Basics Can type directly Arrows move you around Basics [CTRL]-x + [CTRL]-c: quit [CTRL]-x + [CTRL]-s: save [CTRL]-x + [CTRL]-f: open a file* [CTRL]-x + u: undo [CTRL]-_: undo [CTRL]-g: cancel *prompts show up at the bottom

Emacs Basics Cut / Paste: [CTRL]-k: [CTRL]-[SPACE]: [CTRL]-w: [ESCAPE]+w: [CTRL]-y: Search / Replace: [CTRL]-s: [ESCAPE]-%: kill the rest of the line set (start) mark cut from the mark to the cursor copy from the mark to the cursor copy the previously cut/copied buffer search forward* query replace* And much much more: [ESCAPE]+<command name>:...

Coding Flow Editor main.c Compiler a.out Source file (human readable) Binary executable (machine readable)

Coding Flow Editor main.c Compiler a.out 1. Write code (e.g. in Emacs) #include <stdio.h> // Print "Hello, world! followed by newline and exit int main( void ) { printf( "Hello, world!\n ); return 0; }

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out.

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out. gcc: use the GNU C compiler

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out. gcc: use the GNU C compiler -std=c99: use the C99 standard

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out. gcc: use the GNU C compiler -std=c99: use the C99 standard -pedantic: use the strict ANSI standard

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out. gcc: use the GNU C compiler -std=c99: use the C99 standard -pedantic: use the strict ANSI standard -Wall: enable all warnings

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out. gcc: use the GNU C compiler -std=c99: use the C99 standard -pedantic: use the strict ANSI standard -Wall: enable all warnings -Wextra: enable still more warnings

Coding Flow Editor main.c Compiler a.out 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c This generates the executable a.out. gcc: use the GNU C compiler -std=c99: use the C99 standard -pedantic: use the strict ANSI standard -Wall: enable all warnings -Wextra: enable still more warnings main.c: the source file (with a main function).

Coding Flow Editor main.c Compiler hello 2. Compile the code into an executable >> gcc -std=c99 -pedantic -Wall -Wextra main.c o hello If you want the executable to have a different name: -o hello: specifies the output to be hello

Coding Flow 3. Run the executable Editor main.c Compiler hello >>./hello

Cloning a Repository (Repo) git is a way of sharing files; like DropBox or GoogleDrive, only much more powerful (and great for sharing code) more details about this next class We want everyone to have access to class resources for this section our class repo is hosted by bitbucket.org can view the shared files in a browser, but we want local copies to work with today you ll clone the class repo into your ugrad account when instructors add more to the repo, you can pull down updates unlike Dropbox, git doesn t auto-sync the files in the repo

Cloning a Repository (Repo) https://bitbucket.org/minermore/cs120sp17-public.git contains files shared with you for use in this course open a web browser and view this repo

Cloning a Repository (Repo) Cloning to your course folder on your ugrad account: 1. Get into your home directory: >> cd ~ 2. Create a course folder: >> mkdir cs120 3. Change to that directory: >> cd cs120 4. Clone the repo to the course folder: >> git clone https://bitbucket.org/minermore/cs120sp17-public.git

In-Class Exercises On Piazza, find Resources section, then click Resources tab Scroll down to section for this course section Find link for Exercise 1-1 and follow it Follow the instructions; raise your hand if you get stuck Make sure you check in with a course staff member sometime during this session

In-Class Exercises On Piazza, find Resources section, then click Resources tab Scroll down to section for this course section Find link for Exercise 1-1 and follow it Follow the instructions; raise your hand if you get stuck Make sure you check in with a course staff member sometime during this session

In-Class Exercises On Piazza, find Resources section, then click Resources tab Scroll down to section for this course section Find link for Exercise 1-1 and follow it Follow the instructions; raise your hand if you get stuck Make sure you check in with a course staff member sometime during this session

In-Class Exercises On Piazza, find Resources section, then click Resources tab Scroll down to section for this course section Find link for Exercise 1-1 and follow it Follow the instructions; raise your hand if you get stuck Make sure you check in with a course staff member sometime during this session

In-Class Exercises On Piazza, find Resources section, then click Resources tab Scroll down to section for this course section Find link for Exercise 1-1 and follow it Follow the instructions; raise your hand if you get stuck Make sure you check in with a course staff member sometime during this session