23. Check that hello.txt now contains (substitute your info for mine): hello rcwhaley: Dr. Whaley

Size: px
Start display at page:

Download "23. Check that hello.txt now contains (substitute your info for mine): hello rcwhaley: Dr. Whaley"

Transcription

1 Assignment 0: Basic Unix Exploration Due: Wednesday 01/15/2018 (before class) In this assignment, you will become familiar with a few tools required to work in the Unix environment. Take your time, and try to understand each step as fully as possible, since its purpose is for you to learn how to use the programming environment used in the class. There is no need to finish it one sitting. To do this work, you will need to log into the Linux machines at burrow.soic.indiana.edu. All common OSes have methods of getting remote terminal access: Linux/OS X: use ssh. Open up a terminal window, and type: ssh -X username@burrow.soic.indiana.edu Windows: install and use PuTTY from the course website. In doing the following, I will tell you what to do and the command to do it. You need to understand what you are doing and remember the command since I will only tell you once. I also suggest that you read about these commands in your book, or on the web (via the main page links and/or googling them), or by reading the Unix man page via the man command. The man page gives relatively complete information, and are written in a bit intimidating style, which you will become used to over time. Directory heirarchy operations: 1. Log in as outlined above 2. After logging in, check what your current directory is by using pwd (print working directory). After login, your working directory should be your home directory, which in my case is: /nfs/nfs6/home/rcwhaley. The output of pwd is the full path to your home directory. 3. Create a subdirectory (AKA a folder) under your home directory with the command mkdir courses 4. Read about the mkdir command with man mkdir 5. Create a subdirectory called oops. 6. Look at all the files/directories in your current directory with the command ls -CF. Do you see the courses & oops subdirectories that you created above? Execute ls -l to see more information on the files/directories in your home directory. Read a little of the man page to see what information this command is telling you. 7. Delete the directory oops using the command rmdir oops. Read the man page for rmdir. 8. Change directories to your courses subdirectory with the command cd courses. Note that if you type the first several letters of a file or directory, and then hit tab, your shell can auto-type the rest of the filename for you! 9. Make the directory ISE under your courses directory. 10. Change directories to your ISE directory. 11. Make the directory 111 under your ISE directory. 12. Change directories to your 111 directory. 1

2 13. Change to your home directory using cd. Notice that a cd with no arguments changes to your home directory. The tilde (~) is shorthand for your home directory, so instead of referring to my courses directory as /nsf/nsf6/home/rcwhaley/courses I can use ~/courses. 14. Make an alias, cd111, to change directories to your newly created 111 directory with the command: alias cd111="cd ~/courses/ise/111" Thus, when you type cd111 it will be replaced by the shell with the cd command on the right. Notice that this only works in the shell in which the alias was executed (i.e., if you open up a second terminal window, or log out of this one, then you must create the alias again to be able to use it). 15. Change to your 111 directory with cd111, verify that you are there with pwd. 16. Create a subdirectory of 111 called asg Change to your home directory and make a subdirectory tmp where you can play with stuff that you will delete later. 18. Change directories back to your cd asg0 19. Create a file containing the word hello using the echo command along with redirection: echo "hello" > hello.txt 20. Display the contents of the created textfile one line at a time using the cat command: cat hello.txt 21. Read the man page on cat. 22. Now, let s add a line to hello.txt that maps your user name to your real name. Issue: echo "login: my_name" >> hello.txt Make sure you replace login with your login name (as shown in your path), and my name with your actual name. For instance, I would put: echo "rcwhaley: Dr. Whaley" >> hello.txt 23. Check that hello.txt now contains (substitute your info for mine): hello rcwhaley: Dr. Whaley 24. Change back to your home directory, and create a tarfile (like a zip file) of all directories and files you have created using: tar cvf courses.tar courses 25. If you are masochistic, horrify yourself by attempting to understand the man page on tar. 26. Move this file into your asg0 subdirectory: mv courses.tar courses/ise/111/asg0/.. When doing file operations, your shell (the program running in the terminal taking things you type and executing them for you) interprets the period in this statement to mean use the same filename it had in the other directory. 27. Change to your asg0 subdirectory. 28. Scope the size of the files using ls -l 29. Compress the tarfile using: bzip2 courses.tar 2

