1

UNIX Basics
www.scmGalaxy.com Author: Rajesh Kumar

www.scmGalaxy.com, Author - Rajesh Kumar

Contents
1.Introduction to Unix 2. Logging In and Basic Commands 3File system 4.managing files 5.File Access Permissions 6.vi Editor 7.Shell Basics 8. Standard I/O Redirection 9. Filters & some utilities 10. Controlling Processes 11. Shell Programming concepts 12. Labs xxxxx 03 - 11 12 - 26 27 - 45 46 - 55 56 - 68 69 - 78 79 – 94 95 – 103 104 – 123 124 – 132 133 - 158 159 - 161

2

www.scmGalaxy.com, Author - Rajesh Kumar

Module 1
Introduction to Unix

3

www.scmGalaxy.com, Author - Rajesh Kumar

Rajesh Kumar . Author .scmGalaxy.com.Objectives 4 Upon completing this module you should be able to understand the following:       what is an Operating System History of unix Operating system Unix Architecture More features of unix Unix Flavors Linux Flavors www.

scmGalaxy.Rajesh Kumar .com. Author .What Is an Operating System? 5 • Interface between Users and the Hardware • take care of Storage Management • take care of I/O device management www.

History of the UNIX Operating System 6 1969 AT&T Bell Labs UNICS system -designed by Ken Thompson & Dennis Ritchie 1970 1973 Mid 1970s UNICS finally became UNIX UNIX rewritten in C. C shell etc.2. Author . MIT introduced X-Windows www. making it portable to different hardware University of California at Berkeley (BSD) contributed many important features like vi. AT & T came back and started commercial productionEditions ->Systems 1982 Late 1980s AT & T released SVR4 unification of SV3.Rajesh Kumar .com.scmGalaxy.SunOs & XENIX 1991 1990s Linux from Linus Torvalds POSIX Standard.BSD.

scmGalaxy. Author .Rajesh Kumar .com.UNIX Architecture – Kernel & Shell 7 User Shell Kernel Hardware www.

