Os Practical
Os Practical
BACHELOR OF TECHNOLOGY
4th Semester
Computer Science & Engineering Department
PARUL UNIVERSITY
FACULTY OF ENGINEERING AND TECHNOLOGY
OPERATING SYSTEM (303105252) B. TECH.
2NDYEAR
CERTIFICATE
Date:
Signature Signature
(Head of department) (Lab teacher)
INDEX
SR. Page Perform Assess Marks Sign
N
Title No. ance -ment
O
Date Date
01 Study of Basic
Commands of Linux
02 Study the basics of
Shell programming
03 Write a Shell script
to print given
numbers sum of all
digits
04 Write a shell script
to validate the
entered date.
05 Write a shell script
to check entered
string is palindrome
or not.
06 Write a Shell script
to say good
morning/Afternoon
/Evening as you log
in to system
07 Write a C program
to create a child
process.
08 Finding out from
given biggest three
Practical – 01
Aim: Study of Basic Commands of Linux.
1. pwd Command: The pwd command is used to display the location of the
current working directory.
2. touch Command: The touch command is used to create empty files. We
can create multiple empty files by executing it once.
3. cd Command: The cd command is used to change the current directory.
4. mkdir Command: The mkdir command is used to create a new directory
under any directory.
5. rmdir Command: The rmdir command is used to delete a directory.
Flow-Chart:
Output:
ShellScript:
dd=0
mm=0
ShellScript:
is_palindrome() {
local str="$1"
local reversed_str=""
local length=${#str}
Practical – 06
Aim: Write a Shell script to say Good Morning / Afternoon /
Evening / Night as you log in to System.
ShellScript:
#!/bin/bash
hour=$(date +%H)
if [ $hour -ge 5 ] && [ $hour -lt 12 ]; then
greeting="Good Morning"
elif [ $hour -ge 12 ] && [ $hour -lt 17 ]; then
greeting="Good Afternoon"
elif [ $hour -ge 17 ] && [ $hour -lt 21 ]; then
greeting="Good Evening"
else
greeting="Good Night"
fi
echo "$greeting, $(whoami)!"
Output:
Output:
Output:
if [ -f "$newfile1" ]; then
echo "File Is Found."
else
echo "File Is Not Found."
fi
Output: