0% found this document useful (0 votes)
5 views33 pages

OS Lab Manual

The document is a lab manual for the Operating System course at Shree Parekh Engineering College, detailing practical experiments for students. It includes a certification section for Mr. Rana Jaypalsinh .P, along with a comprehensive list of experiments related to Linux/Unix commands and shell scripting. Each experiment has assigned dates for completion and submission, covering various topics like WSL, shell scripting, and arithmetic operations.

Uploaded by

Jaypalsinh Rana
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)
5 views33 pages

OS Lab Manual

The document is a lab manual for the Operating System course at Shree Parekh Engineering College, detailing practical experiments for students. It includes a certification section for Mr. Rana Jaypalsinh .P, along with a comprehensive list of experiments related to Linux/Unix commands and shell scripting. Each experiment has assigned dates for completion and submission, covering various topics like WSL, shell scripting, and arithmetic operations.

Uploaded by

Jaypalsinh Rana
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/ 33

😀 OPERATING SYSTEM

SHREE PAREKH ENGINEERING COLLEGE


MAHUVA

DEPARTMENT OF
INFORMATION & TECHNOLOGY

LAB MANUAL

OPERATING SYSTEM
SHREE PAREKH ENGINEERING COLLEGE
MAHUVA

CERTIFICATE

This is to certify that

Mr. Rana Jaypalsinh .P Enrollment No. 241473107001 of Semester-4 Computer


Engineering and Batch 2024-25 has satisfactorily completed his/her practical work as
prescribed in syllabus of the subject OPERATING SYSTEM (3141601) as prescribed
by Gujarat Technological University during the academic term 2024-25.

Date:

Head of the Department Faculty In-Charge


Prof. Krishna Rathod Prof.Gunjan Dashore
Sr. Experiments List Date of Date of Sign.
No. assign submission
1 To Demonstrate WSL (Windows Subsystem for
Linux) Feature on Windows 11. 19/12/2024

2 To Study The Basic and Advanced Command Of


Linux/Unix. 26/12/2024

3 To Study the Advance Command and Filters Of


Linux/Unix. 02/01/2025

4 Write a shell script to generate a marksheet of a


student. Take 3 subjects, calculate and display 09/01/2025
total marks, percentage and Class obtained by the
student.
5 Write a shell script to find the factorial of given 16/01/2025
number n.
6 Write a shell script which will generate first n
23/01/2025
fibonacci numbers like: 1, 1, 2, 3, 5, 13, …
7 Write a menu driven shell script which will print 30/01/2025
the following menu and execute the given task.
a. Display calendar of current month
b. Display today’s date and time
c. Display usernames those are currently logged in
the system
d. Display your name at given x, y position
e. Display your terminal number
8 Write a shell script to check if the entered string is 06/02/2025
palindrome or not.
9 Study of Unix Shell and Environment Variables. 13/02/2025
10 Write a shell script to implement Arithmetic
20/02/2025
operation.
11 Write a shell script to implement a conditional 27/02/2025
statement.
12 To study loop control in shell scripting. 06/03/2025
13 To study Functions in shell scripting 13/03/2025
14 Shell programming using filters (including grep, 20/03/2025
egrep, fgrep).

27/03/2025

19/12/2024

26/12/2024

02/01/2025

09/01/2025
AIM 1 : To Demonstrate WSL (Windows subsystem for Linux) Feature on Windows 11.

Step 1 : Click Start Button and Search ‘Control Panel’ and Click Control Panel Icon.
Step 2 : Click on ‘Program’.

Step 3 : Click on ‘Program and Feature’.


Step 4 : Click on ‘Turn Windows Feature on or off’.

Step 5 : Then Show a Dialog Box, and Click on the ‘Hype-V’ Check Box.
Step 6 : Click the ‘Windows Subsystem for Linux’ Check Box.
Step 7 : Type on Keyboard ‘Windows Key + R’, and type “CMD”.

Step 8 : Type this Command - ‘wsl --list --online’.


Step 9 : above command output shown (linux distribution list).

Step 10 : Type this command for ubuntu ‘wsl --install -d Ubuntu-24.04’.


Step 11 : Download Progress.

Step 12 : Downloading and installing of Ubuntu 24.04 version are completed.


Step 13 : To create new user name and password.

Step 14 : After Successfully user name and password created, Welcome page of ubuntu.
Step 15 : Type this Command for update “wsl --update”.

Step 16 : Update Process.


AIM 2 :
To Study The Basic and Advanced Command Of Linux/Unix.
AIM 3 :
To Study and Defining Variables in Shell Scripting.

Variables in shell scripting are containers for storing necessary information. In Bash Script, declare
a variable by assigning a value to its reference by = operator. Furthermore, print the assigned values
using echo $(VARIABLE_NAME).

The rules for Variables in Shell Scripting are as follows:

● Use the equal sign (=) to assign values to variable names.


● Variable names are case sensitive i.e. ‘A’ and ‘a’ are different.
● To refer to a variable use the dollar sign ($) e. $VARIABLE_NAME.
● While updating/changing the variable values use only the variable name with the
assignment operator(=) i.e. VARIABLE_NAME= NEW_VALUE.
● No need to define variable type while declaring variables.
● Enclose multiple words or string values within Single Quote (‘ ‘) to consider all characters
as input.

OUTPUT :
AIM 4 :
To concatenate multiple variables and store them into a single variable.

To concatenate multiple variables and store them into a single variable, enclose them with a double
quotation (“ ”) and then write the variables within {} consecutively. Here is an example:

OUTPUT :

AIM 5 :
To Perform Arithmetic All Operation Using Scripting.

Addition : Run an addition operation using the + operator between defined variables and enclose
them with $(). Here’s an example.

Output :

Subtraction : Subtract two numbers using the - operator between defined variables and enclose
them with $(). Here’s an example.

Output :

Division : Run a division using the / operator between defined variables and enclose them with $().
Here’s an example script.
Output :

AIM 6 :
Calculate The Area Of A Rectangle.
Write the formula to calculate the area of a rectangle inside the function Area() and call it by passing
the height and width.

Output :

AIM 7 :
Check If A Number Is Even Or Odd.
If a number is even, then its remainder after dividing by 2 will be 0. Otherwise, the number is odd.
So, use the remainder operator % within if-else to check if a number is even or odd. Here’s how.

Output :

AIM 8 : Reverse Strings.


To reverse a string use the rev command with echo and Pipe(|). Here is a complete script showing
how to reverse a string.

Output :

AIM 9 :
Calculate The Factorial Of A Number.
Output :

AIM 10 : Loop Through Array Element.


For accessing each array element you can use the for loop in the following manner. Indicate the
desired array using ${ARRAY_NAME[@]} and access each item stored in the array.
Output :

AIM 11 : Find The Smallest And Largest Element In Array.


To find the smallest and largest element in a given array, first, initialize a small and a large number.
Then compare the array elements with these numbers inside any loop. Here’s an example script
showing how:

Output :

AIM 12 :
Check If A Number Is Prime.
Create the Prime() function that returns whether the parameter passed is prime or not. Here is the
script.

Output :

You might also like