3 30. Scope the bzip2 manpage 31. Scope the size of the files now: courses.tar will now be smaller and be called courses.tar.bz2 32. Change directory to the tmp subdirectory under your home. 33. Untar your entire courses tree structure under /tmp using: bunzip2 -c ~/courses/ise/111/asg0/courses.tar.bz2 tar xvf Verify your courses directories and files are duplicated under tmp. 35. Delete only your hello.txt from tmp by issuing: rm courses/ise/111/asg0/hello.txt 36. Verify that that hello.txt is no longer there. 37. Delete everything in tmp, and all subdirectories under it, by using (the very dangerous!) recursive rm command: rm -rf ~/tmp 38. Scope the rm manpage. If you add the -rf argument, it will recursively delete all subdirectories without verifying that that is what you meant to do, so uh, be careful with that. 39. Submit your tarfile using canvas. Editing with vim If you work in systems, you will spend a huge amount of time editing various text files. Because of this, all Unix/Linux systems come with a variety of editors. Noobs will use simple editors like pico, which are easy to run, and have almost no power (like wordpad). When you edit files for a living, however, it is much better to use a much more powerful text editor. Historically, this has meant you either learn EMACS or vi. EMACS is for people who want to get a foot pedal to run control the key, or who are hoping to get carpal tunnel early. EMACS is what you get if your design philosophy is basically: swiss army knives really need features like a toupee comb, microwave, sat phone, and clothes washer/dryer added to them. vi is for those who like a tool that punches you in the face for an entire semester, before becoming the most powerful, natural, and easy on the the typing hands editing tool ever invented. It embodies the philosophy: a knife should cut through hardened steel effortlessly, have no safety features, and that s all it should do. You may use any editor you want, but I will only answer questions on vim, which is a modern version of vi. To get started on the face-punching phase: 1. Change to the ~/tmp directory, execute vimtutor and follow the directions in order to get an introduction to the vi editor (vim is one of the fanciest modern variants of Unix s original vi editor). 3

4 Compiling, executing, and debugging C programs: 1. Back in your asg0 subdirectory, type in the following C program into the file sumfile.c (vim sumfile.c if your face is holding up): Comments (started with and ended with ) are optional, and can be changed or ommitted without changing the program. * Typed in by <YOUR NAME> for asg0 E111 #include <stdio.h> #include <stdlib.h> #include <assert.h> int main(int argc, char *argv[]) all C programs must have main char *inf; variable FILE *fpin;... int tot; declarations char *GetFlags(int argc, char **argv); function int sumfile(file *fpin); protoypes inf = GetFlags(argc, argv); fpin = fopen(inf, "r"); assert(fpin); tot = sumfile(fpin); fclose(fpin); printf("total = %d\n", tot); return(0); 0 means normal (non-error) exit * Print usage and help info when commandline args are malformed, then exit void PrintUsage(char *name, int ierr, char *flag) if (ierr > 0) fprintf(stderr, "Bad argument #%d: %s \n", ierr, flag?flag:"out-of-arguments"); else if (ierr < 0) fprintf(stderr, "ERROR: %s\n", flag); fprintf(stderr, "USAGE: %s [flags]:\n", name); fprintf(stderr, " -i <input file>\n"); * Signal abnormal termination if (ierr!= 0) exit(ierr); else exit(-1); * This routine parses the commandline arguments provided to the routine 4

5 * in order to find out what file to read in. If no file is provided, take * the default name "num.dat" * RETURNS: file name to read numbers from char *GetFlags(int argc, char *argv[]) char *infile = "num.dat"; int i; * Loop over all commandline arguments, and parse those that make sense. If * a flag is unknown or badly formed, print usage information and abort * program execution while returning an error code. * NOTE: we don t parse argv[0] since that is the name of the program, * not a flag! for (i=1; i < argc; i++) * All flags must begin with -, or they are malformed. Notice we don t * have to prototype PrintUsage, since we put PrintUsage in the file first, * and so the routine definition serves as the prototype for following * invocations. This is more fragile than prototyping, since it depends * on routines appearing in a fixed order in the source. * NOTE: PrintUsage is never returned from since it calls exit() if (argv[i][0]!= - ) PrintUsage(argv[0], i, argv[i]); switch(argv[i][1]) only i legal value for this prog! case i : -i <input file name> if (++i >= argc) do we have required following arg? PrintUsage(argv[0], i-1, NULL); infile = argv[i]; break; default: any other flag is unknown! PrintUsage(argv[0], i, argv[i]); return(infile); * This routine reads all available integers from the open file fpin, * and returns the sum of all read-in integers int sumfile(file *fpin) int num, sum=0; while ( fscanf(fpin, "%d", &num) == 1 ) sum += num; return(sum); 5

