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

Similar documents
Operating Systems. Copyleft 2005, Binnur Kurt

Linux & Shell Programming 2014

Introduction to the UNIX command line

Introduction to Linux

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

Introduction to Linux

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

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

Introduction to Linux

Unix Handouts. Shantanu N Kulkarni

Introduction to Linux

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Unix Introduction to UNIX

Working with Basic Linux. Daniel Balagué

Scripting Languages Course 1. Diana Trandabăț

Introduction: What is Unix?

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Introduction to Unix: Fundamental Commands

Chap2: Operating-System Structures

Introduction of Linux

Introduction to Linux. Fundamentals of Computer Science

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

Perl and R Scripting for Biologists

Chapter-3. Introduction to Unix: Fundamental Commands

CS370 Operating Systems

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

CS246 Spring14 Programming Paradigm Notes on Linux

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Introduction to Unix and Linux. Workshop 1: Directories and Files

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

EECS2301. Lab 1 Winter 2016

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Welcome to Linux. Lecture 1.1

Introduction to the Linux Command Line

Linux Command Line Primer. By: Scott Marshall

CISC 220 fall 2011, set 1: Linux basics

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

CHAPTER 1 UNIX FOR NONPROGRAMMERS

LOG ON TO LINUX AND LOG OFF

Week 2 Lecture 3. Unix

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Introduction to Cygwin Operating Environment

Linux at the Command Line Don Johnson of BU IS&T

Introduction to Linux Basics

Mills HPC Tutorial Series. Linux Basics I

Computer Systems and Architecture

CS Fundamentals of Programming II Fall Very Basic UNIX

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

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

INF322 Operating Systems

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

This is Lab Worksheet 3 - not an Assignment

UNIX 2 OPERATING SYSTEM

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Command-line interpreters

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Introduction. SSH Secure Shell Client 1

CSCI 2132 Software Development. Lecture 4: Files and Directories

GNU/Linux Course Lesson 1. Puria Nafisi

Unix Basics. Systems Programming Concepts

Session 1: Accessing MUGrid and Command Line Basics

System Programming. Introduction to Unix

Course 144 Supplementary Materials. UNIX Fundamentals

Files

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

Introduction to Linux Workshop 1

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University

5/20/2007. Touring Essential Programs

Linux Essentials. Smith, Roderick W. Table of Contents ISBN-13: Introduction xvii. Chapter 1 Selecting an Operating System 1

System Programming. Unix Shells

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

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

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

5/8/2012. Creating and Changing Directories Chapter 7

Computer Architecture Lab 1 (Starting with Linux)

A Brief Introduction to Unix

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

INSE Lab 1 Introduction to UNIX Fall 2017

Getting Started. Running Utilities. Shells. Special Characters. Special Characters. Chapter 2 Unix Utilities for non-programmers

5/8/2012. Encryption-based Protection. Protection based on Access Permission (Contd) File Security, Setting and Using Permissions Chapter 9

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

Unix basics exercise MBV-INFX410

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Short Read Sequencing Analysis Workshop

Multiple Choice - 58 Questions - 10 of 15%

EE516: Embedded Software Project 1. Setting Up Environment for Projects

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

Lab Working with Linux Command Line

Linux File System and Basic Commands

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Using the Zoo Workstations

CS/CIS 249 SP18 - Intro to Information Security

d. Permissions 600 on directory dir and 300 on file dir/foo. c. Permissions 700 on directory dir and 200 on file dir/foo.

Transcription:

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 of) UNIX and change your password. The general format of UNIX commands. Copyleft 2005, Binnur Kurt 88 What is an Operating System? An elephant is a mouse with an operating system. What is an Operating System? A piece of software that provides a convenient, efficient environment for the execution of user programs. Users Applications software Kernel Operating systems Hardware 89 90 Resource Abstraction and Sharing Why do we need an operating system? Hides the details of how the hardware operates Provides an abstract model of the operation of hardware components generalize hardware behavior limit the flexibility in which hardware can be manipulated Computation model: processes, threads Resources: memory, disk, files, cpu, etc. User viewpoint provide user interface, command interpreter, directory structure, utility programs (compilers, editors, filters) Program environment viewpoint enhance the bare machine higher-level I/O, structure files, notion of independent processes, improved store (size, protection) Efficiency viewpoint replace a human operator scheduling jobs, storing I/O (files), invoking necessary programs such as compiler Economic viewpoint allow concurrent uses and good scheduling of resources So, the goals are to make the system convenient to use (via system calls) and to manage resources efficiently. 91 92

