You can use excuses to convince others, but how will you convince yourself?
--Your friends at LectureNotes

Note for Unix & Shell Programming - USP by Rahul Lakshkar

  • Unix & Shell Programming - USP
  • Note
  • B.M.S. Institute of Technology and Management - BMSIT
  • 15 Topics
  • 298 Offline Downloads
  • Uploaded 1 year ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1


Text from page-2

UNIX AND SHELL PROGRAMMING UNIX AND SHELL PROGRAMMING [As per Choice Based Credit System (CBCS) scheme] (Effective from the academic year 2017 -2018) SEMESTER – III Subject Code 17CS35 IA Marks Number of Lecture Hours/Week 03 Exam Marks Total Number of Lecture Hours 40 Exam Hours CREDITS – 03 40 60 03 Module -1 Introduction, Brief history. Unix Components/Architecture. Features of Unix. The UNIX Environment and UNIX Structure, Posix and Single Unix specification. The login prompt. General features of Unix commands/ command structure. Command arguments and options. Understanding of some basic commands such as echo, printf, ls, who, date, passwd, cal, Combining commands. Meaning of Internal and external commands. The type command: knowing the type of a command and locating it. The man command knowing more about Unix commands and using Unix online manual pages. The man with keyword option and whatis. The more command and using it with other commands. Knowing the user terminal, displaying its characteristics and setting characteristics. Managing the non-uniform behaviour of terminals and keyboards. The root login. Becoming the super user: su command. The /etc/passwd and /etc/shadow files. Commands to add, modify and delete users. Topics from chapter 2 , 3 and 15 of text book 1,chapter 1 from text book 2 Module -2 Unix files. Naming files. Basic file types/categories. Organization of files. Hidden files. Standard directories. Parent child relationship. The home directory and the HOME variable. Reaching required files- the PATH variable, manipulating the PATH, Relative and absolute pathnames. Directory commands – pwd, cd, mkdir, rmdir commands. The dot (.) and double dots (..) notations to represent present and parent directories and their usage in relative path names. File related commands – cat, mv, rm, cp, wc and od commands. File attributes and permissions and knowing them. The ls command with options. Changing file permissions: the relative and absolute permissions changing methods. Recursively changing file permissions. Directory permissions. Teaching Hours 08 Hours 08 Hours Topics from chapters 4, 5 and 6 of text book 1 Module – 3 The vi editor. Basics. The .exrc file. Different ways of invoking and quitting vi. Different modes of vi. Input mode commands. Command mode commands. The ex mode commands. Illustrative examples Navigation commands. Repeat command. Pattern searching. The search and replace command. The set, map and abbr commands. Simple examples using these commands. The shells interpretive cycle. Wild cards and file name generation. Removing the special meanings of wild cards. Three standard files and redirection. Connecting commands: Pipe. Splitting the output: tee. Command substitution. Basic and Extended regular expressions. The grep, egrep. Typical examples involving different regular expressions. 08 Hours Topics from chapters 7, 8 and 13 of text book 1. Topics from chapter 2 and 9 ,10 of text book 2 1-2

Text from page-3

UNIX AND SHELL PROGRAMMING Module-4 Shell programming. Ordinary and environment variables. The .profile. Read and readonly commands. Command line arguments. exit and exit status of a command. Logical operators for conditional execution. The test command and its shortcut. The if, while, for and case control statements. The set and shift commands and handling positional parameters. The here ( << ) document and trap command. Simple shell program examples. File inodes and the inode structure. File links – hard and soft links. Filters. Head and tail commands. Cut and paste commands. The sort command and its usage with different options. The umask and default file permissions. Two special files /dev/null and /dev/tty. Topics from chapter 11, 12, 14 of text book 1,chapter 17 from text book2 Module-5 Meaning of a process. Mechanism of process creation. Parent and child process. The ps command with its options. Executing a command at a specified point of time: at command. Executing a command periodically: cron command and the crontab file.. Signals. The nice and nohup commands. Background processes. The bg and fg command. The kill command. The find command with illustrative example. Structure of a perl script. Running a perl script. Variables and operators. String handling functions. Default variables - $_ and $. – representing the current line and current line number. The range operator. Chop() and chomp() functions. Lists and arrays. The @- variable. The splice operator, push(), pop(), split() and join(). File handles and handling file – using open(), close() and die () functions.. Associative arrays – keys and value functions. Overview of decision making loop control structures – the foreach. Regular expressions – simple and multiple search patterns. The match and substitute operators. Defining and using subroutines. 08 Hours 08 Hours Topics from chapter 9 and 19 of text book 1. Topics from chapter 11 of reference book 1 Course outcomes: After studying this course, students will be able to:  Explain UNIX system and use different commands.  Compile Shell scripts for certain functions on different subsystems.  Demonstrate use of editors and Perl script writing Question paper pattern: The question paper will have ten questions. There will be 2 questions from each module. Each question will have questions covering all the topics under a module. The students will have to answer 5 full questions, selecting one full question from each module. Text Books: 1. Sumitabha Das., Unix Concepts and Applications., 4th Edition., Tata McGraw Hill 2. Behrouz A. Forouzan, Richard F. Gilberg : UNIX and Shell Programming- Cengage Learning – India Edition. 2009. Reference Books: 1. M.G. Venkatesh Murthy: UNIX & Shell Programming, Pearson Education. 2. Richard Blum , Christine Bresnahan : Linux Command Line and Shell Scripting Bible, 2ndEdition , Wiley,2014. 1-3

Text from page-4

UNIX AND SHELL PROGRAMMING MODULE 1: UNIX ARCHITECTURE AND COMMAND USAGE GENERAL PURPOSE UTILITIES ESSENTIAL SYSTEM ADMINISTRATION 1.1 1.2 1.3 1.4 1.5 1.6 Introduction Unix Architecture Features of Unix POSIX and Single Unix Specification The Login Prompt Command Structure 1.6.1 Options 1.6.2 Filename Arguments 1.6.3 Exceptions 1.7 Understanding of Some Basic Commands 1.7.1 echo 1.7.2 printf 1.7.3 ls 1.7.4 who 1.7.5 date 1.7.6 passwd 1.7.7 cal 1.8 Flexibility of Command Usage 1.9 Internal and External Commands 1.10 type 1.11 man 1.11.1 man: Browsing the Manual Pages Online 1.11.2 Understanding the man Documentation 1.11.3 Using man to Understand man 1.11.4 Further Help with man –k, apropos and whatis 1.12 more 1.13 Knowing the User Terminal, Displaying its Characteristics and Setting Characteristics 1.13.1 uname : Knowing your Machines Characteristics 1.13.2 tty: Knowing your Terminal 1.13.3 stty: Displaying and Setting Terminal Characteristics 1.14 Managing the Nonuniform Behaviour of Terminals and Keyboards 1.15 Types of Accounts 1.15.1 The root Login 1.15.2 su: Becoming Super user 1.16 /etc/passwd and /etc/shadow Files 1.17 Managing Users and Groups 1.17.1 groupadd 1.17.2 Commands to Add, Modify and Delete users useradd usermod userdel 1-4

Lecture Notes