to communicate with the kernel. www.Rajesh Kumar .  All unix flavors use the same system calls and are described in the POSIX specification. called system calls.com. Author . they all use a handful of functions.UNIX Architecture – System Calls 8  Though there are over a thousand commands on the system.scmGalaxy.

) Programming facility Documentation www. Languages etc.scmGalaxy.More Features of UNIX 9 • • • • • • • • Hierarchical file system Multi tasking Multi user The building block approach Pattern matching (wildcard characters) Toolkit(Applications.. RDBMSs.Rajesh Kumar . Author .com.

UX • Sun .scmGalaxy.Flavors of UNIX 10 • Digital Unix • IRIX • SCO Open Server • SCO UnixWare • IBM -AIX • HP .com. Author .Rajesh Kumar .Solaris www.

com.Rajesh Kumar .Clone of UNIX (LINUX) 11 •Red Hat • Calders • SuSE • Mandrake • Debian www.scmGalaxy. Author .

Rajesh Kumar . Author .12 Module 2 Logging In and Basic Commands www.scmGalaxy.com.

scmGalaxy.Rajesh Kumar . clear Commands passwd Command finger command www. Author .com.Objectives 13 Upon completing this module you should be able to understand the following:           Logging In and Out Command Line Format The Secondary Prompt Online Manual Pages id Command who Command date Command cal.

scmGalaxy. • Log off to terminate your connection. www. • Execute commands to do work. Author .com.Rajesh Kumar .A Typical Terminal Session 14 • Log in to identify yourself and gain access.

1 User: Password: exit or <ctrl>+<d> will terminate the login session www.Logging In and Out 15 telnet 192.Rajesh Kumar .scmGalaxy. Author .168.com.10.

com. Separation : mail –f newmail not mail – f newmail Order: mail –f newmail not mal newmail –f Multiple options: who –m –u or who –mu not who –m u 4. 3. Multiple arguments: mail team1 team2 not mail team1team2 www. Author .Command Line Format 16 Syntax: $ command [-options] [arguments] 1.Rajesh Kumar . 2.scmGalaxy.

Author .scmGalaxy.Rajesh Kumar .The Secondary Prompt 17 $ echo 'hi >Good Morning‘ > is the default secondary prompt www.com.

WARNINGS EXAMPLES AUTHOR FILES SEE ALSO www.scmGalaxy.com. Author .Content of the Manual Pages 18 NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS BUGS etc.Rajesh Kumar .

$ man passwd Display the "passwd" man page-Section 1. $ man -k cat Display entries with keyword "cat". $ man 4 passwd Display the "passwd" man page-Section 4. www.scmGalaxy.The Online Manual 19 Syntax: man –[k|X] keyword in which X is the number of one of the manual sections Examples: $ man ls Display the “ls" man page.com.Rajesh Kumar . Author .

The id Command 20 Syntax: id Displays effective user and group identification for session Example: $id uid =303 (user3) gid=300 (class) www.scmGalaxy.Rajesh Kumar . Author .com.

Rajesh Kumar .scmGalaxy.com.The who Command 21 Syntax: who Reports information about users who are currently logged on to a system Examples: $ who root tty1p5 Jul 01 08:01 user11 tty1p4 Jul 01 09:59 user12 tty0p3 Jul 01 10:01 $ who am i user12 tty0p3 Jul 01 10:01 $ whoami user12 www. Author .

Author .Rajesh Kumar .The date Command 22 Syntax: date Reports the date and time Example: $ date Fri Jul 1 11:15:55 EDT 2005 www.scmGalaxy.com.

com.scmGalaxy.Rajesh Kumar . Author .The cal Command 23 Syntax: cal Reports the calendar of 2005 September(Current month) Example: $ cal 8 2005 for Aug 2005 $ cal 2005 for the full calendar of year 2005 www.

Rajesh Kumar .The passwd Command 24 Syntax: passwd Assigns a login password Example: $ passwd Changing password for user1 Old password: New password: Re-enter new password: www. Author .com.scmGalaxy.

Author .Rajesh Kumar .com.The clear Command 25 Syntax: clear Clears terminal screen www.scmGalaxy.

com.scmGalaxy. Author .Rajesh Kumar .finger 26 Finger: Displays information about the users currently logged on Eg: $ finger user1 Login name: user1 Directory: /export/home/user1 shell:/usr/bin/sh On since Sep 05 09:10:12 on tty1 No plan www.

Rajesh Kumar . Author .com.27 Module 3 File System www.scmGalaxy.

touch www. Author .Objectives 28 Upon completing this module you should be able to understand the following:           What Is a File System? File System structure Hard Link File Types Ordinary Files Directory Files Symbolic Links Device files The File System Hierarchy Basic Commands pwd.Rajesh Kumar . mkdir.com.scmGalaxy. cd. rmdir. ls.

Rajesh Kumar . Data + Meta data www. Author .What Is a File System? 29 collection of control structures and Data blocks that occupy the space defined by a partition and allow for the storage and management of data.com.scmGalaxy.

scmGalaxy.File System structure Primary Superblock Backup Superblock Cylinder Group Block Inode Table Data Blocks www.com. Author Rajesh Kumar 30 .

Author .scmGalaxy.Hard Link 31 Allows a file to have more than one name and yet maintain a single copy on the disk.com.Rajesh Kumar . All the links have the same inode number Eg: $ ls –i f1 1113 f1 $ ln f1 f1.lnk 1113 f1.lnk $ ls –i f1.lnk www.

Author .scmGalaxy. that stores a list of files/directories within that directory Device files: For every device there is a device file used by kernel to interact with the device.File Types 32 Common File Types: Ordinary files: regular files Directory files: table of contents. Symbolic Link: Its link to other files www.Rajesh Kumar .com.

com. application-related data. Regular files can hold ASCII text. www. image data.Ordinary Files 33 A regular file simply holds data. and more. binary data.Rajesh Kumar . databases.scmGalaxy. Author .

Rajesh Kumar .Directory Files 34 Directory name inum d1 4 f1 10 Inode Table # type mode links user group 4 dir 755 2 user1 group1 10 file 644 1 user1 group1 date Sep 5 9:30 Sep 5 9:45 size 512 12 loc www.scmGalaxy.com. Author .

Rajesh Kumar www.com.Symbolic Links 35 contains the path of the file to which it links Exists even after the source file is removed and is exactly similar to Windows shortcut Syntax: ln –s soucefile linkfile Eg: ln -s /f1 f1. Author . possible across filesystems 2.lnk Overcomes 2 limitations of Hard Link: 1.scmGalaxy. can link to a directory .

1 root sys 136. # cd /devices/pci@1f.Device files 36 A device file provides access to a device.0/pci@1. Author .1/ide@3 # ls -l brw------.Rajesh Kumar .com.0:a Two types of device files: block device files character device file www. 0 Apr 3 11:11 dad@0.scmGalaxy.

Author .The File System Hierarchy 37 / usr etc devices dev var tmp bin sbin dsk rdsk adm sadm ls who www.com.Rajesh Kumar .scmGalaxy.

shared documentation etc. /usr/sbin: admin commands /dev : logical device files of all hardware devices /devices: physical device files /etc : System configuration files and user database /tmp : to store temporary files /usr : the binaries.com.system directories 38 / :root directory. www.Rajesh Kumar /var: stores the log files and dynamic files . Author . cmp etc.scmGalaxy. shared libraries. cron.. top level directory /bin : user commands like cp.

that describes the path.Rajesh Kumar . = parent directory) www.File Path name 39 A sequence of file names.scmGalaxy. the system must follow to locate a file in the file system Absolute pathname (start from the /-directory): Eg: /export/home/user1/file1 Relative pathname (start from the current directory) . = current directory) ..profile (./team03/..com. Author ./test1 (. separated by slashes (/).

Present Working Directory 40 pwd prints the Current Directory www.scmGalaxy.Rajesh Kumar .com.pwd . Author .

List Contents of a Directory 41 Syntax: ls [-adlFR] [pathname(s)] Example: $ ls f1 f2 memo $ ls -F f1 f2* memo/ $ ls -aF profile f1 f2* memo/ $ ls memo f1 f2 www.com. Author .Rajesh Kumar .scmGalaxy.ls .

.cd Change Directory 42 syntax: cd [dir_name] Example: $ pwd /home/user3 $ cd memo... pwd /home $ cd /tmp./. pwd /tmp www. pwd /home/user3/memo $ cd . Author .Rajesh Kumar .scmGalaxy.com.

com. rmdir – create & remove Directories 43 Syntax: mkdir directory eg: $ mkdir d1 syntax: rmdir dir eg: $ rmdir /export/home/user1 www.mkdir.scmGalaxy. Author .Rajesh Kumar .

scmGalaxy.working with Multiple Directories 44 Create multiple directories simultaneously: $ mkdir -p dir1/dir2/dir3 Remove a directory and all its subdirectories $ rmdir -p dir1/dir2/dir3 www. Author .com.Rajesh Kumar .

Rajesh Kumar .com.1 user1 group1 100 Sep 5 10:00 file1 www.The touch Command 45 Updates the atime and mtime of a file if it exists.1 user1 group1 100 Sep 5 10:00 test -rw-r—r-. Else create an empty file Example: $ ls –l -rw-r—r-. Author .scmGalaxy. Sep 5 10:00 2005 $ touch test file1 $ ls -l -rw-r—r-.1 user1 group1 100 Sep 5 09:30 test $date Mon.

Author .Rajesh Kumar .com.scmGalaxy.46 Module 4 Managing Files www.

scmGalaxy.Objectives 47 Upon completing this module you should be able to understand the following:         File Characteristics cat more tail wc cp mv rm www. Author .com.Rajesh Kumar .

1 user3 class 37 Jul 24 11:06 f1 -rwxr-xr-x 1 user3 class 52 Jul 24 11:08 f2 drwxr-xr-x 2 user3 class 1024 Jul 24 12:03 memo File Type Links Group Permissions Owner Size Timestamp Name www.scmGalaxy.Rajesh Kumar . Author .com.File Characteristics 48 $ ls -l -rw-r--r-.

cat .scmGalaxy..com. $ cat abc abc 1234 1234 CTRL + D www.Display the Contents of a File 49 Syntax: cat [file. Your mother's birthday is November 29.] Concatenate and display the contents of file(s) Examples: $ cat remind Your mother's birthday is November 29.Rajesh Kumar .. Author . $ cat note remind The meeting is scheduled for July 29.

Rajesh Kumar Space bar One more page . --funfile (20%)-Q or q Quit more Return One more line www. Author .more .scmGalaxy.. . Display files one screen at a time Example: $ more funfile .Display the Contents of a File 50 Syntax: more [filename].com. ..

Rajesh Kumar .com. Display the end of file(s) Example: $ tail -1 test soon as it is available. Author . www.Display the End of a File 51 Syntax: tail [-n] [filename].tail ...scmGalaxy.

Author .Rajesh Kumar .scmGalaxy.com.wc command 52 The wc command counts the number of lines. words and bytes in a named file: syntax: wc [-c] [-l] [-w] filename Options: -c -l -w counts the number of bytes counts lines counts words Example: $wc testfile 10 98 1000 testfile www.

scmGalaxy.] dest_dir Copy directories Example: cp file1 d1 copies file1 to d1 directory cp file2 file3 create a copy of file2 as file3 in the same directory www...Rajesh Kumar ..cp . Author .com.Copy Files 53 Syntax: cp [-i] file1 new_file Copy a file cp [-i] file [file..] dest_dir Copy files to a directory cp -r [-i] dir [dir.

.Rajesh Kumar .com...scmGalaxy.Move or Rename Files 54 Syntax: mv [-i] file new_file Rename a file mv [-i] file [file.mv .] dest_dir Rename or move directories Example: $ ls -F f1 f2* memo/ note remind $ mv f1 file1 $ ls -F file1 f2* memo/ note remind $ mv f2 memo/file2 $ ls -F file1 memo/ note remind $ ls -F memo file2* www. $ mv note remind memo $ ls -F file1 memo/ $ls -F memo file2* note remind $ mv memo letters $ ls -F file1 letters/ Author ..] dest_dir Move files to a directory mv [-i] dir [dir.

rm - Remove Files
55

Syntax: rm [-if] filename [filename...] Remove files rm -r[if] dirname [filename...] Remove directories

Examples: rm f1 removes the file f1

rm –r d1 remove the directory.
www.scmGalaxy.com, Author - Rajesh Kumar

56

Module 5

File Access Permissions

www.scmGalaxy.com, Author - Rajesh Kumar

Objectives
57

Access to files is dependent on a user's identification and the permissions associated with a file. This module will show how to Understand the read, write, and execute access to a file Permissions

      

ls (11, ls -l) chmod umask chown chgrp su setuid, setgid, sticky bit

www.scmGalaxy.com, Author - Rajesh Kumar

Author . ls -l) chmod umask chown chgrp su Determine what access is granted on a file Change the file access Change default file access Change the owner of a file Change the group of a file www. and execute access to a file Permissions ls (11.com.File Permissions and Access 58 Access to files is dependent on a user's identification and the permissions associated with a file. write.Rajesh Kumar Switch your user identifier . This module will show how to Understand the read.scmGalaxy.

$ ls -l -rw-r--r-.Rajesh Kumar owner group .scmGalaxy.1 user3 class 37 Jul 24 11:06 f1 -rwxr-xr-x 1 user3 class 37 Jul 24 11:08 f2 drwxr-xr-x 2 user3 class 1024 Jul 24 12:03 memo | | www. Author .com.Who can access a File? 59 The UNIX system incorporates a three-tier structure to define who has access to each file and directory: user The owner of the file group A group that may have access to the file other Everyone else • The ls -l command displays the owner and group who has access to the file.

contents can be examined.com. contents can be changed. contents can be changed.Rajesh Kumar . file can be used as a command.scmGalaxy. can become current working directory. www. Author .Types of Access 60 There are three types of access for each file and directory: Read files: directories: Write files: directories: Execute files: directories: contents can be examined.

Change permissions of file(s) mode_list [who[operator]permission] [ .r-. execute Example: Original permissions: mode user group other rw-r--r-. group.o+x file or $ chmod +x file Final permissions: mode user group other rwxr-xr-x rwx r-x r-x www.Change Permissions (Symbolic Notation) 61 Syntax: chmod mode_list file. ] who user.r-$ chmod u+x.rw. Author .. other or all(u/g/a) operator + (add).. write.g+x... .scmGalaxy.com..(subtract). = (set equal to) permission read.Rajesh Kumar .

write and execute eg: $ chmod 664 f1 will give read and write permissions for owner and group while only read for others www.com. 7 means read.scmGalaxy.Rajesh Kumar .Change Permissions(Octal Notation) 62 File and directory permissions can also be specified as an octal number: Read Permission :4 Write Permission :2 Execute Permission:1 We can just add the numbers to specify the permission for each category Example: 6 means read and write. Author .

Rajesh Kumar value.scmGalaxy.com.Default Permissions 63 The default protections for newly created files and directories are: File Directory -rw-r—r-drwxr-xr-x 644 755 These default settings may be modified by changing the umask www. . Author .

umask .Rajesh Kumar . Author .scmGalaxy.Permission Mask 64 Umask specifies what permission bits will be set on a new file or directory when created. This can be changed for all the users or a particular user www. 777 – 022 666 – 022  rwxr-xr-x rw-r—r— New Directory: New File : 755 644 The default value of umask is set in /etc/profile.com.

the group ID Example: $ id uid=101 (user1).Change File Ownership 65 Syntax: chown owner [:group] filename . Author .scmGalaxy. optionally.Rajesh Kumar .chown .com.. Changes owner of a file(s) and.1 user2 class 3967 Jan 24 13:13 f1 Only the owner of a file (or root) can change the ownership of the file. www.. gid=101 (group1) $ cp f1 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----.1 user1 group1 3967 Jan 24 13:13 f1 $ chown user2 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----.

scmGalaxy. gid=300 (class) $ ls -l f3 -rw-r----. Example: $ id uid=303 (user3).com.1 user3 class 3967 Jan 24 13:13 f3 $ chgrp class2 f3 $ ls -l f3 -rw-r----.Rajesh 13:13 -rw-r----.1 user3 class2 3967 Jan 24 13:13 f3 $ chown user2 f3 $ ls -l f3 www. Author .The chgrp Command 66 Syntax: chgrp newgroup filename .1 user2 class2 3967 Jan 24 Kumar f3 ...

com.su .1 user1 group1 3967 Jan 24 23:13 class_setup $ id uid=303 (user1).Switch User Id 67 Syntax: su [user_name] your effective user ID and group ID Change Example: $ ls -l f1 -rwxr-x--. gid=300 (group1) $ su – user2 Password: $ id uid=400 (user2).Rajesh Kumar . Author .scmGalaxy. gid=300 (group1) www.

scmGalaxy. Author .Rajesh Kumar . sticky bit 68  setuid – changes the effective user id of the user to the owner of the program  chmod u+s f1 or – chmod 4744 f1 setgid – changes the effective group id of the user to the group of the program  chmod g+s f1 or  chmod 2744 f1   sticky bit – ensures the deletion of files by only file owner in a public writable directory  chmod +t f1 or  Chmod 1744 f1 www.com. setgid.Special File Permissions – setuid.

scmGalaxy. Author .com.Rajesh Kumar .69 Module 6 vi Editor www.

dd.scmGalaxy. a. O. n.Objectives 70 Upon completing this module you should be able to understand the following:         What Is vi? Starting and Ending a vi Session Cursor Control Commands Input Mode: i. moving and changing Text Searching for Text: /.com. o Deleting Text: x. dG Copying. dw.Rajesh Kumar . Author . N Find and Replace www.

com.What Is vi? 71 • • • • A screen-oriented text editor Included with most UNIX system distributions Command driven Categories of commands include – General administration – Cursor movement – Insert text – Delete text – Paste text – Modify text www.Rajesh Kumar . Author .scmGalaxy.

Otherwise vi will open the existing file All modifications are made to the copy of the file brought into memory. Author .com.scmGalaxy.If the file doesn‘t exist.Rajesh Kumar . :wq or :x or <shift-zz> :w :q :q! write and quit write quit Quit without saving www. it will be created .Starting and Ending a vi Session 72 vi [filename] Start a vi edit session of file Example: $ vi testfile .

Cursor Control Commands 73 1G <ctrl-b> H k <up-arrow> 0 b.scmGalaxy.com. Author .B h <left-arrow> $ w.W l <right-arrow> <down-arrow> j L <ctrl-f> G www.Rajesh Kumar .

scmGalaxy.Input Mode: i. Author . o 74 i will insert character at the present cursor position I will insert character at the beginning of the line a will append character at the present cursor position A will append character at the end of the line o will insert a blank line below O will insert a blank line above www.Rajesh Kumar . a. O.com.

Author line to delete to the start of the. dd.scmGalaxy. dw.com. With any of these you can prefix a number Example: 3dd will delete 3 lines d$ d0 to delete to the end of the line www. dG 75 x deletes the current character dw dd dG deletes the current word deletes the current line delete all lines to end of file.Deleting Text: x. including current line.Rajesh Kumar .

Copying. Author .com.Rajesh Kumar .scmGalaxy. moving and changing Text 76 yy yw dw copy the line copy the word cut the word p will paste the yanked lines below P will paste the yanked lines above dd cut the line r will overwrite the current character R cw will replace all text on the right of the cursor position will replace only the current word www.

Searching for Text: /. N 77 /director will locate for the first occurrence of the pattern ‗director‘ n to locate the next occurrence N to locate the previous occurence www. Author .scmGalaxy. n.Rajesh Kumar .com.

Find and Replace 78 To find and replace the word director with member : :1.scmGalaxy.com.$ represents all lines in the file g makes it truly global. Author . Without g only the first occurrence of each line will be replaced. g will ensure that all occuences in each line is replaced.Rajesh Kumar . www.$s/director/member/g 1.

com. Author .Rajesh Kumar .79 Module 7 Shell Features www.scmGalaxy.

Author .Rajesh Kumar .Objectives 80 Upon completing this module you should be able to understand the following:            Shell functionalities Commonly Used Shells BASH Shell Features Aliasing.scmGalaxy.com. Command History Re-entering Commands The User Environment Setting Shell Variables Variable Substitution Command Substitution Transferring Local Variables to the Environment Functions of a Shell before Command execution. www.

Shell functionalities 81         command execution environment settings variable assignment variable substitution command substitution filename generation I/O redirection Interpretive programming language www. Author .Rajesh Kumar .com.scmGalaxy.

Commonly Used Shells
82

/bin/bash /bin/ksh /bin/sh /bin/csh /bin/rksh /bin/rsh /bin/tcsh /bin/zsh

Bash shell Korn shell Bourne shell C Shell Restricted Korn shell Restricted Bourne shell An amended version of the C shell The Z shell

www.scmGalaxy.com, Author - Rajesh Kumar

BASH Shell Features
83

• A shell user interface with some advanced features:
– – – – – – –

Command aliasing File name completion Command history mechanism Command line recall and editing Job control Enhanced cd capabilities Advanced programming capabilities

www.scmGalaxy.com, Author - Rajesh Kumar

Aliasing
84

Syntax: alias [name[=string]] Examples: $ alias dir=ls $ alias mroe=more $ alias mstat=/home/tricia/projects/micron/status $ alias laser="lp -dlaser" $ laser fileX request id is laser-234 (1 file) $ alias displays aliases currently defined $ alias mroe displays value of alias mroe mroe=more www.scmGalaxy.com, Author - Rajesh Kumar

Syntax: history [-n| a z] Display the command history. • You can recall.Rajesh Kumar .scmGalaxy. Author . edit. and re-enter commands previously entered. • The history command displays the last 16 commands.Command History 85 • The shell keeps a history file of commands that you enter.com. Example: $ history -2 list the last two commands 15 cd 16 more .profile $ history 3 5 3 date 4 pwd 5 ls list command numbers 3 through 5 www.

Example: $ history 3 5 list command numbers 3 through 5 3 date 4 pwd 5 ls $r4 run command number 4 pwd /home/kelley www.com. Author .scmGalaxy.Re-entering Commands 86 • You type r c to re-enter command number c.Rajesh Kumar .

Author ..com..Rajesh Kumar . PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin:\ /home/gerry/bin www. Syntax: env Example: $ env HOME=/home/gerry PWD=/home/gerry/develop/basics .scmGalaxy.The User Environment 87 • Your environment describes your session to the programs you run.

Rajesh Kumar ..com. Author .Two Important Variables 88  The PATH variable A list of directories where the shell will search for the commands you type  The TERM variable – Describes your terminal type and screen size to the programs you run – $ env .. PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin $ TERM=70092 www.scmGalaxy.

.com.Rajesh Kumar . www.scmGalaxy.Setting Shell Variables 89 Syntax: name=value Example: color=blue PATH=$PATH:/usr/ucb . . Author .

scmGalaxy.com.Rajesh Kumar .Variable Substitution 90 $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin $ PATH=$PATH:$HOME:. $ echo $HOME /home/user3 $ file_name=$HOME/file1 $ more $file_name <contents of /home/user3/file1> www. $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin:/home/user3:. Author .

Command Substitution 91 Syntax: $(command) Example: $ dt=date This will store the string date in the variable dt not the value This will do command substitution and store the result of date command in the variable dt $ dt=$(date) note: instead of $(date) weAuthor -also use `date` www.com.scmGalaxy. can Rajesh Kumar .

com.Rajesh Kumar . color=lavender count=3 dir_name=/home/user3/tree $ unset dir_name www.scmGalaxy.Displaying Variable Values 92 $ echo $HOME /home/user3 $ env HOME=/home/user3 …. Author . SHELL=/usr/bin/sh $ set HOME=/home/user3 PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin ….

com. Author .Rajesh Kumar .scmGalaxy.Transferring Local Variables to the Environment 93 Syntax: export variable Transfer variable to environment www.

Rajesh Kumar . Author . Command substitution.Functions of a Shell before Command execution. 94     Searches for a command Substitutes Shell variable values.com. I/O redirection Interpreted programming interface www.scmGalaxy.

com.Rajesh Kumar . Author .scmGalaxy.95 Module 8 Standard I/O Redirection www.

scmGalaxy.Rajesh Kumar .com. Author .Objectives 96 Upon completing this module you should be able to understand the following:        The Standard Files Input Redirection Output Redirection Creating a file with cat Error Redirection Combined Redirection Split Outputs www.

Rajesh Kumar .scmGalaxy. Author .The Standard Files 97 Standard Input File (0) Keyboard Standard Output File (1) Standard Error File (2) Monitor Monitor operators: standard input redirection standard output redirection standard Error redirection 0< 1> 2> or < or > www.com.

Rajesh Kumar .scmGalaxy.com.Input Redirection 98 Default standard input $ mail user1 subject: Hi Test mail <ctrl-d> Redirect Input from a file: < $ mail user1 < letter www. Author .

com.out Redirecting and appending output to a file: >> $ who >> who.Rajesh Kumar . Author .out www.scmGalaxy.Output Redirection 99 Default standard output: $ ls f1 f2 f3 Redirect output from a file: > $ ls > ls.

using cat with redirection can be used to create a file $ ls file1 file2 file3 Using redirection $ cat > newfile file created by using the output redirection <ctrl-d> $ ls file1 file2 file3 newfile Author .com.scmGalaxy.Rajesh Kumar www.Creating a file with cat 100 While normally used to list the contents of files. .

Error Redirection 101 Default standard error: $ cat file1 file3 This is file1 cat: cannot open file2 Redirecting error output to a file: 2> (To append: 2>>) $ cat file1 file3 2>err This is file1 $ cat err cat: cannot open file2 $ cat file1 file3 2> /dev/null . Author .com.scmGalaxy.Rajesh Kumar www.

Combined Redirection 102 Combined redirects: $ command > outfile 2>errfile <infile $ command >> appendfile 2 >> errorfile <infile Association Examples: $ command > outfile 2 >&1 note: This is NOT the same as above $ command 2>&1 >outfile www.Rajesh Kumar .com.scmGalaxy. Author .

Author .com. Example: $ ls | tee ls.Split Outputs 103 The tee command reads standard input and sends the data to both standard output and a file.Rajesh Kumar .save | wc –l www.scmGalaxy.

104

Module 9 Filters & other commands

www.scmGalaxy.com, Author - Rajesh Kumar

Objectives
105

Upon completing this module you should be able to understand the following:
 


  


  

grep, sort, find ,cut , tr ftp paste command split command uniq command diff(Differential file comparator) Command cmp command file command tar (tape archive program) Restoring www.scmGalaxy.com, Author - Rajesh Kumar Files

grep
106

Search for lines matching specified pattern syntax: grep [options] pattern [file1 file2 …..] Example: emp.dat Robin Bangalore John Rina Chennai Bangalore

$ grep Bangalore emp.dat Robin Bangalore Rina Bangalore
www.scmGalaxy.com, Author - Rajesh Kumar

Rajesh Kumar .scmGalaxy.grep with Regular Expressions 107 grep ‗regular_expression‘ file Valid metacharacters .com. Any single character * [aA] [a-f] ^a z$ Zero or more occurences of the preceding character Enumeration: a or A Any one of the characters in the range of a through f Any lines that start with a Any lines that end with z www. Author .

Rajesh Kumar .grep options 108 -v -c -l -n -i print lines that do not match print only a count of matching lines print only the names of the files with matching lines number the matching lines ignore the case of letters when making comparisons -w do a whole word search www. Author .com.scmGalaxy.

Rajesh Kumar sorts numeric fields in arithmetic value .com.sort command 109 The sort command sorts lines and writes the result to standard output: $ sort [ -t delimiter] [+field[.column]] [options] Options: -d -r -n sorts in dictionary order. Author .scmGalaxy. digits and spaces are considered in comarisons reverses the order of the specified sort www. Only letters.

7 $ cat animals | sort +0.7 cat.2 elephant. Author .10 rabbit.4 rabbit.10 dog.4 elephant.7 www.scmGalaxy.1 rabbit.sort examples 110 $ cat animals dog.7 $ sort animals cat. -n +1 dog.10 rabbit.2 cat.2 cat.com.4 dog.2 $ cat animals | sort -t.10 .Rajesh Kumar elephant.4 elephant.

com. ---search for the files owned by user1 and delete them www. Author .find command 111 Search one or more directory structures for files that meet certain specified criteria Display the names of matching files or execute commands against those files find path expression Examples: $ find / -name file1 ---search for files in whole system with name file1 $ find / -user user1 –exec rm { } \.Rajesh Kumar interactively . ---search for the files owned by user1 and delete them $ find / -user user1 –ok rm { } \.scmGalaxy.

.find options 112 -type f d +n -n n +x -x onum mode ordinary file directory larger than "n" blocks smaller than "n" blocks equal to "n" blocks modified more than "x" days ago modified less than "x" days ago access permissions match "onum" access permissin match "mode" -size -mtime -perm -user -o -newer user1 finds files owned by "user1" logical "or" ref searches for files that are newer than the www.scmGalaxy.com. Author .Rajesh Kumar reference file.

Rajesh Kumar .com.5 /etc/passwd cut –c2 test second character of each line cut –c-2 test first 2 characters of each line www.scmGalaxy. Author .cut command 113 Used to cut fields from each line of a file or columns of a table cut –d: -f1.

scmGalaxy.tr command 114 Used to substitute the values tr [a-z] [A-Z] will convert each small letter to caps cat test | tr [a-z] [A-Z] will convert the small letters to caps in display tr –s ― ― will squeeze multiple space occurences of space into one www.Rajesh Kumar . Author .com.

Author .scmGalaxy.com. put Sends a local file to the remote system mget get multiple files from the remote system mput Sends multiple files to the remote system cd changes the directory in the remote system lcd changes the directory in the local system ls Lists files on the remote computer. ? Lists all ftp commands help command Display a very brief help message for command.Rajesh Kumar . www. bye Exits ftp.ftp 115 The ftp Command Syntax : $ ftp hostname get Gets a file from the remote computer.

file1 name ram raghu address mvm rjnagar file2 age 29 25 paste file1 file2 name ram raghu address age mvm rjnagar 29 25 (To rearrange f1 f2 f3 to f3 f2 f1. Author . cut each field.The paste command 116 Used to paste files vertically eg.Rajesh Kumar .scmGalaxy.put into file then paste) By default paste uses the tab character for pasting files. but –d to specify one eg.com. paste –d \| file1 file2 name ram raghu address|age mvm|29 rjnagar|25 www.

xac ….com. Author . by defalult.scmGalaxy. smallzz) www.smallab …. xbz and … xzz . So there can be 676(26*26) files split –5 chap (here the chap file is broken into files of 5 lines size) split chap small (the file names will be smallaa. split breaks a file into 1000 line pieces(or whatever is left) split creates files like xaa.xab. xaz then xba. xbb ….The split command 117 Used to split up the files: This command breaks up the input into several equi line segments.Rajesh Kumar .

com.scmGalaxy.list 03|marketing|6521 uniq dept.The uniq command 118 • • used in EDP environment to clear the duplicate entries by mistakes 01|accounts|6213 01|accounts|6213 02|admin|5423 03|marketing|6521 eg. Author .list 01|accounts|6213 02|admin|5423 03|marketing|6521 The input to uniq must be ordered data.list | uniq -uniqlist (uniqlist is the output file) www. dept. So sort and send the data sort dept.Rajesh Kumar .

Author .The diff(Differential file comparator) Command 119 Analyzes text files Reports the differences between files diff [-options] file1 file2 www.Rajesh Kumar .com.scmGalaxy.

.old differ: byte 6. Author ..scmGalaxy.. line 1 $cmp -l names names.. .. .Rajesh Kumar ..The cmp command 120 $ cmp names names.old 6 12 151 7 102 156 8 157 145 .com. cmp: EOF on names www.old names names.

Rajesh Kumar .scmGalaxy.com. Author .The file command 121 The file command tells the type of file Example: $ file /usr/bun/vi /usr/bin/vi:executable (RISC system/6000) or object module $ file c1 c1: ascii text $ file /usr/bin /usr/bin: directory www.

scmGalaxy.tar /etc/* www.com.Rajesh Kumar . Author .tar (tape archive program) 122 create a disk archive that contains a group of files or an entire directory structure -c -x -t -f copy extract list [only one can be present at a time] to specify the device name tar [–]cvf etc.

tar will display the archive www.tar /etc/passwd tar –tvf etc.tar selective extraction tar –xvf etc.scmGalaxy.com.Restoring Files 123 tar –xvf tarfile Example: tar –xvf etc.Rajesh Kumar . Author .

124 Module 10 Controlling Processes www.Rajesh Kumar .com.scmGalaxy. Author .

Author .Objectives 125 Upon completing this module you should be able to understand the following:       Monitoring Process Controlling Processes Terminating Processes Kill Signals Running Long Processes Job Control www.Rajesh Kumar .com.scmGalaxy.

Author ...scmGalaxy.... .. ..Monitoring Process 126 The ps command displays process status information $ ps -f UID john john john john PID 202 204 210 212 PPID 1 202 204 204 .. ...com... .Rajesh Kumar . . COMMAND -ksh ksh ls -R / ps -f www... TTY tty0 tty0 yyu0 tty0 .. .... . ...

scmGalaxy.com.Rajesh Kumar . Author .Controlling Processes 127 Foreground Processes: $ ls -lR / >lsout Background Processes: $ ls -lR / >lsout & www.

scmGalaxy.com. Author .Terminating Processes 128 Foreground Processes: ctrl-c Interrupt key.Rajesh Kumar background . cancels a forground process kill Sometimes the kill command is used to terminate foreground processes Background Processes: kill kill is the only way to terminate processes www.

you logged out while the process was still running interrupt.scmGalaxy. Author .com.you pressed the interrupt(break) key sequence ctrl-c quit -you pressed the quit key sequence ctrl-\ Kill signal: The most powerful and risky signal that can be Signal cannot be avoided or ignored! Termination signal(Default): Stop a process Signal can be handled by programs www.Rajesh Kumar sent 15 .Kill Signals 129 Sig 01 02 03 09 Meaning hangup.

Running Long Processes 130 The nohup command will prevent a process from being killed if you log off the system before it completes: $ nohup ls -lR / >lsout & [1] 100 If you do not redirect output.com.scmGalaxy.out www. nohup will redirect output to a file nohup.out $ nohup ls -lR / & [1] 102 Sending output to nohup.Rajesh Kumar . Author .

scmGalaxy.Job Control 131 jobs <ctrl-z> fg %jobnumber bg %jobnumber stop %jobnumber Lists all jobs Suspends foreground task Execute job in foreground Execute job in background Suspends background task www.Rajesh Kumar .com. Author .

Job Control Examples 132 $ ls -R / > out 2> errfile & [1] 273 $ jobs [1] + Running ls -R / > out 2>errfile & $ fg %1 ls -R / > out 2>errfile <ctrl-z> [1] + Stopped (SIGTSTP) ls -R / >out 2>errfile & $ bg %1 % jobs [1] + Running $ kill %1 [1] + Terminating ls -R / >out 2>errfile & www.Rajesh Kumar ls -R / >out 2>errfile & .scmGalaxy. Author .com.

Rajesh Kumar . Author .com.scmGalaxy.133 Module 11 Shell Programming Concepts www.

com.www. string and file comparison The case CONDITIONAL expr: Computation Command Substitution sleep & wait while loop. Author .Rajesh Kumar until and for loops .scmGalaxy.Objectives 134 Upon completing this module you should be able to understand the following:            echo & read commands Command Line Arguments The logical operators && and || The if Conditional Numeric comparison with test numeric.

Author .com.echo & read commands 135 echo used to display messages on the screen read used to accept values from the users. make programming interactive eg. echo ―Enter ur name ― read name echo ―Good Morning $name‖ www.Rajesh Kumar .scmGalaxy.

com.Command Line Arguments 136 Shell programs can accept values through 1. $2 the second.used when only a few inputs are there] For eg.scmGalaxy. $3 the third etc. Command Line args are stored in Positional parameters $1 contains the first argument. read [Interactive –used when there are more inputs] 2. $# stores the count of args www. From the command Line when u execute it[Non interactive. Author . $0 contains the name of the file.Rajesh Kumar $* displays all the args . sh1 20 30 Here 20 & 30 are the command Line arguments.

An example of Command Line args.scmGalaxy. 137 #! /bin/bash echo ―Program: $0‖ echo ―The number of args specified is $#‖ echo ―The args are $*‖ sh sh1 prog1 prog2 www.com.Rajesh Kumar . Author .

scmGalaxy. Author .Rajesh Kumar .The parameter $? 138 $? can be used to know the exit value of the previous command .com. This can be used in the shell scripts: www.

com.lst‘ && echo ―Pattern found‖ || echo ―Pattern not found‖ www.The logical operators && and || 139 These operators can be used to control the execution of command depending on the success/failure of the previous command eg.lst && echo ―Pattern found in file‖ grep ‗manager‘ emp2.Rajesh Kumar . grep ‗director‘ emp1.scmGalaxy.lst || echo ―pattern not found‖ or grep ‗director‘ emp. Author .

It can even take args. www.com.Rajesh Kumar . grep ―$1‖ $2 | exit 2 echo ―Pattern found – Job over‖ eg. Author .exit : Script Termination 140 exit command used to prematurely terminate a program.scmGalaxy.

The if Conditional 141 if condition is true then execute commands else execute commands fi else is not a must : if condition is true then execute commands www.Rajesh Kumar fi .scmGalaxy.com. Author .

Rajesh Kumar .com. Author .lst then echo ―Pattern found‖ else echo ―Pattern not found‖ fi Every if must have an accompanying then and fi.An example of if 142 eg1: if grep ―director‖ emp.scmGalaxy. and optionally else www.

Numeric comparison with test
143

test is used to check a condition and return true or false

Relational operators used by if Operator Meaning

-eq
-ne -gt

Equal to
Not equal to Greater than

-ge
-lt -le

Gfreater than or equal to
Less than
www.scmGalaxy.com, Author - Rajesh Kumar

Less than or equal to

An example of test with numeric
144

echo ―Enter age‖ read age

if test $age –ge 18
then echo ―Major‖ else echo ―Minor‖ fi
www.scmGalaxy.com, Author - Rajesh Kumar

[ ] short hand for test
145

echo ―Enter age‖ read age

if [ $age –ge 18 ]
then echo ―Major‖ else echo ―Minor‖ fi
www.scmGalaxy.com, Author - Rajesh Kumar

com. Author .scmGalaxy.Rajesh Kumar . else is optional www.if –elif :Multi-way Branching 146 if condition then execute commands elif condition then execute commands elif condition then execute commands else execute conditions fi echo ―Enter marks‖ read marks if [ $marks –ge 80 ] then echo―Distinction‖ elif [ $marks –ge 60 ] then echo ―First Class‖ else echo ―Pass‖ fi can have as many elif .

Author .Rajesh Kumar true if str1 is assigned and not null .scmGalaxy.com.test String comparison 147 test with Strings uses = and != String Tests used by test Test -n str1 -z str1 Exit Status true if str1 is not a null string true if str1 is a null string s1 = s2 true if s1 = s2 s1 != s2 str1 true if s1 is not equal to s2 www.

com.Rajesh Kumar .file tests 148 File related Tests with test Test -e file -f file Exit Status True if file exists True if fie exists and is a regular file -r file -w file -x file -d file -s file True if file exists and is readable True if file exists and is writable True if file exists and is executable True if file exists and is a directory True if the file exists and has a size >0 www. Author .scmGalaxy.

Rajesh Kumar . Author .com.The case CONDITIONAL 149 case used to match an expression for more than one alternatives and uses a compact construct to permit multi way branching case expression in pattern1) execute commands. pattern2) execute commands esac www.scmGalaxy..

Processes of user 2.com.scmGalaxy... *) echo “Wrong Choice” esac www. Quit” echo “Enter choice” read choice case “$choice” in 1) ls .Rajesh Kumar .An example for case 150 echo “1. Author .. 2) ps –f . 3) exit. List of files 2.

.com. n|N) exit .case Matching Multiple patterns 151 echo “Do u want to continue (y/n) “ read answer case “$answer” in y|Y) echo “Good” .Rajesh Kumar .scmGalaxy. Author . esac case can also use wildcards like [yY][eE]* or [nN][oO] www..

com.$y expr $x \* $y expr &x / $y expr $x % $y division gives only integers as expr can handle only integers www.scmGalaxy.expr: Computation 152 Shell doesn’t have any compute features-depend on expr expr 3 + 5 expr $x + $y expr $x .Rajesh Kumar . Author .

Rajesh Kumar .scmGalaxy.Command Substitution 153 x=5 x=`expr $x +1` echo $x it will give 6 www. Author .com.

Author .com.Rajesh Kumar .scmGalaxy.sleep & wait 154 sleep 100 the program sleeps for 100 seconds wait wait for completion of all background processes wait for completion of the process 138 wait 138 www.

com.Rajesh Kumar done (while true will set infinite condition) .while loop 155 while condition is true do execute commands done eg.scmGalaxy. Author . x=1 while test $x do -le 10 echo $x x=`expr $x + 1` www.

com.until : while’s complement 156 x=1 until test $x –gt 10 do echo $x x=`expr $x + 1` done www. Author .scmGalaxy.Rajesh Kumar .

Author .scmGalaxy. for x in 1 2 3 4 5 do echo ―Value of x is $x‖ done www.com.For loop 157 for variable in list do execute commands done eg.Rajesh Kumar .

List from command substitution for file in `cat clist` www. List from variables for var in $PATH $HOME $MAIL do echo $var done 2. List from Wild cards for file in *.lst || echo ―pattern $pattern done 4.c do cc $file –o $file{x} done 3.com. Author .scmGalaxy.The list in for loop 158 1.Rajesh Kumar not found‖ . List from positional parameters for pattern in $* do grep‖$pattern‖ emp.

Labs 159 1. who 4. 8. Devise a script that lists files by modification time when called with lm and by access time when called with la.Rajesh Kumar . 6. Write a script that uses find to look for a file and echo a suitable message if the file is not found. Output an appropriate error message. exit and execute the command as per the users choice www. use the ―if then‖ construct to write a script that will check for at least two parameters present on the command line. 5. pwd 3. 2. Write a shell script which will add all the numbers between 0 and 9 and display the result.develop a script that accepts a file name as argument and displays the last modification time if the file exists and a suitable message if it doesn‘t. Write a shell script which will compare two numbers passed as command line arguments and tell which one is bigger. ls 2.scmGalaxy. You must not store the output of the find to a file. and converts them all to upper case provided they exist. By default the script should show the listing of all files in the current directory 4. write a script that accepts one or more file names as arguments. 7. Write a script which will give 4 choices to the user 1. 3. Author .com.

com. create a file f2 in your home directory and set setuid and sticky bit permissions on the file.scmGalaxy. 12. 9. 13. Author . 14. Change the permissions to 777.Rajesh Kumar . From your home directory. 10. write the command to find all the files in your home directory hierarchy modified 1yr back and having a size more than 10 mb and delete the matching files interactively. write two commands which will display all the ordinary files in the system www. Write the command which will display all the files in the system having setuid set. 15. make the following directories with a single command line d1. Execute the date command with the proper arguments so that its output is in a mm-dd-yy format. d1/d2/d4 11. create a file f1 in the home directory. d1/d3. d1/d2.Labs 160 contd.

16.com.Labs 161 contd. Print the lines from /etc/group that contain the pattern root preceded by the line number 19.Print all entries from /etc/passwd for users who have ksh as their login shell 18. is locked . Print the number of users in the system. For all start scripts in /etc/rc3. Name the script rcscripts b. Write the script so that it doesn‘t require command-line arguments c.scmGalaxy. Print the users whose account Author .d directory print  The script name   The inode number of the script All other files under /etc with the same inode number 17.d directory a. Write a script that lists all the start scripts in a specified rc#. 20.Rajesh Kumar www.

..0/ 94:94390 17894.2. 4..:7703.  7057080398.08997:4-...0410. 038:709..:03. .08:2.9.30-0705.30839010 2.0/  8.0830.42 :947 #.7 .308705..

 4/:0 $00.9:708  8.08:2.2. .7 ..42 :947 #.

 .943841.7.7432039 $0993$0'.08  &543.08:2.83 422.-0.4250939824/:04:84:/-0.9:708 .42 :947 #.-0$:-899:943 422.38107734.9.:943  8.$0-01470422..'.-094:3/0789..7.-08 '.7 .2.-0894903.3/8947 #0 039073422.908 42243&80/$08 $$00.3/901443 $01:3.3/00.3/8 %0&8073.7432039 :3.943.3/$:-899:943 %7.7.

7.908  .422.422.7432039809938 .-0.3/00.943.$01:3..943 .-08:-899:943 .3/8:-899:943 103.:943 03..7.8832039 .200307.

 .3:. 70/70.7 .42 :947 #.08:2..2.943 39075709.05747.0  8.223.

42243&80/$08  .

-3.

-.8 .

-3.

8 .

-3.

8 .

-3.

.8 .

-3.

78 .

-3.

78 .

-3.

8 .9.

-3.

90/47380 #0897..7 .2.07843419080 %080  8.8 .203/0/.08:2. .42 :947 #.880 47380 4:73080 $0 #0897.90/4:73080 3.

.20.0/.9:708 422.098420.3/.-908  8.5.4250943 422.83 03. .7 ../.3/0/93 4-....08:2.42 :947 #.$$00.3.3/894720..3.0/10.0/5747.-908 /..43974 3.2.223../..3/3070.3..9:708  W 80:80739071.382 422.5.

.8/78 .83  $39.. .2508 ...827402470 ..8289.9.208973(( .83.

420.

.97.

98.5740.

743.2.

80710 706:089/8.2.42 :947 #.8.:041... ..82740 27402470  8.08:2..8.807 .9:8 ..89..808.7 .8/85.807  10 .82740/85.8075 /..:77039/0130/ .8.

8994.7 .2.89471041.422.94:03907 W %08947.3/8 W 4:.3//85.250 8947 8990.422..90 5/ 8  8.3/8947 8947 3.890.( .4:8039070/ $39.422.3/70 03907.89./ 2470 57410 894789.3/3:2-078974: /.3/8 . 0/9 .422.422.42 :947 #.422.3/89. 85.08:2.3/8947  W %0800058.. .3/8570.370.90.422.422..

3/3:2-07 5/ .422.422.3/3:2-07. 9470 03907.3/3:2-078974: /.422. .3/8  W 4:9507.250 894789.#0 039073422.90 5/ 8 77:3.

420.

 .00  8..2.42 :947 #.7 .08:2.

.7432039  W 4:703.7432039/08.%0&8073.  .7-084:780884394905747.28 4:7:3 $39.250 03. 03.

420.

077 !.

420.

077.

/0.045.

-.8.8 !%.

:87.

-3.

:87.

.4397-.

-3.

:87.

.4..

-3 .

420.

077.

7 .2..08:2. .42 :947 #.-3  8.

7-084:790723.%425479.94708070908080.7.7003809490 5747.-0 08.3/8.14790 . !%.7..7.-08   %0!% .39'.950.3/8 4:950  %0%# .284: 7:3 03.422.-0 8941/70.7..

:87.

-3.

:87.

4397-..

-3.

:87.

.4..

2..42 :947 #.08:2.-3 %#   8.7 . .

:0 .7.250 ..-08  $39.447-:0 !%!%.$0993$0'. 3.20.

:87.

08:2..:.-  8.42 :947 #. .7 .2.

4!% .-0$:-899:943  0.7.'.

:87.

-3.

:87.

4397-..

-3.

:87.

..4.

4!% .-3 !%!%  0.

:87.

-3.

:87.

.4397-.

-3.

:87.

.4..

-3.

420.

4  .:807 0.

420.

20 .:807 10*3.

20 .439039841.10 247010*3.

420.

:807.

.7 . .08:2.10  8.42 :947 #.2.

90 0.422.08:2.-0/934990 ..42 :947 #.7 .3/390 .3/ .90390 .3/ 8947090708:9 41/.422.422.7.84:80+/.90 34903890.-0/9 /9 /.  .2.422.250 /9/..90..90 %889470908973/.7.3/8:-899:943.3/$:-899:943  $39.90+  8.3. ../41 /..:0 %8/4.

:08  0.85.7.-0'.4  .3'.

420.

:807 03.  .

420.

:807 $.

:87.

-3.

8 809  .

420.

:807 !%.

:87.

-3.

:87.

.4397-.

-3.

:87.

..4.

20.447.4:39 /7*3.03/07 .-3 ..

420.

:807.

08:2.2. ..9700 :3809/7*3.7 .42 :947 #.20  8.

.7 .-0 %7.38107.7.42 :947 #.38107734..7432039  8.-08 94903.-0 9403.08:2.7432039  $39. .%7. 05479.7..7.2..'.

3/00.:08 422.3/ $:-899:908$0..3/8:-899:943 ..422.:3.:943  $0.$0-01470 422.7.943841..08147.7.-0.

7 ..943 390757090/5747. .42 :947 #..2. 70/70.08:2.22339071.0  8.

 4/:0 $9.7/.3/.

42 :947 #.2.7 . #0/70. .08:2.943  8..

943 :95:9#0/70.3/.-0.08  &543.2.42 :947 #.7 .109.3/901443 %0$9..9 7747#0/70.93.9.4250939824/:04:84:/-0..943 70.943 42-30/#0/70. .943 $59 :95:98  8.7/08 35:9#0/70.-094 :3/0789.08:2.

3/.3/.7/ 43947 43947 4507.9478 89.08:2.42 :947 #..3/.3/.7/08  $9.7/35:90  $9.943 89.7/ :95:90  $9.%0$9.3/.7 .3/.3/.7/35:970/70. .7/77470  0-4.7/4:95:970/70.7/774770/70.2.943 89.943 47 47   8.

7/35:9 2. .:807 8:-0.35:9#0/70.3/.9 %0892.10 2.97 / #0/70.2.935:91742.943  01.08:2.42 :947 #. .:80709907  8.:989.7 ..

:989.42 :947 #.5503/34:95:994.08:2.7 .3/.943  01.2.10 44 4:9  8.93.10 88 4:9 #0/70.7/4:95:9 8 1 1 1 #0/70.:95:9#0/70. .3/..94:95:91742.

.943.439039841108 :83.943 .70.:80/948990.93010 10.70.9  03472.2.42 .08:2..7  8..9 9 70/70.93.943 .10 8 10 10 10 &8370/70.97 / 8 10 10 10 3010:947 #.109.3-0:80/94.. .90/-:83904:95:970/70..70.90.

:989.91010077 %8810 ..93077474:95:994...9077 .91010 %8810 .3349450310 .3/.10 %4...5503/ .7747#0/70.7/07747 .943   01.3349450310 #0/70..9.91010...9.

/0.

.42 :947 .3: #. .2.7  8.08:2.

422.8.3/ 4:910  8.08:2..20.-4.422.7 .3/4:91007710310 .3/4:910  3490%88 %908.5503/100774710310 884.42 :947 #.422.422.3/.2508 .42-30/#0/70.2.943   42-30/70/70.. .943.98 .0 .

422.7 . .7/35:9.$59 :95:98   %0900.0.08:2.3/803/890/.2.250 89008 8.3/70.3/..10 ./889.3/.   8.42 :947 #.3/..9.94 -4989.7/4:95:9.

422.  4/:0 9078 4907.08:2. .3/8  8.42 :947 #.2.7 ..

422.08   &543.425.:9 97 195 5.42 :947 #.05747.3/ /11 1107039.9.08:2.422.7.3/ 10.10.3/901443 705 8479 13/ .3/ 9.2  8.2.-0.947 422.7 #08947308 . .3/ 859..890.422.50.4250939824/:04:84:/-0.3/ :36..422.25.7.3/ .422.-094 :3/0789.7 9.

470025 /.42 :947 #.470 #3. 1473082.08:2.470 43 #3. .3.9 #4-3 .10/5.3.9 #4-3 .705   $0.3. .2.3.990731010 ( .99073 839. .470 705.3.250 025 /. 705459438(5.7 .3850.7. 033.9..470 8.

..2.7 . .9078 3830..47 34304190.42 :947 #.907 0744724704.7.90783907.084190570.903/9  8.  3:207.0/3.. 1( ).7...08:2.7059#0:.:703..799.974:1 33089../209..( . 33089.989.943.757088438   705 70:...907 .7.7.7*05708843 10 '.3041.

80 41099078032.9.7 . 573943..425.705459438   .3.  3   57393089.3308 347090.208419010892.9/43492..9.08:2. ..42 :947 #.78438 /4.4047/ 80.2.9. .7.4:39 412.9.  8.3308 3:2-07 902.3308 573943903.

4:23((459438( 59438 / 7 3 847983/.2.3/   %08479. .747/07  3099078 /98.79209.70...7/4:95:9 8479 9/02907( 10/ .78438 70.10/8479  8.42.7 847983:207.3/84798308.3/.08.08:2.3/ 85.:0 .10/83.3/790890708:994 89..422.422.943..42 :947 #.078089047/074190850.438/070/3.8479.

.9  005.7 005.2.88479 9  3  /4  .32.39  /4  .2508  .9  /4  005.--9  8479.9  7.84790.08:2.88479  7.39  7.8 .9  005...--9   8.42 :947 #..39  ..--9  ..39  7..--9  ..32.9.32. .9.32.9.8 /4  .

422.9..422. 85.2508 13/.9:7081471089.389 9480108 13/5.31084700.430472470/70.13/.903.10/.92009.208412.3 850.7.7907.079.3/  $0.947897:.905708843 .:90.3/8.

2010 13/.147108340889029 3.7.2010 80. 3.

 :807:807 00.7.3//0090902 13/.14790 108430/-:807. 72< 80.

 .42 :947 #..3//0090902  8.14790 108430/-:807.2.7 3907.7..08:2.9.0 . :807:807 4 72< 80.

8 82.8 06:.7030079...43:2 .7079.08850728832.7.9.08:2..33-4..0885072884382.390  8.8.3/.42 :947 #.079..7 7010703.943-4.47 80 2920 5072 :807 4 3007 701 80.947 .010 .710 /70.081471089.8 24/10/24709.4 .9.4 24/10/0889.2. .9..13/459438  950 1 / 3 3 3   43:2 24/0 :807 47/3.24/0 13/8108430/-:807 4.33-4.8.3/.

422.:9 / 1 ..1047.3041.:910/817420.4:23841.:9.9.3/  &80/94..-0 .

09.

2.42 :947 #.30 ..7 .7.7..08:2.30  8.:9 .:9 . 9089 1789..43/. ...88/ .9089 80.5..907410..9078410.

7 .43.09907894.:08 97...422.0990794.43..2.58 .3/  &80/948:-899:9090.583 /85..0799082.82.97. .9908997.42 :947 #.04. 97 8   86:0002:95085..08 4185..:703. ( (.0394430  8...08:2.0790. ( ( ..

422.30890/70..3/ 85.422..20 09 098.4.3/$39..0147 .08:2.42 :947 #.7 .425:907 5:9 $03/8. 1954893.425:907  898..10174290702490 .94739070249088902 . .10949070249088902 092:95010817429070249088902 209 25:9 $03/82:950108949070249088902 .9473904../ ./ .3/ -0 98195  8.3/8 05 .195.422..195  %0195422.07-701 052088..88902 8 8981084390702490.30890/70.2.

9071475.2 7.1430 0 5.: .2 73.7  8. 0 10 3....:90.20 7.8901010 3.0 2.20 7.//7088.42 :947 #.893108 -:9 /94850.7 .079.2 73. .3011194111 .10/ 5:9394109035.: .20 7.890108.//7088 2.77.0 2.3/  &80/945.422.7.7 10 .08:2.2 7.2 73.%05.2.2 7.: .890 /1010 3..0   5.890...7   %470.890:808909.890 /01...:95.-.//7088 .

:9 859-70.9081080.8:59035:939480..-  8.903-.8.3/-70.. 82..582. 90103.06:308020398 -/01..10394 3050..90.08:2..5108-74033941084130880 82.5 07090. 859.3/  $49070..08 47.3/  &80/94859:590108 %8.%0859 .07..7 .422. -- -.70. .... .3-0   108 859 . ..208-082.2.422.42 :947 #.078019 859.

.42 :947 #.9..3/803/90/..4:398 .%0:36.3/  W W :80/3!03...790/:5.7093 0 /059 89 :36/059 89 .08:2. .4:398 .08 .2.4:398 ..90039708-289.0.7093 %035:994:362:89-047/070//.422.7 ../23 2..7093 2.9. $48479. 8479/059 89:36 :3689 :36898904:95:910  8.7432039 94./23 2.

425.3/  3.7 ..08-09003108 /11 459438(1010  8.7. .947 422.10.08:2.42 :947 #.%0/11 1107039.2.08909108 #05479890/110703.

208 4/ 3.2083.208 4//1107-90 30 .25.2083.7 .3/  .208  8.422.08:2.42 :947 #.25 433.%0.2.2083.25 3..253. .208 4/     .

%010.422.3/908909504110 .250 10.3/  %010.422.

:87.

-:3.

 ..

:87.

-3.

.-0 #$88902.:9.00.

9 24/:0 10. 474-0.909 10. .8. .

:87.

-3 .

:87.

7 .08:2.947  8. .42 :947 #..2.-3/70.

90..09.20 9.9 89 43430.7 9.05747.74:54110847...9.9.9.9:70 .  9 1 .3-05708039.303970 /70.109.7.03./8.190/0.45 097.7 (.38..7.70.947897:.7.2  .. 9.439.50..920( 94850.

09.

 8.42 :947 #.08:2..2. .7 .

250 9.7 .19.943 9.7.7 .109.7 .7 800.0097.9.710 . 9.#08947308  9. 9.109..

09.

90.7 9.2.7 .42 :947 #.7.0  8. 9.5.08:2. .7 /85.88/ 9...109.

42 :947 #.7 . . 4/:0 439743!74..2.08808  8.08:2.

42 :947 #.08  &543.2. .93!74.-0.08808 %0723..08808 $3.088 439743!74.7 .3/901443 439473!74.08:2.8 #:33343!74.9.-094 :3/0789.4250939824/:04:84:/-0.08808 4-43974  8.

088  %058 .8574.3//85.422.439473!74.08889.943 58 1 & 43 43 43 43 !       !!        %% 99 99 : 99   8 8 8 #.9:831472.

 . 58 1  8.7 ..08:2.42 :947 #.2.

08808 8 #.08808  47074:3/!74.439743!74.

.74:3/!74.84:9 .08808 8 #.

08:2.7 .42 :947 #.2. .84:9  8..

.08808 .3.08808  8.7 -.08808 .3/8:80/94 90723.%0723..08808  47074:3/!74. 39077:590 .97 .08:2.93!74.14774:3/ 574. .74:3/!74.9490723.90147074:3/574.2.088  $420920890.422.90 574.08808  89043.08.74:3/ ...42 :947 #.

574..088 $3.3:5 4:40/4:9090574.3-0 $3.8 897:333 39077:59 4:570880/9039077:59 -70..3-0..28  8.97  83.33 . 6:9 4:570880/906:90806:03..:9 $945. .2.$3.0.3349-0..088.4/0/473470/ %0723. %0248954071:..7 8039  ..3/0/-5747. 01.94383.08:2.97 .3/7883.8  $     0.42 :947 #. 0 806:03.9.9.0.

0881742-030/1 4:44119088902-014709.039.3/570.#:33343!74.08808  %034:5.422.574.4250908 34:58 #.

94:95:9 34:570/70.10 34:5 4:9 34:58 #.94:95:994.84:9 (  14:/434970/70.

2.. .7 .42 :947 #.08:2. (   $03/34:95:99434:5 4:9  8.

.8  8.42 :947 #.:904-3147074:3/ 0.74:3/9.97  14-3:2-07 -4-3:2-07 89454-3:2-07 898.2.74:3/ $:8503/8-.4-43974  4-8 .8 0..4-8 $:8503/8147074:3/9.. .08:2.7 .:904-3-.

4-43974.2508  8 #.

4:907710 (  4-8 ( #:333 8 #.

4:907710 1 8 #.

4:907710 .97  ( $94550/ $%$%! 8 #.

93 8 #.4:907710 - 4-8 ( #:333  ( %0723.

42 :947 #.. .2.7 8 #.08:2.4:907710  8.

4:907710 .

42 :947 #.2.22343..0598  8.7 . 4/:0 $0!747.08:2. .

425.08  &543.80 %  057425:9.3/10.4507.9 0445  8.42 :947 #.4250939824/:04:84:/-0.943 422.3/1474458 .7 :39. 8973.08:2.3/8 422.../. :207.-094:3/0789.422. .425.-0.3/ %0143/943.9.4 70..9478 .3/307:20398 %04.2.784399089 3:207.3/90 1443 0.3/$:-899:943 8005 .7843 %0..

4 44/47333.0.0843908.7003 70.059.:08174290:8078 2..20 0.20 70.2088.0 5747.2233907./ :80/94.0 0 0.3/8  0.20  8. ./.422.7 .9.2.42 :947 #..4 3907:73.4 :80/94/85../3.08:2...4 70.

059.90.08:2.38901789.3/30 .:08974:  70.0 :80/0343.20419010  89470890.0 :80/039070.43/  9097/09.3/30 03:00..9.78  /85.38903. .7090.422...70247035:98(  74290.:90943 3907.78.28...3/30.7:20398  422.439.709070( 470 8   070   .422.7089470/3!48943./ 3907.3.422.9.4:3941.7.42 :947 #.8.3/307:20398  $05747.7 .78  8..7:2039  9080..  .209078  .5.439.2.1035:98.

78  .30.25041422.3/30.

-3.

70 88574574  8.42 :947 #.7 .4 %0.4 %03:2-0741.78.4 !747.78850.2.-.8 0.08:2.2 0.10/8 0. ..

7.42 :947 #.3-0:80/390808.20907  . .3-0:80/94349009.4:8 ...7598  8.08:2.:04190570.422.7 .%05.3/ %8..2..

3/  %0804507.422.088..9478.3-0:80/94.3//0503/343908:..4507.439749000.:94341 .9478 .%04..

4:8 .947 025 89 0.3/ 0 705 /70..3.7 .4 !.4 !.08:2.4 5.422.9907334914:3/  8.07 025 890.9907314:3/3 10 705 2.42 :947 #. .1.2.:704190570.4 !.947 025 89  0.9907314:3/  0.9907334914:3/ 47705 /70.

09$.3/:80/945702.2 9.4 !.2.0.03 9.5747.42 :947 #..7 .759%0723.9907314:3/ 4-4..3 0.78  0  705  09 0.07  8.943  09. .422.08:2.90.9:7090723.

422.422..42 :947 #.3/8 1 0808349.7 1 .3/8 080 00.43/943897:0 903 00.2.3/8  8.3  1.:90.:90.08:2.422.2:89  1. .%0143/943.:90.43/943897:0 903 00.

.250411  0 1705 /70.425.30.071 2:89.42 :947 #. 080  8.08:2.4 !.3/45943.9907314:3/ 0800.9907334914:3/ 1 .3/1 ..0. .33903 .947 025 89 9030.3..4 !.2..7 .

9478:80/-1 507.3  8.947 06 30 9 0 9 0 0.:207..7 0889.425.34706:.33 6:.4507.94 0889.784399089  90898:80/94.43/943..94 .34706:.0.2..943.9079.94 70.08:2.42 :947 #.3 170.9079. .3/709:7397:0471.94 4906:.80 #0..

4 ..08:2.0 0 9030.42 :947 #.25041908993:207.0 70.47 0800.0 19089.4 3907.4 347 1  8. .30.2./.7 .  0.

08:2.3/1479089  0.42 :947 #.0 1.7 ..(8479./.2.0 0( 9030. .4 347 1  8.4 3907.47 0800.0 70.4 .

7.301 080845943..943 012.78 0 ( 9030.:90.3.422.3  1.0.82.78 70..  8.7 ./2.78 12.:90.4 39072..43/943 90300.422.4 !.43/9438 1 0.:90.88 0800.3.1 01 :9 .43/943 90300.43/943 90300.78 0 ( 9030.3/8 08000.88 1 .4 893.422.4 789.:90.3/8 01. .2.08:2.3/8 01.42 :947 #.

3:8973 97:018978.3/ $973%0898:80/-9089 %089 3897 897 9$9.2.8830/.7843  9089 9$9738:808.948  8.7 97:018978.3:8973 8897:0188 88 897 97:018834906:. .9089 $973..425.9:8 97:018978349.42 :947 #.08:2.3/3493: .

-0 %7:01100898./.:9.70:.3/879.710 %7:01100898.-0 %7:01100898. .90/%089899089 %089 010 110 710 10 10 /10 810 9$9.7 .08:2.3/8..9:8 %7:01100898 %7:01100898.1090898  070.2.947 %7:0190100898.42 :947 #.-0 %7:01100898.3/./70.80  8.3/800.8.3/870.3/8.

.08:2.9.3/8 08.7 .425..:90.9.99073 00...80  %   .422.-7..30570884314724709. .994507292:9 .43897:.%0.3430 .42 :947 #.9....  8.9073.3/:808.422.80057088433 5.99073 00.3/8 5.3.:90.08.80 :80/942.2.3 .

. .80  06 :.2.7 .08:2.42 :947 #.: 0605  3:  7:  .63: #960:::6:9 $.250147.9060 9. 065..0  8.1060 0. 0696560 :.30.

5:9 0.05 3..:0.7 .5 5  9.3:6:310.6065. .5...5:95 = 06661 5=! ..91:32(*(* 69(5!*(6"*  8.95:  066.737. :.0 0.: .0.2.5..1.42 :947 #.: .08:2.

.50647..79647..65  &3316:5.9:....

175165 79 79  79    79 .

.:79 0. .7 .2.08:2.5136535.9:  8.  79 )   79   79    1:65:6535.42 :947 #.9:.5.

4 9. ..0  8.2.7 .422.42 :947 #.08:2.3/$:-899:943   +057 + 0.

.9  8.. .08808 .8005 .9  8005  905747.08:2.088 .74:3/574.280058147 80.-.2.9147.9 .42 :947 #.7 .9147.42509434190574.43/8 .425094341.

:90.4 +057 +  8.0445  0.7 0 /430 097:080931390.422.3/8 /430 0  09089 /4 0.2. .43/943 .43/943897:0 /4 00..08:2.42 :947 #.

2.42502039   :399089 9 /4 0. .7 ..4 +057 + /430  8.42 :947 #.08:2.:390 8.

47445  147.3/8 /430 0 1473 /4 0..4 '.7.7 .42 :947 #.-0389 /4 00. .2.08:2.:90.:0418 /430  8..422.

89+  8.42 :947 #.99073 /430  891742.7 /430  891742/. ..2. /4 ..%0893147445   891742.7/8 147103 .3/8:-899:943 147103+.9..-08 147.7.7.4 5.10 410< /430  891742548943..5.990735.990733 /4 705 5..209078 1475..99073 025 890..73!%  /4 0.422.4.08:2.7 34914:3/ .

89 24/1.089490:807 8 5/ 4 09.7:2039.425.//.422.422..103.0/9.3//85.9.8.3/.4.759.9:80813/9444147.43897:.994790.70943:2-0785.045..08:2.8.:9090.8:9..0.3/- .3/. 108390.903:2-078-09003 ..8.:77039/70..10  :8090 1903 .4308-07  790.8.0  790.42 :947 #.850790:8078.8..7599.8.80.3/.:9908.4.90 708:9  790.3/30  :95:9.. .90.94:5507.759.147.20907857080394390.0/92.3/..3/ 00.9898108-24/1.75984:/849089341.7:20398 .80574.8994 5.422.94392003..9.7599.8.8:9..7 .880/.808.7.2.019010 834914:3/ 4:2:8934989470904:95:9419013/94.3//85..-02088.0598.808...7599.3/30 .10.0598430472470103.947  790.7599.3/0.0.557457.208.7:20398.08892003.0798902 .3/90.9. /01.90 077472088.943920190100898.4.-02088.20.0  8.7599.019/4083 9  790./0/90089  0.3.43.-8   /0.8...8.759..890.

3/30 / /.-8.947089.947 2.422..9984:95:983 .7:20398849.0901443/70.439/   0.22 // 1472.3/990574507.:9090/.90.830 .9   7424:7420/70.422.

/ /.

/ /.

/.

../  .70. 24/10/7-.3/809809:/.7 .8024709.9047/3.422.309050728843894  ./85. .31083907..2.7108390 88902  8.7.94707./85.3/8.9010839088902.101390420/70.70..947 ..08:2..90.90.9.0  79094.-9 507288438439010  79090.947.10134:7420/70.3/.3/9413/..422.9010834:7420/70.3.422.3/89.3 809:/809  79090.3/.3 2-.42 :947 #.9..3//009090 2.

 //70.9089.7597.798..850.7598 - 790908.798.9898.7599.759849.99/4083 9706:70. 47.8.89.75983.947 .439/   790.7:20398 .20908.422.8.10/7.3/ 30.75983. .-8.

09.

7.20 %034/03:2-0741908.7593.9475739 %08. //70.759 4907108:3/07.

09.9908.0397081742.2034/03:2-07  !739.

09.

88/147:80784..890743 80  !739903081742.5.08.

09.

74:59. .0/  8.3905.9.2.4:3984..990737449570.439..0/0/-90 303:2-07  !739903:2-0741:807839088902  !73990:8078480.08:2.42 :947 #..7 .