PESIT- Bangalore South Campus Hosur Road (1km B efo r e Electronic city) Banga lore – 560 10 0

Department of MCA COURSE INFORMATION SHEET

INTRODUCTION TO UNIX (13MCA14)

1.

GENERAL INFORMATION Academic Year: 2015 Semester(s):I Title INTRODUCTION TO UNIX

Code 13MCA14

Duration (hrs) 52 Hrs Lecture s Total: 52 Hrs

2. FACULTY DETAILS Details Name Prof Ajoy Kumar Department MCA Room HOD ROOM 5TH Number FLOOR Phone No. 08066186629 E-mail [email protected] address Hours Office Hours Contact Consultation By Email Time 3. VENUE AND HOURS/WEEK All lectures will normally be held in 500. Lecture Hours/week: 4Hr

PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

4. C O U R S E OUTCOMES: The STU DE NT W ILL BE ABLE :  To learn the basic commands of unix.  To learn shell programming.  To learn file system.  To learn awk programming.  To learn advanced shell programming. . 5. MODULE SPECIFICATION: Class No.

Topics to be covered Chapter Title

1 2 3 4 5

UNIT 1: Introduction to UNIX

6 7 8 9 10 11 12 13 14

UNIT 2: Introduction to Shell

Introduction, Histroy,Architecture Experience the Unix environment Banner, cal, date, who, printf, echo, tput, bc tty, sty, uname, passwd, lock, script, spell and ispell The file, what’s in s filename? The parentchild relationship, pwd, the home directory, absolute pathnames using absolute pathnames for a command, Cd, mkdir Rmdir, Relative pathnames The UNIX file system Introduction to shell scripting, shell scripts Read, command line arguments, exit status of a command Logical operators && and II If and case conditions, expr, sleep and wait While, until, for , $ ,@,

% of portions covered Referen Cumulativ ce e Chapter

17%

17%

13%

30%

PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

redirection The here document, set, trap Sample validation and data entry scripts. ls –l and -d option,

15 16 17 18 19

25 26 27

file permissions, chmod Security and File permissions Users and groups, Security level, changing permission, user masks, more file attributes Hard link, symbolic link, unmask and find. Pr, head, tail, Cut, paste, sort Sort, Uniq, tr commands

28

Grep, Regular Expression

29

egrep, fgrep,

20 21 22

UNIT 3: Basic File attributes

23 24

30 31

UNIT 4: Simple Filters

32 33 34

35 36 37 38

UNIT 5: AwkAdvanced Filters

a sed instruction Grep, Regular Expression Line addressing, inserting and changing Test Context addressing, writing selected lines to a file The –f option, substitution, properties of Regular Expressions Simple awk filtering, splitting a line in to fields, printf, the logical and relational operators Number processing, variables, the –f option The BEGIN and END positional parameters, get line, built-in variables Arrays, functions, interface with the shell, control flow The sh command, export, cd, the command

17%

47%

16%

63%

17%

80

PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

39

Expr, conditional parameter substitution, merging streams, Shell functions Simple awk filtering, splitting a line in to fields, printf, the logical and relational operators Number processing, variables, the –f option Process basics, PS, internal External commands, running jobs in background Nice, at and batch,cron

40 41

42 43 44 45 46 47

UNIT 6: The Process

48 49

50 51 52

UNIT 7: Advanced System Adminstration

Time commands, essential system administration root, Administrator’s privileges, startup & shutdown Managing disk space, cpio,tar Customizing the environment: system variables, profiles, sty,pwd Aliases, command history, on-line command editing Case study: emacs editor

96%

16%

4%

And any one distribution of linux

PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

100%

Literature /References Book Type Text Book

Cod e T1

Reference book

R1 R2

Title

Author

Your UNIX–The Ultimate Guide

Sumithabha Das Tata McGraw Hill

Unix Shell Programming Beginning Shell Scripting,

Yashwant Kanetkar Eric Foster-Johnson John C Welch, Micah Anderson , Wrox publication

QUESTION BANK Unit1 Overview: this unit begins the tour of the unix universe. To understand what an operating system and the unix architecture. 1) Explain the structure of UNIX System along with block schematic. 2) Mention any four communication feature commands of UNIX. Discuss each one of them very briefly. 3) Describe the architecture of UNIX O.S 4) Explain the parent child relationship between various files in the organization of files in UNIX and give the meaning of two special directory names : the dot(.) and the double dot (..) 5) Give history of UNIX 6) Mention different category of files that exist in UNIX. Discuss each one them briefly. 7) What is the use of kernel in UNIX operating systems? 8) How will you prevent others from using your terminal? Explain in brief. 9) Write a short note on UNIX philosophy? 10) What is the difference between the following commands: 11) a) cp and copy b) cp and mv c) comm. and cmp d) comm. and diff 12) Explain multi-user capability of UNIX? 13) Explain tee and wc command in UNIX 14) Explain the following commands with example: split, sort, uniq and file. 15) What is a grep command. Explain the families of grep command. Explain any 4 options of grep command with suitable example. 16) What are times associated with files. Discuss their importance. Hence or otherwise discuss how these times can be changed. 17) Create 5 empty files empty1, empty2, empty3, empty4 and empty5 18) Combine the contents of file text and matter into txtmat Unit2 overview: the shell has a whole set of internal commands that can be strung together as a language. A shell program runs in interpretive mode PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

19) List all the files in the current directory whose second character is a digit. 20) Output of who should be sorted and displayed on the screen along with total number of users. The same output should be stored in a file called file1. Construct a piping mechanism for this. 21) Explain the command using which one can know the details of the users using the system currently. 22) Discuss the remainder facility available in UNIX. 23) Explain the command using which the arithmetic is performed in UNIX. 24) What do you mean by co mmand substitution. Explain the same with the aid of simple example. 25) How are files organized. Discuss the same with the aid of a diagram that depicts the organizational structure. 26) What do you mean by concatenating of files. Mention the command that is used for the same and explain. Hence or otherwise write a command line that counts the total number of lines on the concatenated file. 27) Explain clearly what for pipes and tees are used. 28) Explain echo and tput commands. 29) Explain bc, wc and split command in UNIX 30) What do you mean by I/O redirection. With the aid of necessary illustrations explain how redirection is accomplished in UNIX. 31) Explain tee command 32) Mention different members of grep family of commands and explain each one of them very briefly. Unit 3 Overview: in this unit we will learn hard link, symbolic link and umask. It will gives the information of simple filters 33) Explain chmod command 34) Write a command line to search for a specific word ( say KARNATAKA ) and substitute the word INDIA in its place over the entire file. Explain the same 35) Mention atleast the two most widely used special characters to construct regular expressions. Clearly mention the special meanings associated with these characters. When do these characters loose their special meaning. 36) Write a command line using which one can obtain the long listing of a file along with its inode number, Very briefly explain each filed of the expected output. 37)Explain the following commands : banner, calendar, echo, ispell each with an example. 37) In how many modes one can work with a VI editor. Mention and discuss each one of them briefly. 38) Explain the commands using which one can get into the input mode of VI editor from its command mode 39) With few entries write a typical profile file and explain the same. 40) What is .exrc file. When and why it is used. Discuss. Unit 4 Overview: in this unit you will learn what is filter using regular expression and grep family. PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

41)

Write a short note on VI editor?

42)

What are the different ways a text can be inserted in Vi editor. Explain.

43) 44)

What are different modes of VI editor ? Explain How do you run a background process.

45)

List out the drawback of background process.

46)

What do you mean by Daemon process. How will you kill a daemon process.

47)

How will you terminate a process which has gone into an infinite loop.

48)

Two consecutive lines are to be combined into one. Which vi command would

you use to do so. 49)

Write a shell script to accept a string as command line and reverse it.

50) Write a shell script which reports names and sizes of all files in a directory (directory name should be supplied as an argument ) whose size exceeds 1000 bytes. The filenames should be printed in descending order of their sizes. The total number of such files should also be reported 51)

How are shell variables defined, assigned values and evaluated? Discuss.

52) Write a shell script which is expected to accept two file names as its arguments. Check the number of arguments and display the contents of the argument files if the number of arguments is two. Otherwise display an error message and exit. 53)

