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

Size: px
Start display at page:

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

Transcription

1 Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit Contents 1 An Introduction to C++, Unix, SSH and Komodo Edit 1.1 Introduction 1.2 The C++ Language A Brief Introduction Recommended Reading Use of C Relevant Computer Systems History 1.4 Komodo - Creating a C++ Program 1.5 C++ - Program Components 1.6 SSH 1.7 Unix vs Windows Directory Structure Unix Process Commands Unix Directory and File Commands 1.8 File Transfer 1.9 Compiling and Executing a C++ Program The C++ Compilation Process - from Source Code to Executable Code Compile and Execute the hello.cpp Program 1.10 Unix - The vi Editor 1.11 Using Switches with the clang++ Compiler 1.12 Appendix: Some Useful Linux Commands Introduction This lab will introduce the programming environment used in this course. Topics Covered in this Lab: Brief Introduction to the C++ Language Unix and the GNU C++ compiler SSH and File Transfer Creating, saving, compiling, and executing programs Basic C++ program structure The course website and submitting programs Questions Answered in this Lab: How is a program file opened or created? What does a compiler do with a program? What do the different pieces of a program do? How does a computer program communicate with a user? Demonstrable Skills Acquired in this Lab: The C++ Language A Brief Introduction Ability to create a simple C++ program Ability to compile and run a program Familiarity with console output, specifically C++'s cout Familiarity with Unix, the Unix file system and directories. Development of C++ began in 1979 by Bjarne Stroustrup, then employed by AT&T Bell Labs. His goal was to combine the program organization of Simula, the speed of BCPL programs along with BCPL's ease of linkage and C's efficiency, flexibility and portability. Originally titled C with Classes, the name C++, suggested by Rick Mascitti, was adopted in By 1988 the number of users and number of implementations of C++ indicated a need for standardization. To start the process, Stroustrup, with assistance from Margaret Ellis, wrote The Annotated C++ Reference Manual which was reviewed by approximately one hundred C++ language users from various organizations. The organizational meeting of the ANSI (American National Standards Institute) C++ committee was held in December of 1989 with international attendees. In June 1991, the ISO (International Organization for Standardization) C++ committee convened with a majority of representatives being C++ programmers. The first ISO/IEC C++ standard was released in This standard is informally referred to as C++98. While there have been minor revisions since 1998, the language itself was not changed until C++11, the standard released in This information was gathered from various sources including those listed in the Recommended Reading section below. Recommended Reading Use of C C++ can be used for many diverse applications. The following links provide specific companies and products written partially or entirely in C

2 Relevant Computer Systems History Many of the tools discussed here were originally part of the UNIX operating system, but are now available in other operating systems that provide a UNIX-like interface. For that reason, we will use the term "Unix" (not all uppercase) to refer to any UNIX-like system. These tools have an interesting history that you should read as time permits. In addition, click here to read about Komodo Edit. Komodo - Creating a C++ Program A simple program to write the traditional "Hello, World!" message will be created in this section. 1. Open Komodo Edit. When Komodo opens, click the File menu and choose Save As. Using the drop-down box labeled "Save in", find the folder that is your home directory (or your Student Files folder if you changed to it). This is where you will probably want to save your files. You can copy or move them later if necessary. For now, save the file as hello.cpp to your documents folder. 2. Modify the comments as needed, otherwise, type the following code exactly as it appears. Code Illustration 3. Save the changes. C++ - Program Components In this section, each part of the program is examined in detail. 1. The first section of the program, consisting of the lines starting with "//", is a comment block. This is where the program name, author name, description of what the program is to do, and other related information are to be placed. See the course's documentation guidelines for more information. Comment lines may be placed anywhere deemed useful in the program. When "//" is encountered on a line, the compiler ignores everything on the rest of that line. 2. #include <iostream> This is a preprocessor directive which tells the compiler that information in the header file iostream is needed to make this program work; iostream allows programs to write to the screen and read from the keyboard using the identifiers cout and cin, respectively. 3. using std::cout; This specifies to the compiler where cout is defined; std is a namespace, but it is not necessary to go into more detail at this time. 4. int main () The next line starts the vital part of the program, the function main. This line tells the compiler that the following function is named main and that it will return an integer value. Every console-based program must have a function named main. 5. Braces { and } enclose the body of function main. Everything inside the braces makes up the body of the function. This is where the computer is told what steps to take to solve the problem. 6. cout << "Hello, World!\n"; This line does the significant work of this program. It sends the character string "Hello World!\n" to the standard output stream, cout, which is in effect the display (or "c"onsole "out"put) 1. The stream insertion operator << causes anything to its right to be inserted into the stream on its left, in this case cout. The escape sequence character '\n' indicates the end of a line, which moves the cursor to the beginning of the next line as if the enter key had been pressed when typing. (For more escape sequences, refer to the textbook.) 7. return 0;