UNIX UNIX The kernel provides low-level device, memory and processor management functions Basic hardware-independent kernel services are exposed to higher-level programs through a library of system calls Application programs (e.g. word processors, spreadsheets) and system utility programs (simple but useful application programs that come with the operating system, e.g. programs which find text inside a group of files) make use of system calls. Applications and system utilities are launched using a shell (a textual command line interface) or a graphical user interface that provides direct user interaction. 93 94 Modern UNIX Systems Kernel System V Release 4 (SVR4) Solaris 9 4.4BSD Linux The kernel is the core of the OS Manages all the physical resources of the computer After the shell passes the commands, the kernel executes the commands. 95 96 Shell Shell The shell performs the following: Acts as an interface between the user and the kernel Acts as a command-line interpreter Takes the commands that a user enters Processes the command line entered by a user Passes the interpreted command line to the kernel Bourne Shell Korn Shell C Shell TC Shell B(ourne)A(gain)sh Shell sh ksh csh tcsh bash 97 98

Directory Hierarchy Logging In to the System The directory hierarchy contains an organized group of directories and files. All users must follow a login process so that the system can recognize and authenticate the user. The desktop Login screen, which appears on your monitor, enables you to log into the system and use the desktop. Logging in using the command line Changing your password 99 100 Logging In to the System You will have several messages from the OS. You use them to see whether everything is going well Turn your PC on and switch to Unix OS (e.g. Fedora) 101 102 To log in to a desktop session from the desktop environment Login screen, complete the following steps: 1. Type your user name in the text field. Press Return or click OK. 2. Type your password in the password text field. Press Return or click OK. If the login attempt fails, try again. There are four default workspace buttons. Each workspace is a separate desktop environment 103 104

Managing Files Using the Desktop Environment To move a file from one directory to another: 1. Position the mouse pointer over the file icon. 2. Hold down the left mouse button, and drag the icon to the appropriate directory icon. 3. When the file icon is positioned over the directory icon, release the left mouse button The file moves to that directory. 105 106 Introducing Command-Line Syntax You can change the behavior of command functions by using options and arguments, as shown in the following table: 107 108 Entering Multiple Commands on a Single Command Line Control Characters You can enter multiple commands on a single command line by using a semicolon (;) to separate each command. The shell recognizes the semicolon as a command separator. 109 110

Displaying the Online Manual Pages Scrolling in Man Pages The online UNIX Reference Manual (man) pages provide detailed descriptions of UNIX commands and how to use them. Use the man command to display the man page entry that explains a given command. This table shows the keys on the keyboard that you use to control the scrolling capabilities when you are in the man pages. 111 112 Who am i? Determining the Current Directory The pwd command identifies the directory that you are currently accessing. 113 114 Displaying the Directory Contents You can view a hierarchy of the files and directories in the /export/home/user1 directory. Displaying the Directory Contents Displaying hidden files Displaying a long list You can use the ls -l command to view detailed information about the contents of a directory. The output of the ls -l command shows a long listing of file information. 115 116

What is a hidden file? Displaying the Directory Contents touch apple ls (what do you see? do you see apple?) touch.pear ls (do you see.pear) ls a (what about now?) 117 118 Displaying the Directory Contents Displaying the Directory Contents To view detailed information on the contents of the dir1 directory, perform the ls -l dir1 command from the user1 directory. Displaying individual directories ls l /etc Displaying a recursive list ls R /etc ls R / 119 120 Displaying File Types Changing Directories You can use either the ls F command or the file command to display file types. This table shows the symbols used with the ls -F command output: Using Path Name Abbreviations You can use path name abbreviations to easily navigate or refer to directories on the command line. 121 122

