Unix Ppt 3892

Embed Size (px)

Citation preview

  • 8/2/2019 Unix Ppt 3892

    1/51

    Operating Systems

    The RelationshipBetween Hardware &Software

  • 8/2/2019 Unix Ppt 3892

    2/51

    Goals

    Understand what an operating system is

    Become familiar with several different operating systems

    Learn about the important features of an operating system,including file management

    Understand the Unix Operating System and tools associatedwith Unix

    Understand Unix Permissions

  • 8/2/2019 Unix Ppt 3892

    3/51

    Why Study Operating Systems?

    Understand therelationship betweenhardware & software

    Understand futureOperating Systems

    Understand powerfultools to help you in yourcomputer use

  • 8/2/2019 Unix Ppt 3892

    4/51

    What is an Operating System?

    Software

    Controls the relationshipbetween all othersoftware and hardware

    Other Roles

  • 8/2/2019 Unix Ppt 3892

    5/51

    The Two Major Types of OSs

    Letters with symbols, such asC:\>

    Type what you want thecomputer to do - theCOMMAND

    Type it correctly DOS and UNIX, but they do

    have GUIs available

    Pictures with descriptivewords

    Click a picture to start aprogram

    Point and Click

    Much easier to move thepointer with the mouse andCLICK on a picture, than toremember COMMANDS

    Window 3.1, Windows 95, MACO/S

    http://klingon.cs.iupui.edu/~micenogl/os9a.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9b.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9c.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9d.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9e.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9e.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9e.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9e.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9d.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9c.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9b.htmlhttp://klingon.cs.iupui.edu/~micenogl/os9a.html
  • 8/2/2019 Unix Ppt 3892

    6/51

    So, What Does an OS Do?

    Controls the INPUT,OUTPUT, and PROCESSING

    activities for the computer It is the BOSS of what

    happens in the S/W, the H/W,and between the S/W andH/W

    High-quality O/S can make

    your computer more effectiveand efficient

    Good OS makes thecomputer easier to use andmore efficient

  • 8/2/2019 Unix Ppt 3892

    7/51

    The Roles of an Operating System

    A Traffic Cop

    A CommunicationSystem

    A Box of Tools

    A Self-Starter

  • 8/2/2019 Unix Ppt 3892

    8/51

    OS as a Traffic Cop

    Controls the resourcesof the computer

    Resources include:memory, file storage,and CPU

    Multitasking is possible

    on new computers

  • 8/2/2019 Unix Ppt 3892

    9/51

    OS as a Communications System

    Helps all of theHARDWARE

    componentscommunicate with eachother

    Helps the software

    communicate with thehardware

  • 8/2/2019 Unix Ppt 3892

    10/51

    OS as Toolbox

    Several utility programsincluded with an O/S

    File Management

    Memory Management

    AppearanceManagement

    Networking Tools

  • 8/2/2019 Unix Ppt 3892

    11/51

    OS as a Self-Starter

    Takes over just afterbooting

    Checks to see allhardware is present

    Mechanisms for HardBoot & Soft Boot

  • 8/2/2019 Unix Ppt 3892

    12/51

    Flavors of Operating Systems

    Marketed by Microsoft in 1981

    Command-Line

    Inspired by UNIX

    Used on computers with the Intel Chip

    DOS

  • 8/2/2019 Unix Ppt 3892

    13/51

    Flavors of Operating Systems

    Developed by Apple in 1984

    Successful Marketing Campaign

    Changed the ideas about ease of use

    Largely ignored by the PC world

    Apple Macintosh

  • 8/2/2019 Unix Ppt 3892

    14/51

    The 1984 Macintosh Ad

    Premiered during 1984Superbowl

    Played just once

    Launched a new era ofadvertising

  • 8/2/2019 Unix Ppt 3892

    15/51

    Flavors of Operating Systems

    Developed in 1992

    First commercially successful GUI for PCs

    Actually not an Operating System

    Technically a shell that runs on top of DOS

    Windows 3.1

  • 8/2/2019 Unix Ppt 3892

    16/51

    Flavors of Operating Systems

    Developed in 1995

    Introduced the idea of the desktop for PCs

    Independent Operating System

    Made networking easier

    Windows 95/98/2000

  • 8/2/2019 Unix Ppt 3892

    17/51

    Flavors of Operating Systems

    Developed in 1995

    Introduced the idea of the desktop for PCs

    Independent Operating System

    Made networking easier

    Windows 95/98/2000

  • 8/2/2019 Unix Ppt 3892

    18/51

    Flavors of Operating Systems

    Developed by Bell Labs in 1969

    Command-Line OS

    Offered File Sharing

    Offered Process-Sharing

    Unix

  • 8/2/2019 Unix Ppt 3892

    19/51

    Introducing Unix Commands

    Command Line OS

    Issue commands from a command prompt:phoenix{jstudent}/:

    Unix is case sensitive

    Commands are typed in lowercase:cp (copy) is NOT the same as Cp or CP

  • 8/2/2019 Unix Ppt 3892

    20/51

    Unix Shells

    Unix has a number of shells which help the userinteract with the Operating System Kernel (the main

    program that stays resident in memory and executesOS commands)

    Shell Examples: Bourne Shell

    Korn

    Bash

    TCSH

    CshC-shell The default shell for Phoenix

  • 8/2/2019 Unix Ppt 3892

    21/51

    Command Syntax

    Case sensitive! All commands are lowercase

    General Format:command [switches] parameter1 parameter2

    Example:ls l *.html

    Command

    FlagArgument

  • 8/2/2019 Unix Ppt 3892

    22/51

    Correcting Typographical Errors

    DEL key removes the character to the left (in

    some Telnet clients, BACKSPACE will also dothis)

    To erase:

    C-w Erases previous word

    C-u Erases an entire line

  • 8/2/2019 Unix Ppt 3892

    23/51

    Directory Structures

    Unix paths begin with a forward slash

    The initial forward slash (/) represents the rootdirectory

    An absolute path begins at the root:/home/jstudent/public_html/

    A relative path indicates location relativetoyour present working directory:../images/

  • 8/2/2019 Unix Ppt 3892

    24/51

    More on Directories

    The command pwd will return the directory

    name in which you are currently working The directory that represents your personal

    section of the server is called your homedirectory

    The root directory is parent directory to allother directories (usually restricted use)

  • 8/2/2019 Unix Ppt 3892

    25/51

    Directory Notation

    / - represents a directory

    /. represents the current directory

    /.. represents the parent directory

    /~ - represents a users home directory

    Creating directories

    No spaces in a name Use _ or camel casing to name directories

    Case sensitive (usually in lowercase, with camel casing)

  • 8/2/2019 Unix Ppt 3892

    26/51

    Creating a Directory

    Use the mkdir command:mkdir campingImages

    Command

    Required argument:name of the directory(uses camel casing)

  • 8/2/2019 Unix Ppt 3892

    27/51

    Naming Files

    Extensions

    Determine the type of the file

    Examples

    *.txt

    *.html

    *.cgi

    *.gif

    *.jpg

    Filenames that begin with . are hidden and will not

    appear unless a special directory command is used.

  • 8/2/2019 Unix Ppt 3892

    28/51

    File & Directory Permissions

    ls l command will show full details:drwxr-xr-x 2 rmolnar staff 512 Sep 18 2001 funstuff/

    -rwxr-xr-x 2 rmolnar staff 312 Oct 11 2000 new.html

    Permissions

    Owner

    Group

    Size

    Date

    Name

  • 8/2/2019 Unix Ppt 3892

    29/51

    Unix Permissions

    Permission sequence found at the beginning ofa directory listing (first 10 characters):

    d rwx r-x r-x

    Directory

    ?

    Owners

    Permissions

    Groups

    Permissions

    Worlds

    Permissions

  • 8/2/2019 Unix Ppt 3892

    30/51

    Unix Permissions

    The first character represents whether thelisting is a directory. If it is a directory, a d will

    appear in the first character; otherwise, youshould normally see a dash (-).

    d rwx r-x r-x

  • 8/2/2019 Unix Ppt 3892

    31/51

    Unix Permissions

    The remaining nine characters are divided intothree triplets, each representing thepermissions for the owner, the owners group

    and the world.

    - rwx r-x r-x

    Owner

    Group

    World

  • 8/2/2019 Unix Ppt 3892

    32/51

    Unix Permissions

    In each triplet, three permissions can beassigned: 1st Position: r stands for Read; grants permission

    to view the contents of a file or directory (Value is ror -)

    2nd Position: w stands for Write; grants permission

    to modify a file or the contents of a directory (Valueis w or -)

    3rd Position: x stands for eXecute; grants permissionto run an application or open a directory (Value is xor -)

  • 8/2/2019 Unix Ppt 3892

    33/51

    Unix Permissions

    When changing permissions, we must first decide whatnumber will represent the permissions for a triplet

    We can do this by determining whether or not apermission is turned on or off If a permission is turned on (represented by r, w, or x), it gets

    a value of 1

    If a permission is turned off (represented by a dash), it gets a

    value of 0 After deciding whether the three permissions in a triplet

    are on or off, we will have a binary number

    We can convert the binary number to its octalequivalent

  • 8/2/2019 Unix Ppt 3892

    34/51

    Unix Permissions

    Permissions Binary Octal

    - - - 0 0 0 0

    - - x 0 0 1 1

    - w - 0 1 0 2

    - w x 0 1 1 3

    r - - 1 0 0 4r x 1 0 1 5

    r w - 1 1 0 6

    r w x 1 1 1 7

  • 8/2/2019 Unix Ppt 3892

    35/51

    Unix Permissions

    Once youve established the octal number representingthe permission for each triplet, you can then use the

    change mode (chmod) command to give a directory orfile proper permissions

    Syntax:chmod permissionMask file/directory

    Example:chmod 755 public_html

    Typically, directories and executable files are given755 permissions, while other files are given 644permissions

  • 8/2/2019 Unix Ppt 3892

    36/51

    Navigating Unix

    To move from directory todirectory, we use the cd

    command Syntax:

    cd path/

    To move from a parent to achild directory:

    cd child/ To move from a parent to a

    grandchild directory:cd child/grandchild

    Grandchild Directory

    Child Directory

    Parent Directory

  • 8/2/2019 Unix Ppt 3892

    37/51

    Navigating Unix

    To move from a child toa parent directory:

    cd .. To move from a

    grandchild to a parentdirectory:cd ../..

    To move to a directorythat shares the sameparent:cd ../Child 2

    Grandchild Directory

    Child Directory

    Parent Directory

    Child 1 Directory Child 2 Directory

    Parent Directory

  • 8/2/2019 Unix Ppt 3892

    38/51

    The List Command

    The list command (ls) shows the contents of adirectory

    We can add switches to the list command to modifywhat the command can do: ls lshows files in long format, including permissions (On

    Phoenix, you can also use the aliasll)

    ls ashows hidden files

    lscshows file listings in a column format

    ls tsorts file listings by last modified date

    To use more than one flag, concatenate them:ls -lt

  • 8/2/2019 Unix Ppt 3892

    39/51

    Using Wildcards with ls

    ls a* - Wildcard, All files starting with 'a'

    ls *a* - All filenames with 'a' in them

    ls *a*html - All filenames with 'a' in them and

    ending with html

    ls ????? - All 5 charater filenames

    ls [abc]*- All filenames starting with a, b, or c

    ls [a-c]* - Same as above but done as a range

    ls [^a-c]* - All filenames not starting with a, b, or c

  • 8/2/2019 Unix Ppt 3892

    40/51

    The Unix Copy Command

    cp can be used to make a copy of a file,

    leaving the original file untouched

    Syntax:cp oldfile [path/]newfile

    To make a copy of a file while both the original

    and copy are in the samedirectory:cp index.html home.html

  • 8/2/2019 Unix Ppt 3892

    41/51

    The Unix Copy Command

    To make a copy of a file that results in the copyretaining the originals name, but is housed in adifferent directory:cp index.html ../academic/

    To make a copy of a file that results in the copy

    having a new nameand is housed in a differentdirectory:cp index.html ../academic/home.html

  • 8/2/2019 Unix Ppt 3892

    42/51

    The Unix Move Command

    Themv command has two purposes:

    To move files from one directory to another

    To rename files

    Syntax:mv oldfile newpath/[newfilename]

    To move a file from one directory to another:mv index.html ../friends/

  • 8/2/2019 Unix Ppt 3892

    43/51

    The Unix Move Command

    To rename a file (stays in the same directory):mv index.html home.html

    To move a file andrename it at the same time:mv index.html ../friends/home.html

  • 8/2/2019 Unix Ppt 3892

    44/51

    Deleting Files

    Use rmto delete files

    Syntax:rm filename

    To delete a single file:rm index.html

    (answer Y to confirm delete)

    To delete multiple files using a wildcard:rm *.html(answer Y to confirm delete for each file)

  • 8/2/2019 Unix Ppt 3892

    45/51

    Deleting Directories

    Use rmdir to delete directories

    DIRECTORY MUST BE EMPTY!!!!

    Syntax:rmdir directoryname

    To delete a directory:

    rmdir images/(answer Y to confirm delete)

  • 8/2/2019 Unix Ppt 3892

    46/51

    Other Useful Commands

    passwd Password utility that allows users toupdate their passwords

    exit End your Unix session (you can alsousebye on Phoenix)

    clear Gives you a blank screen (you canalso use cls on Phoenix)

    who Lists users currently logged in to theserver

  • 8/2/2019 Unix Ppt 3892

    47/51

    Other Useful Commands

    finger username Retrieves informationabout a user

    cal Displays a calendar of the currentmonth

    date Displays the current system date

    !! (pronounced bang bang) repeats thelast command

    ![a..z] Repeats the last commandbeginning with selected letter (a-z)

  • 8/2/2019 Unix Ppt 3892

    48/51

    Other Useful Commands

    |more Added to commands which displaylists to force page stops (Ex: ls lt |more)

    C-z Temporarily stop a process

    fg Bring a process to the foreground after ithas been stopped

    vacation Turn on the autoreply for e-mailpine Launch the Pine E-mail client

    emacs Start the Emacs editor

  • 8/2/2019 Unix Ppt 3892

    49/51

    Online Manual

    Eight Sections Commands

    System calls

    Library functions

    Devices and device drivers

    File formats

    Games

    Miscellaneous

    System maintenance

  • 8/2/2019 Unix Ppt 3892

    50/51

    Usingman

    man command

    To lookup help on the cp command:man cp

    To lookup help on the ls command:man ls

    C-c exits the manual.

  • 8/2/2019 Unix Ppt 3892

    51/51

    Questions?