3 This line returns the value zero from this program to the program that initiated it, usually the operating system. The value returned can be used to indicate the completion status of the program. Values other than zero are typically used to indicate an error condition. Every program in this course will return zero. 1Actually, according to [Stroustrup], the "c" in cout means "character"; either mnemonic will work fine though. SSH We will be compiling and executing our programs via a remote server. Historically, a two-way, text-only connection between a local computer and a remote server was accomplished with Telnet. Telnet has no security measures; as a result, passwords are passed in plain-text format for verification. We will access the server for this course in a more secure manner using SSH (Secure Shell). SSH uses encryption so passwords are no longer passed across the Internet in plain-text form. 1. Start MobaXterm (Start, All Programs, MobaXterm, MobaXterm) 2. From the Sessions tab in the left pane, click New session. 3. Click the SSH button, and type or copy the server's address (provided by your instructor) into the 'Host' box 4. Check the box next to 'Specify username' and type your account logon into the 'Specify username' box; this is the first part of your A-State address, probably firstname.lastname 5. Click OK. This will create an entry in the Sessions pane so that you won't have to enter this information again. 6. Enter your password when prompted. You should now be connected to the remote course server. Before closing a secure shell window, be sure to log off the remote server by executing the command logout. Unix vs Windows Directory Structure The Microsoft term folder corresponds to a directory in Unix. The Unix file system begins at a location called the root. This directory has the path name "/". Everything on the computer system that can be accessed through the filesystem is available within sub-directories starting with root. This is quite different from Windows, where the file system is based on disk drives. Windows paths begin with a drive letter, with sub-directories below it. In Unix, the drives are just parts of the whole system, and are listed below root (exactly where can vary from one system to another). Unix Process Commands In Unix, each running task is considered a process. To view a list of processes, type ps and press Enter. $ ps PID TTY TIME CMD 887 pts/0 00:00:00 bash 909 pts/0 00:00:00 ps The exact list will depend on what tasks are currently running. In the above list, two process, bash and ps, are associated with the current user. ps is the command used to generate the list while bash is the shell in which the command was executed. The bash process has an ID of 887 while the ps process has an ID of 909. If a process "hangs", you can use the kill command to stop the process. As an example, if the process with the ID of 892 needs to be stopped, type kill 892 $ kill 892 Unix Directory and File Commands When you first logon to Unix, it will open up the shell in your "home" directory. In most Unix systems, the "home" directory is "/home/your_username". The pwd command will display the location of the current diretory. Type pwd and press Enter to see what the full path of your home directory is. $ pwd /home/user.name/ The exact directory may differ depending on how Unix is set up. The mkdir command will create a new directory (folder). Enter mkdir sp01 to make a directory named sp01 corresponding to lab 01 for Structured Programming $ mkdir sp01 The ls command will display a listing of the files and directories of the current directory. Enter ls (that is a lowercase L followed by an s) to see a listing of the current directory's files and folders. $ ls sp01 Enter ls sp01 to verify that no files are present in the new directory. The cd command will change to a different directory. Enter cd sp01 to change directories from the current directory to sp01. $ cd sp01 Note that after using cd, the command prompt now says you are in directory sp01 under the previous directory you were in (in this case, the

