Introduction to Programming Using C An Introduction to Operating Systems.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Lesson 22 – Introduction to Linux Systems Administration.
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Guide To UNIX Using Linux Third Edition
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Agenda What is Computer Programming? The Programming Process
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Lesson 1. PC vs. Multi-user System  Personal Computer – each user gets his/her own processor (or multicore processor).  Multi-user system – The processor,
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Unix Basics Chapter 4.
CS240 Computer Science II Introduction the Unix File System and File Related Utilities Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Operating Systems and Using Linux CMSC 104, Lecture 3 John Y. Park 1.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
8-2 What is a program? What is a “Window Manager” ? What is a “GUI” ? How do you navigate the Unix directory tree? What is a wildcard? Readings: See CCSO’s.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Overview of Linux Fall 2016 Dr. Donghyun Kim
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Chapter 11 Command-Line Master Class
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
Operating Systems and Using Linux
Operating Systems and Using Linux
Unix : Introduction and Commands
Operating Systems and Using Linux
Operating Systems and Using Linux
Web Programming Essentials:
Chapter Four UNIX File Processing.
Introduction Paul Flynn
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
Presentation transcript:

Introduction to Programming Using C An Introduction to Operating Systems

2 Contents Operating Systems Files & Directories UNIX Commands

3 Operating Systems Computer hardware does nothing without instructions In the early days, one would press a button to have the computer load and execute your program This had disadvantages – You could only run one program at a time – A human had to press a button to start a program

4 Operating Systems This was a drag so they wrote a program to run continuously and – Automate the loading of programs – Let more than one program run at once – Support multiple users – Make hardware transparent so that all disk drives look alike even if made by different companies This program was called an operating system

5 Operating Systems A computer is like an onion – Application programs are at the outer layer – They talk to the operating system at the next level – The operating system talks to the hardware in the centre hardware

6 UNIX UNIX is an operating system written in the 1970s by AT&T It has become a standard on which many other operating systems are modelled We will be using a command-line interface to communicate with UNIX

7 Shells While an application can talk to the OS, how does a user talk to the OS Via a special application called a shell Shells fall into two broad categories – Command line shells Sh, csh, ksh – Graphical shells X Windows

8 Command Line Shells A command line shell is a program which – Lets you type commands – Conveys your instructions to the operating system – Displays results from your programs and the operating system Shells have their own simple command language which you use to tell them what to do

9 Files and Directories Everything you store in a computer is in a file Files are given a name and are usually stored on a hard disk Files are organized into directories A directory can contain – Any number of files – Other directories

10 Files and Directories Files and directories are organized into a tree like structure “/” is the root of the file system “/” is also used to specify a path through the file system / usretc home rob ipc144

11 Your Home Directory Every user is assigned a home directory This is a directory in which they can store their files Usually, a subdirectory is created for every course and subdirectories in each course for each assignment

12 Shells A shell is the program which communicates the user’s wishes to the operating system We will be using the Korn Shell This is a command-line interface Command line interfaces are programmable, making them useful for many tasks for which GUIs are poorly suited

13 Logging In You can contact the computer – Via a connected terminal – Over the internet via telnet – a remote terminal Putty – a secure connection which is encrypted Once connected you login with a – User name – password

14 Listing Files To see the files in your directory use the ls command This has variations, specifified with command line parameters – ls –alist all files, including hidden ones – ls –llong listing showing details

15 Working with Directories Directories and files are named with either a relative or absolute path – Relative paths specify a file relative to the current directory ipc144/as1/as1.c – Absolute paths give a complete path from the root of the file system and do not depend on the current directory /home/rob/ipc144/as1/as1.c

16 Working with Directories You can find out what directory you are in by typing – pwd To change the currect directory – cd – “.” is shorthand for the current directory – “..” is shorthand for the parent directory

17 Command Syntax Every command – Starts with a command name – Is followed by Options Filenames or other data passed to the command Optional input / output redirection

18 I/O Redirection Every command reads input from – Standard input And write output to – Standard output Normally, these are connected to – The keyboard – The terminal screen However, they can be redirected to files

19 I/O Redirection The “<“ sign tells a program to read from a file rather than the keyboard – cat < file1.txt – This causes the cat command to read from file1.txt The “>” sign redirects output to a file – cat > file2.txt – Causes the cat command to write its output to file2.txt

20 End Of File A file is simply a stream of bytes Every file has and end marker called End Of File Your programs can detect this When reading from a terminal, typing CTRL- D on a line by itself and pressing RETURN will send an End Of File character to your program

21 Shell Programming Shell commands can be saved in files and replayed at any time The shell maintains variables to make programming easier Common variables include – HOME-- your home directory – PATH-- directories searched for commands – PS1-- prompt

22 Shell Programming You can set a variable by simply assigning a value – Myvar=1 To see the value type – Echo $Myvar To see the values of all variables type – set

23 Basic UNIX Commands cat [ ] – Concatenates one or more files into a single file – Often used to display a file on screen – Also used to combine files cd [ ] – Changes the current working directory to the absolute or relative path specified – All relative paths are prefixed with the current directory

24 Basic UNIX Commands chmod – Every file has an owner and a set of permissions – You can allow a file to be Read (r) Written (w) Executed (x) – These operations can be performed by The owner (u) The group (g) Everyone outside the owner or his/her group (o) All users (a)

25 Basic UNIX Commands The permissisons are combined into a string of the form – [rwx]±[oug] To allow anyone to read a file – chmod a+r filename Restrict access to anyone but the owner – chmod ug-rwx filename

26 Basic UNIX Commands clear – Clears the screen cp – Copies one or more files to another file or directory – Can be used to copy files to a directory df – Shows the amount of free disk space

27 Basic UNIX Commands du [ ] – Reports the disk usage for a directory finger – Provides information about a user ln – Creates a link where two filenames point to the same file

28 Basic UNIX Commands lpr [-P printer] – Prints a series of files on a printer lpstat [-P printer] – Lists jobs queued for the printer ls [-al] – Lists files in a directory

29 Basic UNIX Commands man – Provides a manual page on the command mkdir – Creates one or more new directories more – Displays a file a screenful at a time Enter advances one line Space advances one page q quits

30 Basic UNIX Commands mv – Moves files rather than copying – Can be used to rename a file passwd – Allows you to change your password pwd – Displays the current directory name

31 Basic UNIX Commands quota – Displays how much disk space you can use rm – Removes one or more files rmdir – Removes a directory if it is empty set – Displays all shell variables

32 Basic UNIX Commands stty – Terminal settings who – Shows who is logged on

33 Editing UNIX has a variety of editors – vi Everyone loves to hate this one – nled Neat little editor – Pico Another editor

34 Compiling The C compiler is called cc – cc –o – Compiles one or more C source files into an executable output file – Output files do not have to end in.exe – Write errors to command line

35