6 2. Compile the program in sumfile.c calling the executable xsum, using the command: gcc -Wall -Wpedantic -ansi -g -o xsum sumfile.c This will compile the C file, create an object file and then link this object code to the C libraries all in one step to create the executable. The object code file will not be written to the user s directory in this case. Note that we could separate the compile and link steps by: (a) gcc -Wall -Wpedantic -ansi -g -c sumfile.c (compile sumfile.c to object file, stored as sumfile.o). (b) gcc -ansi -g -o xsum sumfile.o (link object file with system libs to create executable). In this case, sumfile.o will persist in user s directory until deleted manually. If our program is spread over multiple files, just repeat step-a for each file, and then list all files during step-b. 3. Create the file num.dat with numbers totalling 30 using the command: echo -e "1 2 3\n7 8 9" > num.dat 4. Check the contents of the file by: cat num.dat 5. Have your program add up the numbers by:./xsum -i num.dat 6. Run program on invalid data with:./xsum -i noexist.dat 7. Understand what assert is doing from this response, putting additional print statements in to aid understanding if necessary. 8. Understand why this works:./xsum -i noexist.dat -i num.dat 9. valgrind is an extremely useful program that looks for memory allocation errors. You should run valgrind on all your codes that do any kind of memory allocation. To do this, simply: valgrind --leak-check=yes --malloc-fill=0x88 --track-origins=yes./xsum -i num.dat 10. To avoid typing all that, use an alias like: alias vg=valgrind --leak-check=yes --malloc-fill=0x88 --track-origins=yes 11. Here is an step that will only work if you log in from OS X/Linux using ssh -X, if you are running Linux locally, or if you use PuTTY and Xming on Windows: Compile the program and follow its execution in the debugger: (a) The -g flag tells the compiler to include debugging info in the resulting object or executable file. If you are not debugging, you can substitute the -O (Optimize) flag for -g. (b) Start running under the graphical debugger using the command: ddd./xsum (c) You will see the ddd screen and in the source windows you will see your program. You can set a breakpoint (a place to stop execution) anywhere in the program by simply right clicking its line and choosing the break button. You can also issue this command manually in the command window by typing break <routine name> (eg., break main). (d) Begin execution by typing run followed by the arguments in the command window (eg., run -i num.dat). (e) Once you reach your breakpoint, use the next and step buttons/commands to watch the program execute. Notice you can see the value of variables by hovering over them with the mouse, or using the print command. 6

7 (f) Now set a breakpoint on the line: total += num; in the loop by clicking on the line and then the break button. You should see a little red stop sign appear to the left of the line. (g) Any time that ddd has control (at a breakpoint, etc.), you can look at any of the variable values. So to see the current value of num, click on the variable in the program window, anywhere in the code, and then click the print button (or type print num in the command window). You will see the value printed in the command window. Look at the value of total: is it what you expected? (h) Click on the Cont button and execution will continue until the next loop iteration. Again look at num and total and ask if they have the expected values. Continue until program exit. (i) Now clear the break point inside the loop by clicking on the line and then clicking the Clear button. (j) To look at variable values, we need to pause and specifically print them out. It is simpler if we can just watch them change (assuming their aren t many variables). We can do this in the following way: i. Click on the dropdown menu, View, this shows various subwindows that are currently displayed. Click on Data Window. You will see a new subwindow on the top of your ddd display. ii. Type break sumfile to stop execution in the sumfile function. iii. type run (or hit the Run button) iv. Click on num in the code and then click the display tool button. num will appear in the data window with its present value, which is currently garbage since num has not yet been initialized. Do the same for total, make sure the data window is large enough for both to be seen (you an drag them to be side-by-side if you want). v. Now watch values change as you use Step to step through the execution.? When ddd stops at a break point, has the statement at the break point already executed or is it the next statement to be executed? play with debugger until you can use it well, setup your defaults to suit your style, etc. 12. Submit your sumfile.c using canvas. It is OK if it has no comments, except your name at top. 7

23. Check that hello.txt now contains (substitute your info for mine): hello rcwhaley: Dr. Whaley

23. Check that hello.txt now contains (substitute your info for mine): hello rcwhaley: Dr. Whaley Assignment 0: Basic Unix Exploration Due: Monday 01/14/2018 (before class) In this assignment, you will become familiar with a few tools required to work in the Unix environment. Take your time, and try

More information

CSC111 Computer Science II

CSC111 Computer Science II CSC111 Computer Science II Lab 1 Getting to know Linux Introduction The purpose of this lab is to introduce you to the command line interface in Linux. Getting started In our labs If you are in one of

More information

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

CMPT 300. Operating Systems. Brief Intro to UNIX and C CMPT 300 Operating Systems Brief Intro to UNIX and C Outline Welcome Review Questions UNIX basics and Vi editor Using SSH to remote access Lab2(4214) Compiling a C Program Makefile Basic C/C++ programming

More information

Problem Set 1: Unix Commands 1

Problem Set 1: Unix Commands 1 Problem Set 1: Unix Commands 1 WARNING: IF YOU DO NOT FIND THIS PROBLEM SET TRIVIAL, I WOULD NOT RECOMMEND YOU TAKE THIS OFFERING OF 300 AS YOU DO NOT POSSESS THE REQUISITE BACKGROUND TO PASS THE COURSE.