4 home directory ~). /sp01 $ _ There is a shortcut name for your home directory. It is "~". You can change directories to your home directory simply by typing "cd" at the command window... This is the same as "cd ~", or "cd" followed by the full path to your home directory. FOR IN-LAB CREDIT: Demonstrate to a lab proctor your ability to logon to the server and change to the sp01 directory. (Logout and close the MobaXterm program before demonstrating this checkpoint.) File Transfer In order to place the file completed earlier with the Komodo Edit software on the remote server, we will need to access the file transfer portion of the MobaXterm software. 1. Start MobaXterm if it isn't already started, or switch to it if it is running. (Start, All Programs, MobaXterm, MobaXterm) 2. From the Sessions tab in the left pane, click New session. 3. Click the SFTP button, and click OK. 4. Type or copy the server's address (provided by your instructor) into the 'Remote hostname' box 5. Type your account logon into the 'Username' box. 6. Click OK. This will create an entry in the Sessions pane so that you won't have to enter this information again. 7. Enter your password when prompted. 8. You should now see a tab with the server on the right (the larger pane) and your local machine on the two panes to the left. You may simply drag-and-drop files from your machine to the server (and vice-versa). 9. Drag-and-drop the hello.cpp file into the sp01 directory on the server. Note: It is also possible to open and save files directly from the Unix server using only Komodo. From the File menu, select Open - Remote File to open a file from a remote server. To save a new file to a remote server, choose File - Save As Other - Remote File. Use Komodo Help (or ask your instructor) to assist you in adding the remote server to the Accounts list. It is still a good idea to keep a copy of the file both on the remote server and in a local storage location. FOR IN-LAB CREDIT: Demonstrate the presence of the hello.cpp file in the sp01 directory to a lab proctor. Compiling and Executing a C++ Program

5 The C++ Compilation Process - from Source Code to Executable Code The program code typed by the user is called source code and is stored in a text file called the source file. When compilation begins, the preprocessor reads the source code searching for the # symbol; the # symbol indicates a preprocessor directive. There are several preprocessor directives. Research preprocessor directives or review CPlusPlus's Preprocessor Directives for a tutorial. The preprocessor directive demonstrated in the hello.cpp program is the include directive. This directive gives a programmer access to previously written code. The filename specified, in this case iostream, is called a header file. Header files contain declarations of functions and possibly constants that can be used by a program once it has been included. The modified source code is then compiled. The compiler converts the modified source to object code, considered to be machine-language. Any deviation in syntax will confound the compiler; these errors are reported to the programmer and the entire compilation process is halted. Once any syntax errors have been corrected and the object code created, the next step is to link all necessary object code files to create an executable file. This is the job of the linker. Once created, the executable file may be executed as many times as required without the need to recompile. If a change is necessary, the compilation process must be revisited. Compile and Execute the hello.cpp Program Unix supports clang, a free C++ compiler. It can convert the human-readable source code created in the previous section into machine-executable program code. Before submitting any program, you should first verify it will compile and execute correctly; thorough testing is important. When you have finished editing the file, save it (in Komodo), transfer it to the server, then switch to the SSH window. 1. Compile and Link: Compile and link the program with clang++ hello.cpp. If there are no errors, Unix will simply display another prompt. (Most Unix programs are quiet rather than verbose.) If there are errors, seek assistance from a lab proctor. /sp01 $ clang++ hello.cpp If clang++ does not print anything then everything is OK. 2. Display a listing of the current directory's files. The list should include hello.cpp as well as a.out, which is the default name for an executable program. 3. Execute: Enter./a.out (period followed by /a.out) or possibly just a.out to execute the program. (The single period is the path name for the current directory; if it is not present in the system path variable, you must explicitly include it to specify the program's location.) /sp01 $./a.out Hello World! 4. Compile and Link - specify executable filename: Enter clang++ -o speak hello.cpp to give the executable the name speak; execute it with./speak. FOR IN-LAB CREDIT: Demonstrate the speak program for a lab proctor. With a lab proctor present, execute the speak program.