Changing Directories This figure shows the dir1 directory and its parent directory, the user1 directory. cd /export/home/user1 or cd.. Returning to your home directory ~user1/ ~/ $HOME 123 124 Working With Files Viewing Files Using the more Command There are different commands available that enable you to view file content in a read-only format or to display information about a file. These commands include: The cat command The more command The tail command The head command The wc command When the --More--(n%) prompt appears, you can use the keys described in the following table to scroll through the file. 125 126 Displaying Line, Word, and Character Counts Working With Files This table shows the options that you can use with the wc command. $ car /etc/passwd $ tail -2 /etc/passwd $ head -2 /etc/passwd R / > dat $ cat./dat $ more./dat $ cat./dat more $ wc /etc/passwd $ wc l /etc/passwd 127 128

Copying Files Copying Files The syntax for the cp command when copying files is: cp -option sources target The source option is a file. The target option can be a file or a directory. This table describes some options you can use with the cp command when you are copying files and directories. $ touch apple $ cp apple pear 129 130 Copying Multiple Files Moving and Renaming Files and Directories $ cp feathers dir1/ $ cp feathers_6 dir1/ You can use the mv command to: Move and rename a file Move a file to another directory Move a directory and its contents Rename a directory $ cp feathers* dir1/ 131 132 Moving and Renaming Files and Directories Creating Files and Directories $ touch banana $ mv banana apricot $ mkdir dir3 $ mv apricot dir3/ dir3/ You can use the touch and mkdir commands to: Create empty files Create directories 133 134

Creating Files and Directories Creating Files and Directories $ mkdir newdir $ mkdir Reports $ mkdir DIR1 $ mkdir DIR/DIR2 DIR1 $ pwd 135 136 Removing Files and Directories From the directory hierarchy you can permanently: Remove files Remove directories (including removing a directory with content) This table describes the options that you can use with the rm command when you are removing directories. Removing Files and Directories $ mkdir fruit $ touch fruit/banana $ touch fruit/apple fruit $ touch pear $ touch pricot $ rm apple $ rm pear.. $ rm r fruit/ 137 138 Using Symbolic Links Files (and directories) might be located on several different file systems. You can use symbolic links to link files that are in different file systems. Introducing symbolic links Creating symbolic links Removing symbolic links Using the grep Command The options that you use with the grep command can modify your search. Each option, except for the w option, can be used with the egrep and fgrep commands. This table shows the options for the grep command. 139 140

Using the grep Command Using the find Command $ cat /etc/passwd grep root $ grep root /etc/passwd $ xclock & $ ps fe grep xclock The pathname, expression, and action arguments for the find command are shown in the table. 141 142 Using the find Command Expressions that you can use with the find command. Using the find Command Action arguments for the find command. 143 144 Using the find Command Using the find Command Additional action arguments for the find command: $ find /etc name pas* print $ find / -user kurt mtime -7 size -100 print $ find / -name core exec rm {} \; 145 146

Viewing Permission Categories Viewing Permission Categories To view the permissions for files and directories, perform the ls l command. This figure shows the information displayed for the dante file. The first field of information displayed by the ls l command is the file type. The file type typically specifies whether it is a file or a directory. A file is represented by a hyphen (-). A directory is represented by the letter d. 147 148 Viewing Permission Categories Permission Characters The remaining fields represent three types of users: owner, group, and other. This table describes each type of user with a brief description of each. 149 150 Permission Sets Using the ls n Command To view the user identifiers (UIDs) and group identifiers (GIDs), perform the ls -n command on the /var/adm directory. 151 152

Description of the Output of the ls n Command Assigned Octal Values for Permissions This table shows the octal numbers for each individual permission. 153 154 Octal Digits for Permission Sets Combined Values and Permissions This table shows the octal numbers that represent a combined set of permissions. This table shows the permission sets for the three-digit octal numbers: 155 156 Changing permissions in symbolic mode Changing permissions in symbolic mode touch apple ls n apple chmod g-rwx apple ls n apple chmod o-wx apple chmod o+r apple ls n apple 157 158

Introducing the umask Utility This table shows the file and directory permissions that are created for each of the umask octal values. Also use these values to determine the umask value you want to set. 159