More information

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

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4 Beyond this course Readings: CP:AMA 2.1, 15.4 CS 136 Spring 2018 13: Beyond 1 Machine code In Section 04 we briefly discussed compiling: converting source code into machine code so it can be run or executed.

More information

Exercise 1: Basic Tools

Exercise 1: Basic Tools Exercise 1: Basic Tools This exercise is created so everybody can learn the basic tools we will use during this course. It is really more like a tutorial than an exercise and, you are not required to submit

More information

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. NOTE: Text

More information

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

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016 Linux Boot Camp Jack, Matthew, Nishad, Stanley 6 Sep 2016 1 Connecting SSH Windows users: MobaXterm, PuTTY, SSH Tectia Mac & Linux users: Terminal (Just type ssh) andrewid@shark.ics.cs.cmu.edu 2 Let s

More information

Laboratory 1 Semester 1 11/12

Laboratory 1 Semester 1 11/12 CS2106 National University of Singapore School of Computing Laboratory 1 Semester 1 11/12 MATRICULATION NUMBER: In this lab exercise, you will get familiarize with some basic UNIX commands, editing and

More information

Introduction to Supercomputing

Introduction to Supercomputing Introduction to Supercomputing TMA4280 Introduction to UNIX environment and tools 0.1 Getting started with the environment and the bash shell interpreter Desktop computers are usually operated from a graphical

More information

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. The doc is

More information

COMP s1 Lecture 1

COMP s1 Lecture 1 COMP1511 18s1 Lecture 1 1 Numbers In, Numbers Out Andrew Bennett more printf variables scanf 2 Before we begin introduce yourself to the person sitting next to you why did

More information

PRINCIPLES OF OPERATING SYSTEMS

PRINCIPLES OF OPERATING SYSTEMS PRINCIPLES OF OPERATING SYSTEMS Tutorial-1&2: C Review CPSC 457, Spring 2015 May 20-21, 2015 Department of Computer Science, University of Calgary Connecting to your VM Open a terminal (in your linux machine)

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

COMS 6100 Class Notes 3

COMS 6100 Class Notes 3 COMS 6100 Class Notes 3 Daniel Solus September 1, 2016 1 General Remarks The class was split into two main sections. We finished our introduction to Linux commands by reviewing Linux commands I and II

More information

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

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical

More information

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

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

Development Environment & Linux Guide

Development Environment & Linux Guide Development Environment & Linux Guide Juwon Lee(jwlee@archi.snu.ac.kr) School of Computer Science and Engineering Seoul National University Development Environment MobaXterm Provide Linux-like environment

More information

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

Computer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: C and Unix Overview Computer Science 322 Operating Systems Mount Holyoke College Spring 2010 Topic Notes: C and Unix Overview This course is about operating systems, but since most of our upcoming programming is in C on a

More information

Lecture 7: file I/O, more Unix