6 Unix - The vi Editor For the sake of tradition, every computer science student should be familiar with the vi editor, the historic (1975) piece of software that was used by many early Unix programmers to write their programs; there are traditionalists who continue to use vi to this day. (The name vi is pronounced vee-eye; it is an abbreviation of the word visual.) You may wish to review Mastering the vi Editor for detailed instructions on how to use the vi editor. Unlike visual editors such as Windows' Notepad, vi uses character commands to manipulate file content. A minimal set of character commands follows: Command i a Esc :wq :q! u x dd Action insert mode (inserts before the character under cursor) append mode (inserts after the character under cursor) leave (escape) insert or append mode write file to disk and quit (:w means "write", :q means "quit") quit without saving any changes undo (only when not in insert or append mode) delete character under cursor (only when not in insert mode) delete current line Use the vi editor to write the program sp01il.cpp. 1. At the Unix command prompt, move to the sp01 directory, if necessary, and type vi sp01il.cpp and press Enter. /sp01 $ vi sp01il.cpp This command will open the file sp01il.cpp in the vi editor. 2. Press the i key to activate insert mode. 3. Enter the following lines of code, replacing the comments in the main function with appropriate code. (Do not copy/paste.) Do not forget a completely blank line at the end of the file. // ***** sp01il.cpp ***** #include <iostream> using std::cout; int main () { // replace this comment with a statement to display your first name to the screen // replace this comment with a statement to display your last name next to your first name // be sure to include a space to separate the two names. // look to the cout statement in the hello.cpp program to complete these two lines of code return 0; } 4. Press the Esc key to leave insert mode. 5. Type :wq to write the file to disk and exit the vi editor. 6. Compile and execute this program. FOR IN-LAB CREDIT: Demonstrate to a lab proctor the use of the vi editor. With a lab proctor present, open 'sp01il.cpp in the vi editor and add a comment containing today's date at the beginning of the first blank line; save the file and exit the vi editor. Using Switches with the clang++ Compiler For grading purposes, all programs will be compiled using the command clang++ -Wall -Wextra -pedantic -std=c++17 What follows clang++ are called switches. -Wall -Wextra turns on all warning messages, including uncommon ones; you should treat warning messages as errors and attempt to correct the problem. -pedantic increases the sensitivity of the compiler to errors/warnings specified by the C++ ANSI standard. -std=c++17 tells the compiler to use the C++17 standard (the most recent standard available in clang++). Before submitting any program, it should be compiled with the same set of switches. Try compiling hello.cpp by using the following command: /sp01 $ clang++ -Wall -Wextra -pedantic -std=c++17 hello.cpp If clang++ does not print anything then everything is okay. Upload the following files: hello.cpp, sp01il.cpp

7 Appendix: Some Useful Linux Commands The table below lists a handful of linux commands that you will probably find very useful for code development. You can also find this table at the wiki page Common_Linux_Commands. Command ls pwd cd dir mkdir new_dir rm file cp source dest mv old new cat file more file vim file clear Action list directory contents; add -l for more information print working directory: shows path to your current working location change directory to dir;.. means "parent" make a new directory with name new_dir removes file; add -r to delete a directory copy file source to dest move (or rename) file or directory old to new prints contents of file to terminal same as cat but allows paging of long files command-line editor: edits or creates file clears the screen More information about these commands can easily be found online.

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

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit A portion of this lab is to be done during the scheduled lab time. The take-home programming assignment is to be turned in before the next lab;

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

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

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs Linux Tutorial #1 Introduction The Linux operating system is now over 20 years old, and is widely used in industry and universities because it is fast, flexible and free. Because Linux is open source,

