Sei sulla pagina 1di 2

OPERATING SYSTEMS and UNIX

LABORATORY
III B. Tech (CSE) - I Semester
Int. Marks: 25; Ext. Marks: 50; Total Marks: 75
L T P C
- - 3 2
UNIX LABORATORY:
Practical Excercises
Exercise 1
a) Create two files source.txt and dest.txt using vi editor which contains some
text and practice the following commands on that files. cat, tail, head , sort,
nl, uniq, grep, egrep, fgrep, cut, paste, join,
tee, pg, comm, cmp, diff,cp, mv, ln, rm, unlink, tty, script, clear, date, cal,
mkdir, rmdir, du, df, find, umask, ps,who, w.
Exercise 2
a)Write a shell script that takes a command line argument and reports on whether
it is directory, a file, or something else.
b)Write a shell script that accepts one or more file names as arguments and conv
erts all of them to uppercase, provided they exist in the current directory.
Exercise 3
a)Write a shell script that accepts a file name,starting and ending line numbers
as arguments and displays all the lines between the given line numbers.
b)Write a shell script that deletes all lines containing a specified word in one
or more files supplied as arguments to it.
Exercise 4
a)Write an interactive file-handling shell program. Let it offer the user the ch
oice of copying, removing, renaming, or linking files. Once the user has made a
choice, have the program ask the user for the necessary information, such as the
file name, new name and so on.
b)Write a shell script that takes a login name and reports when that person logs
in
c)Write a shell script to read two file names and it should check whether the tw
o file contents are same or not. If they are same then second file should be del
eted.
Exercise 5
a)Simulate Uniq command using C.
b)Simulate grep command using C.
Exercise 6
Write a C program that takes one or more file or directory names as input and re
ports the following information on the file:
i)File type
ii)Number of links
iii)Read, write and execute permissions
iv)Time of last access
(Note : Use stat/fstat system calls)
Exercise 7
a)Write a C Program to display Environment variables.
b)Write a C Program to implement Different types of exec functions.
Exercise 8
a)Write a Program to handle the Signals like SIGINT, SIGQUIT, and SIGFPE.
b)Write a Program to create a Zombie Process.
c)Create a Process using fork() and display Child and Parent Process Id's.

Exercise 9
Implement the Following IPC Forms
a)FIFO
b)PIPE
Exercise 10
Write a program to
a) Create the semaphores
b) Set values to semaphores
c) Get the values from the semaphores
d)Remove semaphore
Exercise 11
a)Implement file transfer using Message Queue form of IPC
b)Write a program to create an integer variable using shared memory concept and
increment the variable simultaneously by two
processes. Use semaphores to avoid race conditions
Exercise 12
Perform client and server socket Programming for exchanging of data Using System
calls.
REFERENCE BOOKS:
1.Sumitabha Das, "Your Unix The Ultimate Guide," Tata McGraw
Hill, 2007.
2.B.A. Forouzan & R.F. Giberg, "Unix and Shell Programming,"
Thomson Learning.
3.Richard Stevens, "Advanced UNIX Programming," 2ed,
Pearson Education.
4.Abraham Silberschatz, Peter Baer Galvin and Greg Gagne,
"Operating System Principles", Seventh Edition, Wiley India
Edition, 2006.
128

Potrebbero piacerti anche