Lecture 7: file I/O, more Unix CIS 330: / / / / (_) / / / / _/_/ / / / / / \/ / /_/ / `/ \/ / / / _/_// / / / / /_ / /_/ / / / / /> < / /_/ / / / / /_/ / / / /_/ / / / / / \ /_/ /_/_/_/ _ \,_/_/ /_/\,_/ \ /_/ \ //_/ /_/ Lecture 7: file

More information

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

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011 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:

More information

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

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry Intro to Linux and C CSCI 2400/ ECE 3217: Computer Architecture Instructors: David Ferry 1 Overview Linux C Hello program in C Compiling 2 History of Linux Way back in the day: Bell Labs Unix Widely available

More information

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

Hand-on Labs for Chapter 1 and Appendix A CSCE 212 Introduction to Computer Architecture, Spring Hand-on Labs for Chapter 1 and Appendix A CSCE 212 Introduction to Computer Architecture, Spring 2019 https://passlab.github.io/csce212/ Department of Computer Science and Engineering Yonghong Yan yanyh@cse.sc.edu

More information

Warm-up sheet: Programming in C

Warm-up sheet: Programming in C Warm-up sheet: Programming in C Programming for Embedded Systems Uppsala University January 20, 2015 Introduction Here are some basic exercises in the programming language C. Hopefully you already have

More information

ch = argv[i][++j]; /* why does ++j but j++ does not? */

ch = argv[i][++j]; /* why does ++j but j++ does not? */ CMPS 12M Introduction to Data Structures Lab Lab Assignment 4 The purpose of this lab assignment is to get more practice programming in C, including the character functions in the library ctype.h, and

More information

Recitation #1 Boot Camp. August 30th, 2016

Recitation #1 Boot Camp. August 30th, 2016 18-600 Recitation #1 Boot Camp August 30th, 2016 Welcome to 18-600! Purpose of recitation Useful tools, information pertaining to the labs Hands-on activities Problem solving and exam prep Last ~30 mins

More information

Unix and C Program Development SEEM

Unix and C Program Development SEEM Unix and C Program Development SEEM 3460 1 Operating Systems A computer system cannot function without an operating system (OS). There are many different operating systems available for PCs, minicomputers,

More information

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Introduction to remote command line Linux. Research Computing Team University of Birmingham Introduction to remote command line Linux Research Computing Team University of Birmingham Linux/UNIX/BSD/OSX/what? v All different v UNIX is the oldest, mostly now commercial only in large environments

More information

Introduction to Linux. Fundamentals of Computer Science

Introduction to Linux. Fundamentals of Computer Science Introduction to Linux Fundamentals of Computer Science Outline Operating Systems Linux History Linux Architecture Logging in to Linux Command Format Linux Filesystem Directory and File Commands Wildcard

More information

Mills HPC Tutorial Series. Linux Basics I

Mills HPC Tutorial Series. Linux Basics I Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create

More information

User Guide Version 2.0

User Guide Version 2.0 User Guide Version 2.0 Page 2 of 8 Summary Contents 1 INTRODUCTION... 3 2 SECURESHELL (SSH)... 4 2.1 ENABLING SSH... 4 2.2 DISABLING SSH... 4 2.2.1 Change Password... 4 2.2.2 Secure Shell Connection Information...

More information

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011) UoW HPC Quick Start Information Technology Services University of Wollongong ( Last updated on October 10, 2011) 1 Contents 1 Logging into the HPC Cluster 3 1.1 From within the UoW campus.......................

More information

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

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C Welcome! Welcome to your CpSc 111 lab! For each lab this semester, you will be provided a document like this to guide you. This material, as

More information

Lab: Supplying Inputs to Programs

Lab: Supplying Inputs to Programs Steven Zeil May 25, 2013 Contents 1 Running the Program 2 2 Supplying Standard Input 4 3 Command Line Parameters 4 1 In this lab, we will look at some of the different ways that basic I/O information can

More information

Introduction to UNIX I: Command Line 1 / 21

Introduction to UNIX I: Command Line 1 / 21 Introduction to UNIX I: Command Line 1 / 21 UNIX Command line The UNIX Shell: command line interface Navigating Directories and Files Running applications Reminder about helpful tutorial: http://korflab.ucdavis.edu/unix_and_perl/current.html

More information

The Command Shell. Fundamentals of Computer Science

The Command Shell. Fundamentals of Computer Science The Command Shell Fundamentals of Computer Science Outline Starting the Command Shell Locally Remote Host Directory Structure Moving around the directories Displaying File Contents Compiling and Running

More information

CSci 4061 Introduction to Operating Systems. Programs in C/Unix

CSci 4061 Introduction to Operating Systems. Programs in C/Unix CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,

More information

Introduction: The Unix shell and C programming

Introduction: The Unix shell and C programming Introduction: The Unix shell and C programming 1DT048: Programming for Beginners Uppsala University June 11, 2014 You ll be working with the assignments in the Unix labs. If you are new to Unix or working

More information

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

Recitation #1 Unix Boot Camp. August 29th, 2017 18-600 Recitation #1 Unix Boot Camp August 29th, 2017 Welcome to 18-600! Purpose of recitation Useful tools, information pertaining to the labs Hands-on activities Problem solving and exam prep Last ~30

More information

CS201 - Lecture 1 The C Programming Language

CS201 - Lecture 1 The C Programming Language CS201 - Lecture 1 The C Programming Language RAOUL RIVAS PORTLAND STATE UNIVERSITY History of the C Language The C language was invented in 1970 by Dennis Ritchie Dennis Ritchie and Ken Thompson were employees

More information

Introduction to the Linux Command Line

Introduction to the Linux Command Line Introduction to the Linux Command Line May, 2015 How to Connect (securely) ssh sftp scp Basic Unix or Linux Commands Files & directories Environment variables Not necessarily in this order.? Getting Connected

More information

Projects and Environment Introduction

Projects and Environment Introduction Projects and Environment Introduction A lot to go over today History of Linux Projects Overview Project partners Programming environment Programming language Useful Tools History of Linux The Beginning:

More information

Intermediate Programming, Spring Misha Kazhdan

Intermediate Programming, Spring Misha Kazhdan 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

More information

Getting started with UNIX/Linux for G51PRG and G51CSA

Getting started with UNIX/Linux for G51PRG and G51CSA Getting started with UNIX/Linux for G51PRG and G51CSA David F. Brailsford Steven R. Bagley 1. Introduction These first exercises are very simple and are primarily to get you used to the systems we shall

More information

Tutorial 1 C Tutorial: Pointers, Strings, Exec

Tutorial 1 C Tutorial: Pointers, Strings, Exec TCSS 422: Operating Systems Institute of Technology Spring 2017 University of Washington Tacoma http://faculty.washington.edu/wlloyd/courses/tcss422 Tutorial 1 C Tutorial: Pointers, Strings, Exec The purpose

More information

Programming Tools. Venkatanatha Sarma Y. Lecture delivered by: Assistant Professor MSRSAS-Bangalore

Programming Tools. Venkatanatha Sarma Y. Lecture delivered by: Assistant Professor MSRSAS-Bangalore Programming Tools Lecture delivered by: Venkatanatha Sarma Y Assistant Professor MSRSAS-Bangalore 1 Session Objectives To understand the process of compilation To be aware of provisions for data structuring

More information

Unix Tools / Command Line

Unix Tools / Command Line Unix Tools / Command Line An Intro 1 Basic Commands / Utilities I expect you already know most of these: ls list directories common options: -l, -F, -a mkdir, rmdir make or remove a directory mv move/rename

More information

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso A layer of software that runs between the hardware and the user. Controls how the CPU, memory and I/O devices work together to execute programs Keeps

More information

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

CMPUT 201: Practical Programming Methodology. Guohui Lin Department of Computing Science University of Alberta September 2018 CMPUT 201: Practical Programming Methodology Guohui Lin guohui@ualberta.ca Department of Computing Science University of Alberta September 2018 Lecture 1: Course Outline Agenda: Course calendar description

More information

Introduction to Linux

Introduction to Linux Introduction to Linux The command-line interface A command-line interface (CLI) is a type of interface, that is, a way to interact with a computer. Window systems, punched cards or a bunch of dials, buttons

More information

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview

More information

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

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi and Cyrill Stachniss Modern C++ for Computer Vision and Image Processing Igor Bogoslavskyi and Cyrill Stachniss Outline Course introduction Linux introduction C++ syntax Hello World! 2 What you will learn in course How to

More information

Command Line Interface The basics

Command Line Interface The basics Command Line Interface The basics Marco Berghoff, SCC, KIT Steinbuch Centre for Computing (SCC) Funding: www.bwhpc-c5.de Motivation In the Beginning was the Command Line by Neal Stephenson In contrast

More information

1 Installation (briefly)

1 Installation (briefly) Jumpstart Linux Bo Waggoner Updated: 2014-09-15 Abstract A basic, rapid tutorial on Linux and its command line for the absolute beginner. Prerequisites: a computer on which to install, a DVD and/or USB

More information

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot

More information

Lab 8. Follow along with your TA as they demo GDB. Make sure you understand all of the commands, how and when to use them.

Lab 8. Follow along with your TA as they demo GDB. Make sure you understand all of the commands, how and when to use them. Lab 8 Each lab will begin with a recap of last lab and a brief demonstration by the TAs for the core concepts examined in this lab. As such, this document will not serve to tell you everything the TAs

More information

CS Fundamentals of Programming II Fall Very Basic UNIX

CS Fundamentals of Programming II Fall Very Basic UNIX CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)

More information

commandname flags arguments

commandname flags arguments Unix Review, additional Unix commands CS101, Mock Introduction This handout/lecture reviews some basic UNIX commands that you should know how to use. A more detailed description of this and other commands

More information

15-122: Principles of Imperative Computation

15-122: Principles of Imperative Computation 15-122: Principles of Imperative Computation Lab 0 Navigating your account in Linux Tom Cortina, Rob Simmons Unlike typical graphical interfaces for operating systems, here you are entering commands directly

More information

Programming Tips for CS758/858

Programming Tips for CS758/858 Programming Tips for CS758/858 January 28, 2016 1 Introduction The programming assignments for CS758/858 will all be done in C. If you are not very familiar with the C programming language we recommend

More information

Using the Debugger. Michael Jantz Dr. Prasad Kulkarni

Using the Debugger. Michael Jantz Dr. Prasad Kulkarni Using the Debugger Michael Jantz Dr. Prasad Kulkarni 1 Debugger What is it a powerful tool that supports examination of your program during execution. Idea behind debugging programs. Creates additional

More information

Intro to Linux & Command Line

Intro to Linux & Command Line Intro to Linux & Command Line Based on slides from CSE 391 Edited by Andrew Hu slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/391/ 1 Lecture summary

More information

EL2310 Scientific Programming

EL2310 Scientific Programming (yaseminb@kth.se) Overview Overview Roots of C Getting started with C Closer look at Hello World Programming Environment Discussion Basic Datatypes and printf Schedule Introduction to C - main part of

More information

CS354 gdb Tutorial Written by Chris Feilbach

CS354 gdb Tutorial Written by Chris Feilbach CS354 gdb Tutorial Written by Chris Feilbach Purpose This tutorial aims to show you the basics of using gdb to debug C programs. gdb is the GNU debugger, and is provided on systems that

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 6: Introduction to C (pronobis@kth.se) Overview Overview Lecture 6: Introduction to C Roots of C Getting started with C Closer look at Hello World Programming Environment Schedule Last time (and

More information

CSC UNIX System, Spring 2015

CSC UNIX System, Spring 2015 ` CSC 352 - UNIX System, Spring 2015 Assignment 2, due by 11:59 on Friday March 6 via gmake turnitin. Dr. Dale E. Parson, http://faculty.kutztown.edu/parson The directory, source-file and makefile contents