More information

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

Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon. Lab 1 In order to get credit for the lab, you need to be checked off by the end of lab. For nonzero labs, you can earn a maximum of 3 points for lab work completed outside of lab time, but you must finish

More information

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

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.) 1 Introduction 1 CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.) This laboratory is intended to give you some brief experience using the editing/compiling/file

More information

ENERGY 211 / CME 211. Evolution

ENERGY 211 / CME 211. Evolution ENERGY 211 / CME 211 Lecture 2 September 24, 2008 1 Evolution In the beginning, we all used assembly That was too tedious, so a very crude compiler for FORTRAN was built FORTRAN was still too painful to

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

Unit 10. Linux Operating System

Unit 10. Linux Operating System 1 Unit 10 Linux Operating System 2 Linux Based on the Unix operating system Developed as an open-source ("free") alternative by Linux Torvalds and several others starting in 1991 Originally only for Intel

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

Introduction to Linux Environment. Yun-Wen Chen

Introduction to Linux Environment. Yun-Wen Chen Introduction to Linux Environment Yun-Wen Chen 1 The Text (Command) Mode in Linux Environment 2 The Main Operating Systems We May Meet 1. Windows 2. Mac 3. Linux (Unix) 3 Windows Command Mode and DOS Type

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

Lab 3a Using the vi editor

Lab 3a Using the vi editor Lab 3a Using the vi editor Objectives: Become familiar with the vi Editor Review the three vi Modes Review keystrokes to move between vi modes Create a new file with vi Editor Invoke vi with show mode

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

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

Short Read Sequencing Analysis Workshop

Short Read Sequencing Analysis Workshop Short Read Sequencing Analysis Workshop Day 2 Learning the Linux Compute Environment In-class Slides Matt Hynes-Grace Manager of IT Operations, BioFrontiers Institute Review of Day 2 Videos Video 1 Introduction

More information

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq CS 241 Computer Programming Introduction Teacher Assistant Hadeel Al-Ateeq 1 2 Course URL: http://241cs.wordpress.com/ Hadeel Al-Ateeq 3 Textbook HOW TO PROGRAM BY C++ DEITEL AND DEITEL, Seventh edition.

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

CS1600 Lab Assignment 1 Spring 2016 Due: Feb. 2, 2016 POINTS: 10

CS1600 Lab Assignment 1 Spring 2016 Due: Feb. 2, 2016 POINTS: 10 CS1600 Lab Assignment 1 Spring 2016 Due: Feb. 2, 2016 POINTS: 10 PURPOSE: The purpose of this lab is to acquaint you with the C++ programming environment on storm. PROCEDURES: You will use Unix/Linux environment

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

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

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22 CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22 Manton Matthews January 29, 2008 1 Overview The purpose of this assignment is to become

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

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 22, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers ords Data Types And Variable Declarations

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

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

AMS 200: Working on Linux/Unix Machines

AMS 200: Working on Linux/Unix Machines AMS 200, Oct 20, 2014 AMS 200: Working on Linux/Unix Machines Profs. Nic Brummell (brummell@soe.ucsc.edu) & Dongwook Lee (dlee79@ucsc.edu) Department of Applied Mathematics and Statistics University of

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

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

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18 Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18 By Aftab Hussain (Adapted from Claudio A. Parra s Slides for Fall 18 CS-143A) October 5 2018 University of California, Irvine Andromeda

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

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

Physics REU Unix Tutorial

Physics REU Unix Tutorial Physics REU Unix Tutorial What is unix? Unix is an operating system. In simple terms, its the set of programs that makes a computer work. It can be broken down into three parts. (1) kernel: The component

More information

Understanding main() function Input/Output Streams

Understanding main() function Input/Output Streams Understanding main() function Input/Output Streams Structure of a program // my first program in C++ #include int main () { cout

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

