0% found this document useful (0 votes)
51 views11 pages

Osv Lab Manual

The document contains a certificate for completing coursework in Operating Systems and Virtualization along with the coursework submissions. It lists 13 practical assignments completed by the student on topics like Linux commands, shell scripting, algorithms and date validation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views11 pages

Osv Lab Manual

The document contains a certificate for completing coursework in Operating Systems and Virtualization along with the coursework submissions. It lists 13 practical assignments completed by the student on topics like Linux commands, shell scripting, algorithms and date validation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

GYANMANJARI INSTITUTE OF TECHNOLGY

SIDSAR ROAD, BHAVNAGAR

BASIC MECHANICAL ENGINEERING


(3110006)

(3141601)

Name: __________________________ ____________

Enrollment No. : __________ _______ _____________

Division: ___ I.T.


D _Batch: __ ___ Branch: _______ ____

2023-24
Academic Year: ____________
GYANMANJARI INSTITUTE OF TECHNOLOGY
BHAVNAGAR

CERTIFICATE
This is to certify that

Mr. / Ms___________________________________________

4th ,
Roll No.____ Enrollment No. _______________of semester ___
I.T.
branch _______________and batch _____ has satisfactorily
completed his / her term work as prescribed in syllabus and within the
premises of Gyanmanjari Institute of Technology, Bhavnagar in the
subject name Operating
__________________________code__________.
System and Virtualization 3141601

Faculty HOD

Date:
GYANMANJARI INSTITUTE OF TECHOLOGY
BHAVNAGAR

INDEX
NAME OF STUDENT : BRACH : I.T. .
ROLL NO : ENROLLMENT NO : BATCH : SEM : 4th .

SUBJECT NAME : Operating System and SUBJECT CODE : 3141601


.
virtualization

SR.
PROGRAM TITLE DATE MARKS SIGN
NO.

1. Practical-1
2. Practical-2
3. Practical-3
4. Practical-4
5. Practical-5
6. Practical-6
7. Practical-7
8. Practical-8
9. Practical-9
10. Practical-10
11. Practical-11
12. Practical-14
Practical : 1

1 Study of basic Commands of LINUX/UNIX.

1. Echo
2. Cal
3. clear
4. Ls
5. Cd
6. Pwd
7. Mkdir
8. Rmdir
9. Mv
10. Cp

Practical : 2

2 Study of Advance commands and lters of Linux/UNIX

1. Cat
2. Rm
3. Wc
4. Chmod
5. Exit
6. Uname
7. Sty
8. Who
9. Whoami
10. Date
11. Time

Page 1 of 8
fi
Practical : 3

3 Write a shell script to generate marksheet of a student. Take 3 subjects, calculate and
display total marks, percentage and Class obtained by the student

echo "*****************"
echo "Student Marksheet"
echo "*****************"
echo "Enter Operating System Marks:"
read os
echo "Enater C++ Marks:"
read cpp
echo "Enater Java Marks:"
read java
echo "*****************"
total=`expr $os + $cpp + $java`
echo "Total Marks:"$total
percentage=`expr $total / 3`
echo "Percentage:" $percentage %
if [ $percentage -ge 60 ]
then
echo "Class: First Class Distinction"
elif [ $percentage -ge 50 ]
then
echo "Class: First class"
elif [ $percentage -ge 40 ]
then
echo "Class: Second class"
else
echo "Class: Fail"

echo “*****************"

Page 2 of 8
fi
Practical : 4

4 Write a shell script to display multiplication table of given number

echo "Enter Number to Generate Multiplication Table"


read -p "Enter the number : " number
echo "***********************"
i=1
while [ $i -le 10 ]
do
echo " $number * $i =`expr $number \* $i ` "
i=`expr $i + 1`
done
echo “***********************”

Practical : 5

5 Write a shell script to nd factorial of given number n.

read -p "Enter the number : " number


fact=1
while [ $number -gt 1 ]
do
fact=$((fact * number)) #fact = fact * num
number=$((number - 1)) #num = num - 1
done
echo "Result:" $fact

Practical : 6

6 Write a shell script which will accept a number b and display rst n prime numbers
as output.