More information

LAB #8. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:

LAB #8. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act: LAB #8 Each lab will begin with a brief demonstration by the TAs for the core concepts examined in this lab. As such, this document will not serve to tell you everything the TAs will in the demo. It is

More information

Practical Session 0 Introduction to Linux

Practical Session 0 Introduction to Linux School of Computer Science and Software Engineering Clayton Campus, Monash University CSE2303 and CSE2304 Semester I, 2001 Practical Session 0 Introduction to Linux Novell accounts. Every Monash student

More information

Outline. Lecture 1 C primer What we will cover. If-statements and blocks in Python and C. Operators in Python and C

Outline. Lecture 1 C primer What we will cover. If-statements and blocks in Python and C. Operators in Python and C Lecture 1 C primer What we will cover A crash course in the basics of C You should read the K&R C book for lots more details Various details will be exemplified later in the course Outline Overview comparison

More information

Reviewing gcc, make, gdb, and Linux Editors 1

Reviewing gcc, make, gdb, and Linux Editors 1 Reviewing gcc, make, gdb, and Linux Editors 1 Colin Gordon csgordon@cs.washington.edu University of Washington CSE333 Section 1, 3/31/11 1 Lots of material borrowed from 351/303 slides Colin Gordon (University

More information

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

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou EECS 2031 - Software Tools Lab 2 Tutorial: Introduction to UNIX/Linux Tilemachos Pechlivanoglou (tipech@eecs.yorku.ca) Sep 22 & 25, 2017 Material marked with will be in your exams Sep 22 & 25, 2017 Introduction

More information

Creating a Shell or Command Interperter Program CSCI411 Lab

Creating a Shell or Command Interperter Program CSCI411 Lab Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell

More information

CHE3935. Lecture 1. Introduction to Linux

CHE3935. Lecture 1. Introduction to Linux CHE3935 Lecture 1 Introduction to Linux 1 Logging In PuTTY is a free telnet/ssh client that can be run without installing it within Windows. It will only give you a terminal interface, but used with a

More information

Programming in C First meeting

Programming in C First meeting Programming in C First meeting 8.9.2016 Tiina Niklander Faculty of Science Department of Computer Science www.cs.helsinki.fi 8.9.2016 1 Course structure Weekly exercise deadline on Wednesday, lectures

More information

Programming the DMCC in C

Programming the DMCC in C Programming the DMCC in C Task This tutorial will teach you how to write your first program on a dual motor control cape (DMCC) through the BeagleBone microcontroller. The DMCC is a stackable board that

More information

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems Programs CSCI 4061 Introduction to Operating Systems C Program Structure Libraries and header files Compiling and building programs Executing and debugging Instructor: Abhishek Chandra Assume familiarity

More information

System Programming. Introduction to Unix

System Programming. Introduction to Unix Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Introduction

More information

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

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University Lecture 4 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation 27-Sep-2017 Location: Goldberg CS Building Time: Wednesday, 16:05

More information

Project 2: Shell with History1

Project 2: Shell with History1 Project 2: Shell with History1 See course webpage for due date. Submit deliverables to CourSys: https://courses.cs.sfu.ca/ Late penalty is 10% per calendar day (each 0 to 24 hour period past due). Maximum

More information

Dynamic memory allocation

Dynamic memory allocation Dynamic memory allocation outline Memory allocation functions Array allocation Matrix allocation Examples Memory allocation functions (#include ) malloc() Allocates a specified number of bytes

More information

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

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011 Unix/Linux Operating System Introduction to Computational Statistics STAT 598G, Fall 2011 Sergey Kirshner Department of Statistics, Purdue University September 7, 2011 Sergey Kirshner (Purdue University)

More information

CMSC 201 Spring 2017 Lab 01 Hello World

CMSC 201 Spring 2017 Lab 01 Hello World CMSC 201 Spring 2017 Lab 01 Hello World Assignment: Lab 01 Hello World Due Date: Sunday, February 5th by 8:59:59 PM Value: 10 points At UMBC, our General Lab (GL) system is designed to grant students the

More information

Recitation: C Review. TA s 20 Feb 2017

Recitation: C Review. TA s 20 Feb 2017 15-213 Recitation: C Review TA s 20 Feb 2017 Agenda Logistics Attack Lab Conclusion C Assessment C Programming Style C Exercise Cache Lab Overview Appendix: Valgrind Clang / LLVM Cache Structure Logistics

More information

Linux Command Line Interface. December 27, 2017

Linux Command Line Interface. December 27, 2017 Linux Command Line Interface December 27, 2017 Foreword It is supposed to be a refresher (?!) If you are familiar with UNIX/Linux/MacOS X CLI, this is going to be boring... I will not talk about editors

More information

CS11001/CS11002 Programming and Data Structures Autumn/Spring Semesters. Introduction

CS11001/CS11002 Programming and Data Structures Autumn/Spring Semesters. Introduction Title page CS11001/CS11002 Programming and Data Structures Autumn/Spring Semesters Introduction Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Last modified: July

More information

1. The Mac Environment in Sierra Hall 1242

1. The Mac Environment in Sierra Hall 1242 Wednesday, August 26, 2015 Lab Notes Topics for today The Mac Environment C (and Unix) Notes on C Part 1 Program 1 1. The Mac Environment in Sierra Hall 1242 a. Turning on the Mac If the Mac is in sleep

More information

CSE 351. Introduction & Course Tools

CSE 351. Introduction & Course Tools CSE 351 Introduction & Course Tools Meet Your TA TA Name Interesting information examples: Where you are from Year in school Hobbies Unique talents Introductions Pick an interesting (but quick) ice breaker

More information

Sep 12, 2006 Lecture 2: System Programming

Sep 12, 2006 Lecture 2: System Programming Sep 12, 2006 Lecture 2: System Programming September 19, 2007 1 Introduction In this lecture, we will introduce the basics of systems programming using the language of choice C language. We also introduce

More information

Introduction. File System. Note. Achtung!

Introduction. File System. Note. Achtung! 3 Unix Shell 1: Introduction Lab Objective: Explore the basics of the Unix Shell. Understand how to navigate and manipulate file directories. Introduce the Vim text editor for easy writing and editing

More information

CS 261 Recitation 1 Compiling C on UNIX

CS 261 Recitation 1 Compiling C on UNIX Oregon State University School of Electrical Engineering and Computer Science CS 261 Recitation 1 Compiling C on UNIX Winter 2017 Outline Secure Shell Basic UNIX commands Editing text The GNU Compiler

More information

CS CS Tutorial 2 2 Winter 2018

CS CS Tutorial 2 2 Winter 2018 CS CS 230 - Tutorial 2 2 Winter 2018 Sections 1. Unix Basics and connecting to CS environment 2. MIPS Introduction & CS230 Interface 3. Connecting Remotely If you haven t set up a CS environment password,

More information

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

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab Basic Terminal Intro to Linux ssh short for s ecure sh ell usage: ssh [host]@[computer].[otheripstuff] for lab computers: ssh [CSID]@[comp].cs.utexas.edu can get a list of active computers from the UTCS

More information

LAB #8. Last Survey, I promise!!! Please fill out this really quick survey about paired programming and information about your declared major and CS.

LAB #8. Last Survey, I promise!!! Please fill out this really quick survey about paired programming and information about your declared major and CS. LAB #8 Each lab will begin with a brief demonstration by the TAs for the core concepts examined in this lab. As such, this document will not serve to tell you everything the TAs will in the demo. It is

More information

Using the Zoo Workstations

Using the Zoo Workstations Using the Zoo Workstations Version 1.86: January 16, 2014 If you ve used Linux before, you can probably skip many of these instructions, but skim just in case. Please direct corrections and suggestions

More information

CS11002 Programming and Data Structures Spring Introduction

CS11002 Programming and Data Structures Spring Introduction Title page CS11002 Programming and Data Structures Spring 2008 Goutam Biswas Abhijit Das Dipankar Sarkar Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Jan 04, 2008

More information

Session 1: Accessing MUGrid and Command Line Basics

Session 1: Accessing MUGrid and Command Line Basics Session 1: Accessing MUGrid and Command Line Basics Craig A. Struble, Ph.D. July 14, 2010 1 Introduction The Marquette University Grid (MUGrid) is a collection of dedicated and opportunistic resources

More information

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

Computers and Computation. The Modern Computer. The Operating System. The Operating System The Modern Computer Computers and Computation What is a computer? A machine that manipulates data according to instructions. Despite their apparent complexity, at the lowest level computers perform simple

More information

CS101 Linux Shell Handout

CS101 Linux Shell Handout CS101 Linux Shell Handout Introduction This handout is meant to be used as a quick reference to get a beginner level hands on experience to using Linux based systems. We prepared this handout assuming

More information

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

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University Introduction to Linux Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating system of a computer What is an

More information

Week 1: Linux Intro. The Command Line Interface

Week 1: Linux Intro. The Command Line Interface Linux is an operating system. What does that mean? One definition of an operating system is that it is an environment within which other programs can do useful work. Microsoft Windows and Apple OS X are

More information