Getting Started With UNIX Lab Exercises

Getting Started With UNIX Lab Exercises Getting Started With UNIX Lab Exercises This is the lab exercise handout for the Getting Started with UNIX tutorial. The exercises provide hands-on experience with the topics discussed in the tutorial.

More information

Unit 13. Linux Operating System Debugging Programs

Unit 13. Linux Operating System Debugging Programs 1 Unit 13 Linux Operating System Debugging Programs COMPILATION 2 3 Editors "Real" developers use editors designed for writing code No word processors!! You need a text editor to write your code Eclipse,

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

Lab 2: Linux/Unix shell

Lab 2: Linux/Unix shell Lab 2: Linux/Unix shell Comp Sci 1585 Data Structures Lab: Tools for Computer Scientists Outline 1 2 3 4 5 6 7 What is a shell? What is a shell? login is a program that logs users in to a computer. When

More information

Lab # 02. Basic Elements of C++ _ Part1

Lab # 02. Basic Elements of C++ _ Part1 Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special

More information

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

Lab 1: Introduction to C, ASCII ART & the Linux Command Line .i.-' `-. i..' `/ \' _`.,-../ o o \.' ` ( / _\ /_ \ ) \\\ (_.'.'"`.`._) /// \\`._(..: :..)_.'// \`. \.:-:. /.'/ `-i-->..

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

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

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

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12) Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12) Objective: Learn some basic aspects of the UNIX operating system and how to use it. What is UNIX? UNIX is the operating system used by most computers

More information

Linux/Cygwin Practice Computer Architecture

