Introduction to UNIX System - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

Introduction to UNIX System

Description:

Shell is simply a program that reads in the commands you type and converts them ... in Bourne shell and Korn shell % in C shell ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 35
Provided by: skander4
Category:

less

Transcript and Presenter's Notes

Title: Introduction to UNIX System


1
Introduction to UNIX System
2
Introduction
  • Developed at Bell Laboratories in the late 1960s
    by Dennis Ritchie and Ken Thompson
  • Shell is simply a program that reads in the
    commands you type and converts them into a form
    that is more readily understandable by the UNIX
    system

3
Introduction (continue.)
  • Shell includes some fundamental programming
    constructs that let you make decisions, loop, and
    store values in variables
  • Bourne shell was written by Stephen Bourne in
    Bell laboratories
  • Bourne shell is the standard shell

4
UNIX System
  • The UNIX system is logically divided into two
    pieces
  • Kernel
  • Utilities

5
UNIX System (continue.)
  • Kernel is the heart of the UNIX system and
    resides in the computers memory

Utilities
UNIX system kernel
disks
Memory
6
UNIX System (continue.)
  • Utility resides on the computers disk and are
    only brought into memory as requested.
  • Virtually every command under UNIX is a utility
  • Shell is a utility program loaded into memory for
    execution whenever you log into the system

7
Logging in a UNIX system
  • Terminal is connected to a UNIX system through
  • Direct wire
  • Modem
  • LAN
  • After you connect the UNIX system a login
    message appears

8
Logging in a UNIX system (continue.)
9
Logging in a UNIX system (continue.)
  • init is the UNIX system
  • init automatically starts up a getty program on
    each terminal port whenever the system is
    allowing users to log in
  • After getty displays the message login and some
    types the usernames followed by RETURN, it starts
    up a program called login to finish the process
    of logging in. Then getty disappears
  • /etc/passwd file has one line per user

10
Logging in a UNIX system (continue.)
login Skan password
UNIX SYSTEM KERNEL
login
login
getty
getty
login
11
Logging in a UNIX system (continue.)
  • After login begins execution, Password message
    appears
  • User types the password and hits RETURN
  • The user name and the password will be checked
    against the corresponding entry in the file
    /etc/passwd

12
Logging in a UNIX system (continue.)
  • Every line has seven fields separated by .
  • The fields are
  • Login name
  • Password (encrypted form).
  • User ID
  • Group ID
  • User information which could be First and Last
    name, etc
  • Home directory
  • Program to start up when user logs in. Usually a
    shell program

13
Logging in a UNIX system (continue.)
  • Example

cat /etc/passwd rootx01Super-User//sbin/sh
daemonx11/ binx22/usr/bin sysx33
/ admx44Admin/var/adm lpx718Line
Printer Admin/usr/spool/lp uucpx55uucp
Admin/usr/lib/uucp nuucpx99uucp
Admin/var/spool/uucppublic/usr/lib/uucp/uucico l
istenx374Network Admin/usr/net/nls nobodyx
6000160001Nobody/ noaccessx6000260002No
Access User/ nobody4x6553465534SunOS 4.x
Nobody/ oracle10167DBA Account/export/home
/oracle/bin/csh webuser102102Web
User/export/home/webuser/bin/csh abuzneidx103
100Abdelshakour Abuzneid/home/abuzneid/sbin/csh

14
Logging in a UNIX system (continue.)
login Skan password
UNIX SYSTEM KERNEL
/bin/sh
login
login Med password
/usr/lbin/ksh
/usr/data/bin /dat_entry
login
login slim password
15
After Shell starts
  • When shell starts up, it displays a command
    prompt
  • in Bourne shell and Korn shell
  • in C shell
  • Shell goes to sleep after every command or
    program followed by RETUN until the program has
    finished
  • This copied program is called a process

16
After Shell starts (continue.)
shell
shell

ls
1.
2.
3.
4.
ls
shell
Foo rje
ls Foo rje
7.
8.
6.
5.
17
Login cycle
init
init
init
getty
init
sh
init
login
18
Login cycle (continue.)
19
Responsibilities of Shell
  • Program Execution
  • Variable and File Name Substitution
  • I/O Redirection
  • Pipeline Hookup
  • Environment Control
  • Interpreted Programming Language

20
Program Execution
  • Format program-name arguments
  • The shell scans the command line and determines
    the name of the program to be executed and what
    argument to pass to the program
  • Multiple occurrences of white spaces characters
    are simple learned

21
Program Execution (continue.)
  • mv oldfile newfile
  • echo Smile, you are in Bridgeport City
  • Smile, you are in Bridgeport City

oldfile newfile
mv
arguments
Smile, you are in Bridgeport City
echo
arguments
22
Program Execution (continue.)
  • Shell has some built_in commands which execute
    them directly without searching the disk
  • cd, pwd and echo are built_in commands

23
Variables and File Name Substitution
  • assign values to variables
  • listls
  • ls
  • Carthage
  • Damas
  • list
  • Carthage
  • Damas
  • file name substitution on the command line
  • ?

24
Variables and File Name Substitution (continue.)
  • Examples

ls Documents Memos mail personal
25
Variables and File Name Substitution (continue.)
echo Documents Memos mail personal
Documents Memos mail personal
arguments
echo
26
Variables and File Name Substitution (continue.)
ls Documents mail Documents a.doc c.doc p1
p11 mail p1 p2
27
Input/Output Redirection
  • Examples

wc -l list 2 list wc -l 2
28
Input/Output Redirection (continue.)
-l users
wc
arguments
wc
-l
arguments
29
Input/Output Redirection (continue.)
  • In the first command line, two arguments where
    passed to wc (word count) utility -l and users
  • In the second command line, one argument is
    passed to wc utility -l. This gives the
    indication that the number of lines appearing on
    standard input is to count

30
Pipeline Hookup
  • Connects to commands
  • Pipe characters
  • Connects the standard output from the command
    preceding to the standard input of the one
    following the

31
Pipeline Hookup (continue.)
  • Example
  • who wc -l
  • Counts the number of users login to the system by
    connecting the standard output of who to the
    standard output for wc

32
Environment Control
  • Shell provides variables that customize the
    environment
  • Examples

33
Interpreted Programming Language
  • The shell has its own built_in programming
    language
  • This language is interpreted shell analyzes each
    statement in the language one line at a time and
    then execute it
  • Different than high level programming language
    like C/C where the programming statements are
    typically compiled into a machine_executable form
    they are executed

34
References
  • UNIX SHELLS BY EXAMPLE BY ELLIE QUIGLEY
  • UNIX FOR PROGRAMMERS AND USERS BY G. GLASS AND K
    ABLES
  • UNIX SHELL PROGRAMMING BY S. KOCHAN AND P. WOOD
Write a Comment
User Comments (0)
About PowerShow.com