CS2211b.pdf - How to Run UNIX Commands PuTTY WinSCP 46 How...

This preview shows page 1 out of 724 pages.

Unformatted text preview: How to Run UNIX Commands PuTTY & WinSCP 46 How to Run Unix Commands Supported • Using the computers in MC244 – Need key card (your student id) – Need GAUL password • Remote connection to course server – Need GAUL password – Need SSH client – Hostname: cs2211b.gaul.csd.uwo.ca – Details to be posted when course server is online How to Run UNIX Commands 47 How to Run Unix Commands Unsupported • • • • • Install Linux on your own computer Use a Virtual Machine (VM) Use the Windows Linux Subsystem (WSL) Run a LiveCD Use a Mac For instructions see the "Options for Using Linux at Home" document on OWL (Week 1 tab) How to Run UNIX Commands 48 Secure Shell (ssh) With GUI • ssh clients available for Windows (not built in). • Allow you to connect to a remote UNIX machine/server. • Both command line and GUI based. • Recommended: PuTTY ( ) • Other SSH clients for Windows: • Bitvise: • SmarTTY: • Many others How to Run UNIX Commands 49 Secure Shell (ssh) With GUI (Windows/PuTTY) Course Server Hostname Port is always 22 Connection type is always SSH Click "Open" to start How to Run UNIX Commands 51 Secure Shell (ssh) With GUI (Windows/PuTTY) Click "Yes" if you get this screen (only first time you connect) How to Run UNIX Commands 52 Secure Shell (ssh) With GUI (Windows/PuTTY) Type in your username when asked and hit enter. Type in your GAUL password and hit enter. IMPORTANT: No * or letters will be shown as you type your password. This is an intentional security feature. How to Run UNIX Commands 53 Secure Shell (ssh) With GUI (Windows/PuTTY) Successful Login Type commands here (not GUI based) How to Run UNIX Commands 54 Change Your Password! First thing you should do is change your password using the passwd command: Will not show password as you type How to Run UNIX Commands 55 Secure Copy (scp) With GUI • scp programs available for Windows (not built in). • Allow you to copy files to/from a remote machine/server. • Both command line and GUI based. • Recommended: WinSCP ( ) • Course server also supports SSH File Transfer Protocol (SFTP). • Many SFTP clients for Windows: • WinSCP (also supports SFTP) • FileZilla: How to Run UNIX Commands 56 Secure Copy (scp) With GUI (Windows/WinSCP) Course Server Hostname Same GAUL Credentials How to Run UNIX Commands 58 Secure Copy (scp) With GUI (Windows) Local Files on Left Remote Files on Right How to Run UNIX Commands 59 CS2211b Software Tools and Systems Programming Week 1a IntroductionIntroduction to CS2211 to CS2211 1 Instructor Daniel Servos E-Mail: [email protected] Office: MC 25 Office Hours: – Tuesday 11:00AM to 12:00PM (by appointment) – Thursday 12:30PM to 2:30PM (by appointment) Sign up for office hours on OWL Background Bachelor’s in Computer Science Master’s in Computer Science PhD Candidate (Computer Science) Introduction to CS2211 2 Teaching Assistants Teaching Assistant (TA) contact information and consulting hour details will be posted on OWL when available. TA consulting hours start January 14th. Introduction to CS2211 3 Course Description “An introduction to software tools and systems programming. Topics include: understanding how programs execute (compilation, linking and loading); an introduction to a complex operating system (UNIX); scripting languages; the C programming language; system calls; memory management; libraries; multi-component program organization and builds; version control; debuggers and profilers.” Introduction to CS2211 4 In Practice • • • • • Using Unix/Linux via the command line Writing shell scripts Lots of C programming Debugging Managing big programs Introduction to CS2211 5 Why Unix & Linux? Introduction to CS2211 6 Why Unix & Linux? As of December 2018 Source: StatCounter GlobalStats Introduction to CS2211 7 Why Unix & Linux? Servers Introduction to CS2211 8 Why Unix & Linux? Introduction to CS2211 9 Why Unix & Linux? As of January 6th, 2019 Source: W3Techs Introduction to CS2211 10 Why Unix & Linux? As of November, 2018 Source: TOP500 Introduction to CS2211 11 Why Else? Introduction to CS2211 12 Why Else? • Many Devices are Unix Based (Unix Like): – Mobile Devices • Android (Linux) • iOS (Unix/BSD) – Macs (Unix/BSD) – Embedded Systems • Routers, Switches, etc. • Smart TVs (Android/Linux) – Video Game Consoles • PS4, PS3, PSP, etc. (Unix Like) Introduction to CS2211 13 Course Site OWL ASK Tool • • In-class Response Tool • • Main course site – Syllabus – Lecture notes – Assignments (posted and submitted) – Forums – Weekly readings and Tasks – Lab documents – Announcements – Office Hour Appointments – Ask questions live – Submit group work – Submit participation ticket – Live polls Introduction to CS2211 14 Textbooks UNIX Sumitabha Das, Your UNIX/LINUX: The Ultimate Guide. McGraw Hill, Third Edition. C K. N. King, C Programming: A Modern Approach. W. W. Norton, Second Edition. Introduction to CS2211 15 Assigned Readings • Weekly readings will be posted to OWL each week • Each week will have its own tab on OWL: For Week 1: Introduction to CS2211 16 Assigned Readings • Practice questions will also be posted. • For week 1: – UNIX Chapter 1 Exercises: 1.9, 1.10, 1.14 – UNIX Chapter 2 Exercises: 2.3, 2.4, 2.12, 2.13, 2.19, 2.23, 2.24, 2.26 Introduction to CS2211 17 Student Evaluation Element Assignments (4) Labs (11) Quizzes (4) Participation Midterm Exam Final Exam Weight 25% 10% 5% 10% 25% 25% Introduction to CS2211 18 Student Evaluation Element Assignments (4) Labs (11) Quizzes (4) Participation Midterm Exam Final Exam Weight 25% 10% 5% 10% 25% 25% This course will have a participation grade! Introduction to CS2211 19 Why Participation / Active Learning? • Evidence shows active learning benefits students (even in CS courses): – J. J. McConnell, "Active learning and its use in computer science", ACM SIGCSE Bulletin, vol. 28, no. SI, pp. 52-54, 1996. – J. Pirker, M. Riffnaller-Schiefer, and C. Gutl, "Motivational active learning: engaging university students in computer science education", in Proceedings of the 2014 conference on Innovation & technology in computer science education, pp. 297-302, ACM, 2014. • Computer Science is a highly collaborative field. In the "real world" you will be expected to work in groups on complex programming and technical problems. Introduction to CS2211 20 Build Your Own Participation Mark Introduction to CS2211 21 Build Your Own Participation Mark Preparation & Readings: • Up to 50 marks (out of 100) • Primarily based on doing OWL activities and weekly tasks Introduction to CS2211 22 Build Your Own Participation Mark In-class Activities & Engagement: • Up to 50 marks (out of 100) • Primarily based on doing In-class activities Introduction to CS2211 23 Build Your Own Participation Mark Class Discussion and Answering Questions: • Up to 25 marks (out of 100) • Primarily based on answering questions and participating in discussions in-class. Introduction to CS2211 24 Build Your Own Participation Mark In-Class Response System: • Up to 25 marks (out of 100) • Asking questions via the Ask Tool ( ) • Answering questions via the Ask Tool • Questions and answers need to be of good quality, not based on quantity (don't spam it). Introduction to CS2211 25 In-Class Ask Tool cs1.ca/ask • Ask questions electronically during class • Submit group work during class • Submit participation ticket Introduction to CS2211 26 Assignments • • • • 4 assignments Posted and submitted on OWL Assignments must work on course server! Must be your own individual work – Never share your assignments – Do not ask to look at other's assignments – Large penalty for scholastic offences • Penalty for late assignments (zero after 48 hours) Introduction to CS2211 27 Assignments • First will be posted to OWL on January 22nd • More details in course syllabus, dates are tentative (subject to change). • Up to you to backup your assignments, including files on the course server! Introduction to CS2211 28 Backups Use remote backups! Introduction to CS2211 29 Mark Adjustments • Must be made within 1 week of receiving the assignment back • Must have grounds for appeal • Bring the issue up with the TA who marked the assignment • May further appeal to instructor if discussion with TA is unsatisfactory • Marks final after 1 week Introduction to CS2211 31 Labs • • • • 11 labs worth 10% of your grade in total Start next week (the week of the 14th) Held in MC244, 1 hour long Lab documents/instructions posted on OWL (on that week's tab) • Run by TAs • TA will assign mark based on Lab Rubric (found in syllabus) • Need to demonstrate understanding of material in addition to completing work correctly for full mark. Introduction to CS2211 32 Middlesex College, 2nd floor, room 244 Introduction to CS2211 33 Labs • • • • Have to go to the session you are registered in No make up labs First lab on SSH and basic commands More details in syllabus Introduction to CS2211 34 Exams Midterm • • • • Worth 25% Friday March 1st at 7:00PM (tentative) 3 Hours Topics will mainly be UNIX and Shell Scripting Final • • • • Worth 25% In exam period 3 Hours Not comprehensive, topics will mainly be C Programming Introduction to CS2211 35 Exams • May cover content in lectures, readings, assignments and labs • Mixed format: – Multiple choice (scantron) – Short answer – Programming questions • No electronics: – No calculators – No computers, laptops or phones – No smart watches – Etc. Introduction to CS2211 36 Quizzes • Up to four pop quizzes (no warning) • Given in-class • May cover assigned readings not yet covered in-class • Will be multiple choice IF-AT tests • Partial marks for wrong answers (based on number of scratches) • Some quizzes may be group based Introduction to CS2211 37 How to Get Help Have a question/problem? Follow these steps (in order): 1. Check course content: notes, readings, text book, OWL announcements 2. Look at course forums (maybe someone had the same problem) 3. Try Rubber Duck Debugging! 4. Try Google 5. Post on the OWL course forums 6. E-Mail a TA or go to TA consulting hours 7. E-Mail the course instructor / set up appointment Introduction to CS2211 38 What is Rubber Duck Debugging? Introduction to CS2211 39 Rubber Duck Debugging The rubber duck debugging method is as follows: 1. Beg, borrow, steal, buy, fabricate or otherwise Obtain a rubber duck (bathtub variety). 2. Place rubber duck on desk and inform it you are just going to go over some code with it, if that’s all right. 3. Explain to the duck what your code is supposed to do, and then go into detail and explain your code line by line. 4. At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing. The duck will sit there serenely, happy in the knowledge that it has helped you on your way. From: RubberDuckDebugging.com Introduction to CS2211 40 Cargo Cult Programming • Programming style involving the inclusion of code that serves no purpose • Symptomatic of a programmer not understanding the problem they are solving or the code they are using • Often caused by copying code they do not understand • Should be avoided / need to understand the code you are using. Introduction to CS2211 41 Scholastic Offences & Academic Dishonesty • See sections 10 and 11.1 of course Syllabus • Penalty is severe for first offence: – 0% on assignment plus a penalty equal to the worth of the assignment – Example: if the assignment is worth 5% you would lose 10% of your final grade (0% on assignment plus 5% penalty). • Second offence is 0% overall course grade. Introduction to CS2211 42 In-class Activity In pairs (or groups of 3) discus the following cases. Are they a scholastic offence? Who is at fault? 1. Eve is having trouble with an assignment and asks her friend Alice to send what she has so far so she can get started. Alice sends Eve a few lines of her code to give Eve a template to start with. 2. Bob and Dave work together on a Lab. They both write their own solutions but share their code and help each other as they go. 3. Carlos is going to miss the next CS2211 lecture so he asks his friend Chuck to text him the Group Work Code so he can get credit for participation. Chuck does so during the next lecture. Introduction to CS2211 43 CS2211b Software Tools and Systems Programming Week 1b Introduction to UNIX Part 2 Introduction to CS2211 1 Announcements TAs • Consulting hours to be posted on OWL, will be held in MC244 • Do not need to book an appointment for TA hours Announcements 2 Announcements Course Server Online! Hostname: cs2211b.gaul.csd.uwo.ca SSH Port: 22 Username: Your UWO username (same as e-mail and OWL) Password: Your GAUL password (e-mailed to you) To reset/resend GAUL password fill out this form: See the "How to Connect to the Course Server" document for more details (added to Week 1 tab under assigned readings). Announcements 3 Announcements Course Server Online! If your GAUL account is not yet setup use the guest account: Username: cs2211 Password: cs2211-2019 • Expires January 30th • Can use for first labs, but need working account by end of month. • Need working account for assignments. Announcements 4 Announcements Labs Start Next Week! • Must go to lab you are registered in. • You are expected to be prepared for the lab: ▪ Read the assigned readings. ▪ Read the lab document. ▪ Start some of the lab at home if you do not think you will finish in time. • Will not receive a full mark if you do not finish the lab in time (less then one hour with intro and time for TA to get around to everyone). Announcements 5 Announcements Week 2 Tab Now Available • Your first lab document will be there • New readings and tasks for next week Announcements 6 Introduction to UNIX/Linux What Is An Operating System? Without an OS What do you do with just computer hardware? • If someone gives you a computer with no software whatsoever, how do you get it to do anything? • You write a program that runs on the hardware In the early days, that was the way it worked ... • You started with just the bare hardware • You wrote a program that did everything: − Including managing all aspects of the hardware − Including solving your particular problem Your program was all the computer did! Introduction to UNIX/Linux 8 What Is An Operating System? Without an OS Program Hardware • Each program runs directly on the hardware • Each program must do everything • Each program needs to know the details of the hardware and how to use it • If the hardware changes, the program must change as well • The hardware supports only one program at a time - each user must wait until the previous program is done to “share” the hardware with other users. • Writing programs is incredibly complex and expensive Introduction to UNIX/Linux 9 What Is An Operating System? 40s to mid 50s ENIAC 1946 Introduction to UNIX/Linux 10 What Is An Operating System? Mid 50s to mid 60s Introduction to UNIX/Linux 11 What Is An Operating System? Mid 50s to mid 60s Introduction to UNIX/Linux 12 What Is An Operating System? IBM Type 29 Card Punch (1964) Introduction to UNIX/Linux 13 What Is An Operating System? Demo The Virtual Keypunch Site: Introduction to UNIX/Linux 14 What Is An Operating System? With an OS Program Operating System Hardware • Operating system runs directly on the hardware • Operating system is in charge of managing the hardware • Operating system hides the details of hardware from software provides a much simpler interface for programs Introduction to UNIX/Linux 15 What Is An Operating System? Benefits of OSs Program Operating System Hardware • An operating system hides the hardware − Programs are portable − Programs are hardware-independent • An operating system manages the computer − Programming is easier − Using a computer is easier - you no longer need to program or be an expert to use it • An operating system facilitates resource sharing − Several programs can run at once − Simultaneous users Introduction to UNIX/Linux 16 What Is An Operating System? Parts of an OSs Users Shell GUI Programs Kernel Hardware • Divided into two parts − Kernel − Shell • The kernel is the core of the operating system − Interacts with the hardware − Programs communicate with the kernel to access the hardware − Manages memory, schedules processes, decides priorities and other tasks Introduction to UNIX/Linux 17 What Is An Operating System? Kernel Types • One very large program • Performs everything by it’s self • Fast and efficient • Difficult to design and maintain Microkernels • A much smaller program • Performs the most basic tasks only • To perform more functions, calls upon a set of other programs • Slower and less efficient • Easier to design and maintain UNIX, UNIX-like, Linux, BSD, DOS, etc. Some embedded systems, mostly no longer used. Monolithic Kernels Introduction to UNIX/Linux 18 What Is An Operating System? Introduction to UNIX/Linux 19 What Is An Operating System? Parts of an OSs Users Shell GUI Programs Kernel Hardware • The shell is a special type of program (a command processor) that acts as an interface to the system for users − Interface between users and the kernel − Can have several shells but only one kernel running at a time − Shell interprets text based commands from the user − Examples UNIX/Linux shells: ▪ sh ▪ csh ▪ bash ▪ tcsh Introduction to UNIX/Linux 20 What Is An Operating System? Parts of an OSs Users Shell GUI Programs Kernel Hardware • Optionally an OS can have a Graphical User Interface (GUI) − Provides graphical interface for users to interact with programs and the kernel − Essentially a mouse/graphics based shell − Makes OS usable by non experts − For UNIX/Linux, a popular GUI is the X Window System Introduction to UNIX/Linux 21 What Is An Operating System? Parts of an OSs Users Shell GUI Programs Kernel Hardware • OS may be prepackaged with many utility programs • Utility programs allow users to do things like edit files, communicate with each other, develop programs, etc. • UNIX examples: who, wc, grep, man • Users may also install or create their own programs (user programs) • Programs can use other programs, shell commands or call the kernel directly. Introduction to UNIX/Linux 22 What Is An Operating System? A UNIX OS Users Shell GUI Programs Kernel Hardware • A UNIX OS generally has… • A single kernel running at a time • One or more shells • GUI is optional • Prepackaged utility programs • A monolithic kernel • Multiple users simultaneously (multiuser) • Multiple programs running simultaneously (multitasking) Introduction to UNIX/Linux 23 In-class Activity In groups of 2 or 3 answer the following question: Based on what you have read in the assigned readings, seen in this lecture and your experience with UNIX/Linux so far, what differences have you noticed between Windows and UNIX/Linux? Introduction to UNIX/Linux 24 List the differences between UNIX/Linux and Windows Time Remaining 0 0 0 45 021345 9876543210 Hours Minutes Introduction to UNIX/Linux Seconds List the differences between UNIX/Linux and Windows Time Remaining 0 0 0 34 021345 9876543210 Hours Minutes Introduction to UNIX/Linux Seconds List the differences between UNIX/Linux and Windows Time Remaining 0 0 0 23 021345 9876543210 Hours Minutes Introduction to UNIX/Linux Seconds List the differences between UNIX/Linux and Windows Time Remaining 0 0 0 12 021345 9876543210 Hours Minutes Introduction to UNIX/Linux Seconds List the differences between UNIX/Linux and Windows Time Remaining 0 0 0 01 021345 9876543210 Hours Minutes Introduction to UNIX/Linux Seconds List the differences between UNIX/Linux and Windows Time Remaining 00 00 00 Hours Minutes Introduction to UNIX/Linux Seconds Brief UNIX History The Unix Timeline Site: Introduction to UNIX/Linux 32 Introduction to UNIX/Linux 33 1969 • Ken Thompson and Dennis Ritchie of AT&T labs author the first UNIX system • Written in assembly language for one specific machine Introduction to UNIX/Linux 34 1974 • UNIX was rewritten in C (created by Ritchie) • By writing ...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture