UNIX and Shell Programming
Course Title: UNIX and Shell Course Code: BEW303
Programming
Contact Hours: L: 3 T: 0 P: 2 Examination Duration: 03 Hrs
Credits: 04 Semester: III
Basic programming knowledge
(preferably in C), Understanding of
operating system fundamentals,
Program: BCA Prerequisite: Familiarity with file systems and
process
concepts.
Course Objectives:
To introduce students to Unix/Linux operating system environments.
To develop skills in writing shell scripts for automating administrative and programming tasks.
To familiarize students with Unix commands, file handling, and process control.
Course Outcomes (COs):
After completing this course, students will be able to:
CO1: Understand the structure and functioning of Unix operating system.
CO2: Use Unix commands for file manipulation, process management, and user communication.
CO3: Write shell scripts using different shells (e.g., Bash, Bourne).
CO4: Develop programs that utilize Unix system calls.
CO5: Use shell programming to automate tasks and enhance productivity.
Unit 1: Introduction to Unix/Linux Environment
History and architecture of Unix, Unix file system structure, Basic commands: ls, pwd, cd, cp, mv,
rm, man, echo, File permissions, links (hard & symbolic), Users, groups, file ownership.
List of Experiment:
1. File and directory manipulation using shell commands
2. Implementing shell scripts using conditional and looping constructs
Unit 2: File Handling and Filters
Standard I/O and redirection (>, <, >>, |), Filters: grep, cut, sort, uniq, wc, tee, tr, head, tail,
File comparison: cmp, diff, comm, Pattern matching with regular expressions.
List of Experiment:
1. Shell script to backup files and directories
2. Shell script for user login report and process monitoring
Unit 3: Shell and Shell Programming
Types of shells: Bourne, C, Bash, Shell syntax: variables, operators, expressions, Control
structures: if, case, while, for, until, break, continue, Functions and arrays in shell, Reading
56 | B C A
input and command-line arguments.
List of Experiment:
1. Use of awk and sed for text processing
2. Script to automate system updates and cleanup
Unit 4: Process and Job Control
Process concepts: ps, top, kill, nice, bg, fg, jobs, Parent and child processes, Signals and signal
handling, System calls: fork(), exec(), wait(), exit(), Scheduling and background jobs.
List of Experiment:
1. Creating and managing crontab jobs
2. Demonstrating use of system calls using C with fork() and exec()
Unit 5: Advanced Shell Scripting and Utilities
Shell script debugging and error handling, Crontab and automation, Text processing with awk
and sed, Introduction to vi, nano, and shell customization, Scripting for system administration
tasks.
List of Experiment:
1. Text search and report generation using grep, cut, sort
2. Mini project: build a command-line utility tool (e.g., disk usage analyzer, log parser)
Textbooks / References:
1. "Unix and Shell Programming" – B.M. Harwani
2. "Unix Concepts and Applications" – Sumitabha Das
3. "Beginning Shell Scripting" – Eric Foster-Johnson
4. Unix man pages and online documentation (e.g., GNU Bash Manual)
57 | B C A