Page 3 of 8
fi
fi
read -p "Enter the NUmber: " n
echo "The prime numbers $n are: "
m=2
while [ $m -le $n ]
do
i=2
ag=0
while [ $i -le `expr $m / 2` ]
do
if [ `expr $m % $i` -eq 0 ]
then
ag=1
break

i=`expr $i + 1`
done
if [ $ ag -eq 0 ]
then
echo $m

m=`expr $m + 1`
done

Practical : 7

7 Write a shell script which will generate rst n bonnacci numbers like: 1, 1, 2, 3, 5,
13, …

read -p "Enter the Number: " number


x=0
y=1
i=2
echo "Fibonacci Series Upto $number Number: "
echo "$x"
echo "$y"
while [ $i -lt $number ]
do
Page 4 of 8
fi
fl
fl
fi
fl
fi
fi
i=`expr $i + 1`
z=`expr $x + $y`
echo "$z"
x=$y
y=$z
done

Practical : 8

8 Write a menu driven shell script which will print the following menu and execute
the given task.

1. Display calendar of current month


2. Display today’s date and time
3. Display usernames those are currently logged in the system
4. Display your name at given x, y position
5. Display your terminal number

echo "Select Anyone Option"


echo "**************************************************"
echo "1)Display Calener of current month"
echo "2)Display Today's Date and Time"
echo "3)Display Username who are currently logged in"
echo "4)Display your name on given x,y position"
echo "5)Display your terminal Number"
echo "6)Exit"
echo "Enter your choice:"
read ch
case $ch in
1)cal;;
2)date;;
3)who;;
4)row=$(tput lines)
col=$(tput cols)
echo "Terminal Window has Rows=$row Cols=$col"
echo "Enter desired X,Y position"
echo "X position="
read x
echo "Y position="
read y
Page 5 of 8
echo "Enter the name"
read name
tput cup $x $y
echo "$name";;
5)tty;;
6)echo "Exit";;
*)echo "Enter valid choice";;
esac

Practical : 9

9 Write a shell script to read n numbers as command arguments and sort them in
descending order.

read -p "Enter The Number: " n


for((i=0; i<$n; i++))
do
read -p "Enter value of arr[$i]: " arr[$i]
done
#sorting code
for((i=0; i<$n; i++))
do
for((j=0; j<n-i-1; j++))
do
if [ ${arr[j]} -lt ${arr[$((j+1))]} ]
then
#swapping
temp=${arr[j]}
arr[$j]=${arr[$((j+1))]}
arr[$((j+1))]=$temp

done
echo "Numbers in Descending order: " ${arr[*]}

Page 6 of 8
fi
Practical : 10

10 Write a shell script to display all executable les, directories and zero sized les from
current directory.

echo Executable les


les=$( nd lab_solutions -executable -type f)
echo $ les
echo
echo List of Directories
dir=$(ls -d )
echo $dir
echo
echo List of zero sized les
zero=$( nd -size 0)
echo $zero

Practical : 11

11 Write a shell script to check entered string is palindrome or not.

echo "Input your string without space"


read vstr
for i in $(seq 0 ${#vstr})
do
rvstr=${vstr:$i:1}${rvstr}
done

echo "Input string was :" $vstr


echo "After Reversng String Is :" $rvstr

if [ "$vstr" = "$rvstr" ]
then
echo "String Is Palindrome."
else
Page 7 of 8
fi
fi
fi
fi
fi
fi
fi
fi
echo "String Is Not Plaindrome."

Practical : 14

14 Write a shell script to validate the entered date. (eg. Date format is : dd-mm-yyyy).

read -p "Enter date (dd mm yy): " day month year


if ((day < 1 || day > 31 || month < 1 || month >
12 || year < 0 || year > 99)); then
echo "Invalid date"
exit 1

case $month in
4|6|9|11) max_days=30 ;;
2)
if ((year % 4 == 0 && (year % 100 != 0
|| year % 400 == 0))); then
max_days=29
else
max_days=28

;;
*) max_days=31 ;;
esac
if ((day > max_days)); then
echo "Invalid date"
else
echo "Valid date"

Page 8 of 8
f
fi
fi
fi

You might also like