How are shell scripts debugged. Discuss

54) Discuss the two methods of getting input into a shell script. Illustrate the same with examples. Unit 5 Overview: in this unit it provides system administrator also known as as the super user or root user. You will learn the concept of run levels and their role. 55) Write a shell script that reads in a message (some thing like GOOD MORNING ) and displays it ten times at regular intervals of 60 secs. . 56) Write a shell script that prints out date information in the order : time day of week number day number month year, i .e like 12.44.32 PDT MON 17 Oct 1996 57) Write a shell script that sends a banner ‘THANK YOU ‘ to your screen every 40 seconds. 58) Write a shell script to accept a string as command line argument and reverse it. 59) Write a shell script that reads data from a text file and appends the lines starting with an alphabet from ‘a’ through ‘k’ to a file name “ak” and the lines starting with the alhabets ‘l’ through ‘s’ to a file name “ls” and the lines between ‘t’ and ‘z’ into the file tz”.Then display the number of the files ak ls and tz individually. PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

60) Write a shell script to find out whether a user whose login name passed as the parameter is currently logged in or out. If the user is logged in, send the file ‘hello’ which is available in the current directory to his terminal. 62)What is sed instruction. Explain the following with respect to sed. 61)

Line addressing, 2) Context addressing

62)

Explain any four built in variables of awk with examples.

63)

Give the general structure of an awk program. Hence or otherwise discuss

the operational mechanism of awk 64)

What is “sed”? Explain any five application of sed.

65)

Explain programming features supported by “awk” for flow control.

66)

Explain with an example the built in function awk.

67)

Explain with examples simple awk filtering.

68)

Explain sed commands with all options.

69) Write an awk sequence to find the HRA, DA and net pay of an employee, where DA is 30% of basic, HRA is 10% of basic and net pay is the sum of HRA,DA and the basic pay with suitable heading. 70) How substitution can be achieved using Sed Command? Explain Who is a System Administrator. Outline his jobs. Mention any four simple rules to be adopted by the administrator while administering the system. 71) Explain the following list of security tips for administrator use only authorized commands, 2) protect your super users 3)use password aging, 4) provide accountability 5)protect administrative files 72) 73)

With example explain the tar command. What is an inode. What are the contents of an inode. Explain how kernel

accesses a File. 74)

What is fsck command. What is accomplished with this command

75)

What are inodes. What information do they contain. Discuss.

76)

What do you mean by mounting and unmounting of a file system. Explain

them very briefly. Unit 6 Overview: in this unit we will disscuss awk command and understand special properties of awk variables and expression 77)

What are soft links and hard links. Discuss with the aid of examples. PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

78)

Explain df and du commands.

79)

Who can use fsck command. What is accomplished with this command.

80)

What are privileges of system administrator. Discuss

81) Mention the commands that are used to manage disk space and explain each one of them very briefly. [ 82)

What are symbolic links. Explain how one can have a symbolic link to file

83) With the aid of a typical entry on a /etc/passwd file discuss the role of entries made on each of its fields. 84) What are inodes. What information will be stored with them. Explain 85)

What for sticky bit is used. Who can assign this to file and how.

86)

How to become a super user?

87)

What are super users administrative privileges.

88)

Explain the utilities used for file system administration.

89)

Explain the command find? Also explain how to manage disk space.

90)

What are the different duties and privileges of system administration.

Unit 7 Overview: in this unit how the shell uses a second to execute a shell script. When and how commands are executed in the current shell and a sub shell. 91)

Explain the usage of CPIO command with example.

92)

Explain the file system mounting.

93)

What are inodes and what are the contents of Inodes?

94)

Explain the sequence of blocks organized in the UNIX file system?

95)

Explain the boot block in UNIX file system?

96)

Write short notes on internal structure of file system?

97) Write a shell program that prompts the administrator for information about a new user and creates a new entry for that user in /etc/passwd. 98)

Explain how to handle multiple files.

100)Explain any 5 advanced shell programming.

PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester

PESIT, SOUTH CAMPUS– Course Information – MCA-I Semester