Chapter One Introduction to Unix1 System Programming Introduction to Unix.

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Chapter One The Essence of UNIX.
CS 497C – Introduction to UNIX Lecture 26: - The Process Chin-Chih Chang
Working Environment - - Linux - -.
Operating Systems - Introduction S H Srinivasan
Information Networking Security and Assurance Lab National Chung Cheng University 1 What Linux is? Free Unix Like Open Source Network operating system.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Guide To UNIX Using Linux Third Edition
CS 497C – Introduction to UNIX Lecture 1: Getting Started Chin-Chih Chang
1 Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET201.
Unix Presentation. What is an Operating System An operating system (OS) is a program that allows you to interact with the computer -- all of the software.
The University of Akron Summit College Business Technology Department Computer Information Systems 2440: 145 Operating Systems Introduction to UNIX/Linux.
Linux Basics. What is an Operating System (OS)? An Operating System (OS) is an interface between hardware and user which is responsible for the management.
CSCI 330 T HE UNIX S YSTEM Dr. Reva Freedman Department of Computer Science Northern Illinois University Spring 2009.
What is Unix Prepared by Dr. Bahjat Qazzaz. What is Unix UNIX is a computer operating system. An operating system is the program that – controls all the.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Linux Basics CS 302. Outline  What is Unix?  What is Linux?  Virtual Machine.
Unix Background / History CSE 4251, Sp 2014, Bolz 422 Dr. Bob Mathis,
Introduction A computer system consists of hardware system programs application programs.
Chapter 10 – UNIX. History In late 1960s, two employees of Bell Labs (Ken Thompson & Dennis Ritchie) designed a new operating system to overcome the constraints.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Overview of Linux Dr. Michael L. Collard 1.
Operating Systems CS3502 Fall 2014 Dr. Jose M. Garrido
UNIX OS By: Desmond Dagg Alannah Storm Mullins Carl Kavanagh Gareth Dunne Behzad Sanehi.
COSC513 Project Linux Features Instructor: Prof. Mort Anvari Student: Yingfeng Luo ID: #
Module 1 Introduction to UNIX/Linux
CENT 305 Information Systems Security Linux Introduction.
Chapter 9: Networking with Unix and Linux Network+ Guide to Networks Third Edition.
Chapter 4 UNIX Common Shells Commands By C. Shing ITEC Dept Radford University.
Chapter 1: Welcome to Linux An intro to UNIX-related operating systems.
Unix Background. Introducing Unix Brief Unix History u In 1969, Ken Thompson at AT&T Bell Labs began developing Unix. –First done in assembly language.
Natawut NupairojAssembly Language1 Unix Survival Guide.
CS 390 Unix Programming Summer Unix Programming - CS 3902 Course Details Online Information Please check.
1 Logging in to a UNIX System init ( Process ID 1 created by the kernel at bootstrap ) spawns getty for every terminal device invokes our login shell terminal.
Operating System What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. An operating.
Computers & Operating Systems
Just Enough Unix, Chapter 1
CS2204: Introduction to Unix January 19 th, 2004 Class Meeting 1 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty.
1 Lecture 1 Introduction & Getting Started COP 3353 Introduction to UNIX.
Λειτουργικά Συστήματα - Lab1 Γιάννης Πετράκης. The Operating System  Unix is a layered operating system  The innermost layer is the hardware that provides.
CSCI 330 UNIX and Network Programming Unit I Introduction.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Basic UNIX Concepts. Why We Need an Operating System (OS) OS interacts with hardware and manages programs. A safe environment for programs to run is required.
Linux History C151 Multi-User Operating Systems. Open Source Programming Open source programming: 1983, Richard Stallman started the GNU Project (GNU.
Chapter 9: Networking with Unix and Linux. Objectives: Describe the origins and history of the UNIX operating system Identify similarities and differences.
Introduction to UNIX CS 2204 Class meeting 1 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Introduction to UNIX CS465. What is UNIX? (1) UNIX is an Operating System (OS). An operating system is a control program that allocates the computer's.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop I Introduction to Linux Professional Training Academy.
Introduction to C Programming Language. History of C  C was evolved by Dennis Ritchie at AT&T Bell Laboratories in early of 1970s  Successor of: ALGOL.
Gorman, Stubbs, & CEP Inc. 1 Introduction to Operating Systems Lesson 8 Linux.
WHY AN OPERATING SYSTEM (OS) OS interacts with hardware and manages programs. Programs not expected to know which hardware they will run on. Must be possible.
Lab #1: UNIX crash course Introduction: History of Operating Systems Lesson #1: Navigating directories Lesson #2: Creating and editing files with emacs.
UNIX U.Y: 1435/1436 H Operating System Concept. What is an Operating System?  The operating system (OS) is the program which starts up when you turn.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Introduction to unix. The UNIX Operating System An operating system "OS” is a set of programs that controls a computer. It controls both the hardware.
UDel CISC361 Study Operating System principles - processes, threads - scheduling - mutual exclusion - synchronization - deadlocks - memory management -
Linux Essentials Chapter 1: Selecting an Operating System.
Overview of Linux Fall 2016 Dr. Donghyun Kim
A LECTURE NOTE.
Introduction to UNIX.
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
Welcome to Linux Chap#1 Hanin Abdulrahman.
Chapter 1 The Essence of UNIX and Linux
Unix : Introduction and Commands
Linux Professor Sabol.
Welcome to Linux Chap#1 Hanin Abdulrahman.
Welcome to Linux Chap#1.
Presentation transcript:

Chapter One Introduction to Unix1 System Programming Introduction to Unix

Chapter One Introduction to Unix2 Recommended Course Textbooks S. G. Kochan, P. Wood (2003) Unix Shell Programming, 3 rd Edition, Sams, 460 p. R. K. Michael (2003) Mastering UNIX Shell Scripting, Wiley, 680 p. W. R. Stevens, S. A. Rago (2005) Advanced Programming in the Unix environment, 2 nd Edition, Addison Wesley, 960 p. K. A. Robbins, S. Robbins (1996) Practical Unix Programming, Prentice Hall, 658 p.

Chapter One Introduction to Unix3 What is Unix? A modern computer operating system Operating system “a program that acts as an intermediary between a user of the computer and the computer hardware” Software that manages your computer’s resources (files, programs, disks, network, …) Examples: Windows, MacOS, Solaris, BSD, Linux (e.g. Mandrake, Red Hat, Slackware) Modern Stable, flexible, configurable, allows multiple users and programs

Chapter One Introduction to Unix4 Why Unix? Used in many scientific and industrial settings Huge number of free and well-written software programs Open-source operating system (OS) Excellent programming environment Largely hardware-independent Based on standards Internet servers and services run on Unix Roughly 65% of the world’s web servers are Linux/Unix machines running Apache

Chapter One Introduction to Unix5 Brief History of Unix Ken Thompson & Dennis Richie originally developed the earliest versions of Unix at Bell Labs for internal use in 1970s Simple and elegant Borrowed best ideas from other OSs Meant for programmers and computer experts Meant to run on “mini computers”

Chapter One Introduction to Unix6 Early Unix History Thompson also rewrote the operating system in high level language of his own design which he called B. The B language lacked many features and Ritchie decided to design a successor to B which he called C. They then rewrote Unix in the C programming language to aid in portability. Small portion written in assembly language (kernel) Remaining code written in C on top of the kernel

Chapter One Introduction to Unix7 Unix History Multics 1965 First Edition 1971 (AT&T) (CACM 1974, ) 1BSD 1977 (Berkeley) Sixth Edition 1975 (AT&T) 4BSD 1980 (Berkeley) SunOS 1985 (Sun) System V 1985 (AT&T) Tenth Edition 1989 (AT&T) 4.3BSD Net/ (Berkeley) First Linux kernel 1992 (Linus) Solaris 1993 (Sun) FreeBSD NetBSD OpenBSD Max OS X (Apple)

Chapter One Introduction to Unix8 Unix versions Two main threads of development: Berkeley software distribution (BSD) ( Unix System Laboratories ( BSD SunOS 4, Ultrix, BSDI, OS X, NetBSD, FreeBSD, OpenBSD, Linux (GNU) SYS V System V (AT&T -> Novell -> SCO), Solaris (SunOS 5), HP-UX (Hewlett-Packard), AIX

Chapter One Introduction to Unix9 Brief History of Linux Andrew Tanenbaum, a Dutch professor developed MINIX to teach the inner workings of operating systems to his students In 1991 at the University of Helsinki, Linus Torvalds, inspired by Richard Stallman’s GNU free software project and the knowledge presented in Tanenbaum’s operating system, created Linux, an open-source, Unix-based operating system Over the last decade, the effort of thousands of open- source developers has resulted in the establishment of Linux as a stable, functional operating system

Chapter One Introduction to Unix10 Layers in a Unix-based System User Interface Library interface System interface calls User Mode Kernel Mode Hardware (CPU, memory, disks, terminals, etc.) Unix Operating System (process management, memory management, file system, I/O, etc.) Standard Library (open, close read, write, etc.) Standard Utility Programs (shell, editors, compilers, etc.) Users

Chapter One Introduction to Unix11 Unix Structure The kernel is the core of the Unix operating system, controlling the system hardware and performing various low-level functions. Other parts of a Unix system (including user programs) call on the kernel to perform services for them. The shell accepts user commands and is responsible for seeing that they are carried out.

Chapter One Introduction to Unix12 Unix Structure (cont.) Over four hundred utility programs or tools are supplied with the Unix system. These utilities (or commands) support a variety of tasks such as copying files, editing text, performing calculations, and developing software. This course will introduce a limited number of these utilities or tools, focusing on those that aid in software development.

Chapter One Introduction to Unix13 Getting started

Chapter One Introduction to Unix14 The Unix Account Logging in to a Unix machine requires an account on that system. A user account is associated with login and password. “login” is your user name (usually some variant of your real name) Your password will not echo as you type Remember good password practices

Chapter One Introduction to Unix15 Logging into a UNIX system init (Process ID 1 created by the kernel at bootstrap) spawns getty for every terminal device getty opens terminal device, sets file descriptors 0, 1, 2 to it, waits for a user name, usually sets some environment variable (TERM) invokes login when user name entered login reads password entry (getpwnam()), asks for user’s password (getpass()) and validates it; changes ownership of our terminal device, changes to our UID and changes to our home directory. Sets additional environment variables (HOME, SHEL, USER, LOGNAME, PATH) invokes our login shell Login shell (bash)

Chapter One Introduction to Unix16 How Logins were processed init (using /etc/ttys or /etc/inittab) -> forks and execs getty programs on each terminal getty gets user name -> execs login login verifies password -> execs login shell User uses login shell Login methods: Using an X display User logins in via getty/login, then runs startx xdm -- reads username & passwd, starts X as that user Somewhat like a startx without the login shell Can start a "terminal" (or shell) window

Chapter One Introduction to Unix17 Secure Login Tools Terminal connection PuTTy (on Windows) MindTerm (Java applet) Desktop connection X-Win32 CDE, KDE, GNOME WeirdX (Java application) File transfer WinSCP3 SmartFTP

Chapter One Introduction to Unix18 What is a Shell? Just a Unix program executed when you log in A command interpreter provides the basic user interface to UNIX utilities A programming language program consisting of shell commands is called a shell script you can put commands in a file and execute it: First, make the file executable (chmod u+x script−file) Lines starting with # are comments Make use of interpreter files (kernel feature!): the first line of your script file must begin with a line: #!pathname optional−arguments where pathname is an absolute pathname (typically /bin/sh, or /bin/bash) of the interpreter.

Chapter One Introduction to Unix19 The Shell Prompt After logging in, some information about the system will be displayed, followed by a shell prompt, where commands may be entered $ % # hostname %

Chapter One Introduction to Unix20 The Shell The shell is the program you use to send commands to the Unix system Some commands are a single word who date ls Others use additional information cat textfile ls -l

Chapter One Introduction to Unix21 Command Syntax Commands must be entered exactly. If you make a mistake before entering, delete/backspace to fix it. Be careful! command options argument(s) Options modify a command’s execution Arguments indicate upon what a command should act (often filenames)

Chapter One Introduction to Unix22 Example Commands: ls (list) ls –l ls –a ls –la ls –a; ls –l ls -F ls –al textfile1 ls –al textfile1 textfile2 ls –al directory

Chapter One Introduction to Unix23 Command Execution The current shell (bash) executes built-in commands (echo, kill, pwd, …) or shell scripts invoked by the. (dot) command:. shell-script calls fork() to create a new shell process sub-shell (bash) The sub-shell executes a shell script or calls exec() to execute a command or program terminates after script or command execution During command execution, the parent either waits, or continues if command is executed in the background

Chapter One Introduction to Unix24 No Shell Prompt If you don’t get a prompt A program is probably running If you see a special program prompt, try to quit the program ( quit, bye, exit ) If you see nothing, you can Stop the program with CTRL-Z (program will wait until started again) Interrupt the program with CTRL-C (program will usually die)

Chapter One Introduction to Unix25 Logging Out Always log out when you are done Use the exit command to log out of a shell (sometimes logout or CTRL-D) Note: if you are running in a windowing environment, logging out of the shell only ends that shell. You must also log out of the windowing, typically selecting an option from a menu.