Linux/Cygwin Practice Computer Architecture Linux/Cygwin Practice 2010 Computer Architecture Linux Login Use ssh client applications to connect (Port : 22) SSH Clients zterm ( http://www.brainz.co.kr/products/products4_2.php ) Putty ( http://kldp.net/frs/download.php/3411/hangulputty-0.58.h2.exe

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

Chapter 1 INTRODUCTION

Chapter 1 INTRODUCTION Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer

More information

Lab 1 1 Due Wed., 2 Sept. 2015

Lab 1 1 Due Wed., 2 Sept. 2015 Lab 1 1 Due Wed., 2 Sept. 2015 CMPSC 112 Introduction to Computer Science II (Fall 2015) Prof. John Wenskovitch http://cs.allegheny.edu/~jwenskovitch/teaching/cmpsc112 Lab 1 - Version Control with Git

More information

Tutorial 1: Unix Basics

Tutorial 1: Unix Basics Tutorial 1: Unix Basics To log in to your ece account, enter your ece username and password in the space provided in the login screen. Note that when you type your password, nothing will show up in the

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

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

Chapter 2. Editing And Compiling

Chapter 2. Editing And Compiling Chapter 2. Editing And Compiling Now that the main concepts of programming have been explained, it's time to actually do some programming. In order for you to "edit" and "compile" a program, you'll need

More information

C++ Programming on Linux

C++ Programming on Linux C++ Programming on Linux What is Linux? CS 2308 Spring 2017 Jill Seaman Slides 14-end are for your information only, you will not be tested over that material. 1 l an operating system l Unix-like l Open

More information

Introduction to Algorithms and Programming I Lab. Exercises #1 Solution

Introduction to Algorithms and Programming I Lab. Exercises #1 Solution 60-140 Introduction to Algorithms and Programming I Lab. Exercises #1 Solution Objectives are to: 1. Learn basic Unix commands for preparing a source C program file, compiling a C program and executing

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

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

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

Programming Studio #1 ECE 190

Programming Studio #1 ECE 190 Programming Studio #1 ECE 190 Programming Studio #1 Announcements In Studio Assignment Introduction to Linux Command-Line Operations Recitation Floating Point Representation Binary & Hexadecimal 2 s Complement

More information

Getting started with Hugs on Linux

Getting started with Hugs on Linux Getting started with Hugs on Linux COM1022 Functional Programming Techniques Dr Hans Georg Schaathun University of Surrey Autumn 2009 Week 7 Dr Hans Georg Schaathun Getting started with Hugs on Linux Autumn

More information

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

Temple University Computer Science Programming Under the Linux Operating System January 2017 Temple University Computer Science Programming Under the Linux Operating System January 2017 Here are the Linux commands you need to know to get started with Lab 1, and all subsequent labs as well. These

More information

Review of Fundamentals

Review of Fundamentals Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log

More information

Tutorial 2: Compiling and Running C++ Source Code

Tutorial 2: Compiling and Running C++ Source Code Tutorial 2: Compiling and Running C++ Source Code 1. Log in to your UNIX account as you did during the first tutorial. 2. Click on the desktop with the left mouse button and consider the menu that appears

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

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

Unix Basics. Systems Programming Concepts

Unix Basics. Systems Programming Concepts Concepts Unix directories Important Unix file commands man, pwd, ls, mkdir, cd, cp, mv File and directory access rights through permission settings Using chmod to change permissions Other important Unix

More information

Parallel Programming Pre-Assignment. Setting up the Software Environment

Parallel Programming Pre-Assignment. Setting up the Software Environment Parallel Programming Pre-Assignment Setting up the Software Environment Authors: B. Wilkinson and C. Ferner. Modification date: Aug 21, 2014 (Minor correction Aug 27, 2014.) Software The purpose of this

More information

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt

More information

Getting started with Hugs on Linux

Getting started with Hugs on Linux Getting started with Hugs on Linux CS190 Functional Programming Techniques Dr Hans Georg Schaathun University of Surrey Autumn 2008 Week 1 Dr Hans Georg Schaathun Getting started with Hugs on Linux Autumn

More information

4. Structure of a C++ program

4. Structure of a C++ program 4.1 Basic Structure 4. Structure of a C++ program The best way to learn a programming language is by writing programs. Typically, the first program beginners write is a program called "Hello World", which

More information

Numerical Algorithms for Physics. Andrea Mignone Physics Department, University of Torino AA

Numerical Algorithms for Physics. Andrea Mignone Physics Department, University of Torino AA Numerical Algorithms for Physics Andrea Mignone Physics Department, University of Torino AA 2017-2018 Course Purpose Physics is often described by equations that cannot be solved analytically or cannot

More information

Unix Tutorial Haverford Astronomy 2014/2015

Unix Tutorial Haverford Astronomy 2014/2015 Unix Tutorial Haverford Astronomy 2014/2015 Overview of Haverford astronomy computing resources This tutorial is intended for use on computers running the Linux operating system, including those in the

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

Working with Basic Linux. Daniel Balagué

Working with Basic Linux. Daniel Balagué Working with Basic Linux Daniel Balagué How Linux Works? Everything in Linux is either a file or a process. A process is an executing program identified with a PID number. It runs in short or long duration

More information

Lab 1: Getting Started with Linux The Extremely Illustrated Version. Graham Northup

Lab 1: Getting Started with Linux The Extremely Illustrated Version. Graham Northup Lab 1: Getting Started with Linux The Extremely Illustrated Version Graham Northup In today s lab, we ll be getting started with Linux and, perhaps more importantly, it s terminal. As we will be using

More information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

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

UNLV Computer Science Department CS 135 Lab Manual

UNLV Computer Science Department CS 135 Lab Manual UNLV Computer Science Department CS 135 Lab Manual prepared by Lee Misch revised July 2013 CS 135 Lab Manual Content Page Introduction 3 CS Computer Accounts. 3 TBE B361 Computer Basics. 3 Choosing an

More information

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

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

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++ Repetition Contents 1 Repetition 1.1 Introduction 1.2 Three Types of Program Control Chapter 5 Introduction 1.3 Two Types of Repetition 1.4 Three Structures for Looping in C++ 1.5 The while Control Structure

More information

Repetitive Program Execution

Repetitive Program Execution Repetitive Program Execution Quick Start Compile step once always mkdir labs javac Vowel3java cd labs mkdir 3 Execute step cd 3 java Vowel3 cp /samples/csc/156/labs/3/* Submit step emacs Vowel3java & submit

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

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

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

Linux File System and Basic Commands

Linux File System and Basic Commands Linux File System and Basic Commands 0.1 Files, directories, and pwd The GNU/Linux operating system is much different from your typical Microsoft Windows PC, and probably looks different from Apple OS

More information

CS11 Intro C++ Spring 2018 Lecture 1

CS11 Intro C++ Spring 2018 Lecture 1 CS11 Intro C++ Spring 2018 Lecture 1 Welcome to CS11 Intro C++! An introduction to the C++ programming language and tools Prerequisites: CS11 C track, or equivalent experience with a curly-brace language,

More information

Helpful Tips for Labs. CS140, Spring 2015

Helpful Tips for Labs. CS140, Spring 2015 Helpful Tips for Labs CS140, Spring 2015 Linux/Unix Commands Creating, Entering, Changing Directories to Create a Directory (a Folder) on the command line type mkdir folder_name to Enter that Folder cd

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

CSE 391 Lecture 1. introduction to Linux/Unix environment

CSE 391 Lecture 1. introduction to Linux/Unix environment CSE 391 Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/391/ 1 2 Lecture summary Course introduction

More information

ECE 2036 Lab 1: Introduction to Software Objects

ECE 2036 Lab 1: Introduction to Software Objects ECE 2036 Lab 1: Introduction to Software Objects Assigned: Aug 24/25 2015 Due: September 1, 2015 by 11:59 PM Reading: Deitel& Deitel Chapter 2-4 Student Name: Check Off/Score Part 1: Check Off/Score Part

More information

Lecture # 2 Introduction to UNIX (Part 2)

Lecture # 2 Introduction to UNIX (Part 2) CS390 UNIX Programming Spring 2009 Page 1 Lecture # 2 Introduction to UNIX (Part 2) UNIX is case sensitive (lowercase, lowercase, lowercase) Logging in (Terminal Method) Two basic techniques: 1. Network

More information

1) Log on to the computer using your PU net ID and password.

1) Log on to the computer using your PU net ID and password. CS 150 Lab Logging on: 1) Log on to the computer using your PU net ID and password. Connecting to Winter: Winter is the computer science server where all your work will be stored. Remember, after you log

More information

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

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko 213/513/613 Linux/Git Bootcamp Cyrus, Eugene, Minji, Niko Outline 1. SSH, bash, and navigating Linux 2. Using VIM 3. Setting up VS Code 4. Git SSH 1. On macos/linux: $ ssh ANDREW-ID@shark.ics.cs.cmu.edu

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

Linux Survival Guide

Linux Survival Guide Linux Survival Guide Introduction: This guide is intended for use with classes at DACC that use a Linux operating system as the platform for students. It provides a quick summary and examples of how to

More information

CMSC 201 Spring 2018 Lab 01 Hello World

CMSC 201 Spring 2018 Lab 01 Hello World CMSC 201 Spring 2018 Lab 01 Hello World Assignment: Lab 01 Hello World Due Date: Sunday, February 4th by 8:59:59 PM Value: 10 points At UMBC, the GL system is designed to grant students the privileges

More information

CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009

CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009 CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009 Due: Friday, September 4 th, 9:00am Introduction The operating system of a computer is the coordinator of all of the computer s activities, including

More information

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

We first learn one useful option of gcc. Copy the following C source file to your Lecture 5 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lab 5: gcc and gdb tools 10-Oct-2018 Location: Teaching Labs Time: Thursday Instructor: Vlado Keselj Lab 5:

More information

CISC 220 fall 2011, set 1: Linux basics

CISC 220 fall 2011, set 1: Linux basics CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week

More information