Name: Mustafa Shaikh Fakruddin Enrollment No:1616080077 Class: CO5IB Subject: Operating System Guidence:Mudasshir Mahadik
Name: Mustafa Shaikh Fakruddin Enrollment No:1616080077 Class: CO5IB Subject: Operating System Guidence:Mudasshir Mahadik
Name: Mustafa Shaikh Fakruddin Enrollment No:1616080077 Class: CO5IB Subject: Operating System Guidence:Mudasshir Mahadik
Enrollment no:1616080077
Class: CO5IB
Subject: Operating System
Guidence:Mudasshir mahadik
Experiment No.1
Aim: To Install Ubuntu 20.04.1 LTS on the Desktop.
Step 1) Download Ubuntu 20.04.1 LTS ISO File Please make sure you have the latest version of Ubuntu
20.04.1 LTS, If not, please download the ISO file from the link here:
https://ubuntu.com/download/desktop
Step 2) Create a Bootable Disk Once the ISO file is downloaded then next step is to burn the downloaded
ISO image into the USB/DVD or flash drive to boot the computer from that drive. Also make sure you
change the boot sequence so that system boots using the bootable CD/DVD or flash drive.
Step 3) Boot from USB/DVD or Flash Drive Once the system is booted using the bootable disk, you can
see the following screen presented before you with options including “Try Ubuntu” and “Install Ubuntu”
as shown in the image below
Step 4) Choose your Keyboard layout Choose your favorite keyboard layout and click “Continue”. By
default English (US) keyboard is selected and if you want to change, you can change here and click
“Continue”
Step 5) Preparing to Install Ubuntu and other Software In the next screen, you’ll be provided following
beneath options including:
Type of Installation: Normal Installation or Minimal installation, If you want a minimal installation
then select second option otherwise go for the Normal Installation. In my case I am doing Normal
Installation
Download Updates While Installing Ubuntu (select this option if your system has internet connectivity
during installation)
Install third party software for graphics and Wi-Fi hardware, MP3 and additional media formats
Select this option if your system has internet connectivity)
Step 6) Select the appropriate Installation Type Next the installer presents you with the following
installation options including:
Erase Disk and Install Ubuntu
Encrypt the new Ubuntu installation for security
Use LVM with the new Ubuntu installation
Something Else Where,
Erase Disk and Install Ubuntu – Choose this option if your system is going to have only Ubuntu and
erasing anything other than that is not a problem. This ensures a fresh copy of Ubuntu 18.04 LTS is
installed in your system.
Encrypt the new Ubuntu installation for security – Choose this option if you are looking for extended
security for your disks as your disks will be completely encrypted. If you are beginner, then it is better
not to worry about this option.
Use LVM with the new Ubuntu installation – Choose this option if you want to use LVM based file
systems.
Something Else – Choose this option if you are advanced user and you want to manually create your
own partitions and want to install Ubuntu along with existing OS (May be Windows or other Linux
Flavor)
Step 7) Select Your Time zone Choose your favorite time zone and then click on “Continue”
Step 8) Provide your User Credentials In the next screen you will be prompted to provide your user
credentials. In this screen provide your name, computer name, username and the password to login into
Ubuntu 20.04.1 LTS
Step:11) Login to Your Ubuntu 20.04.1 desktop Once your system has been rebooted after the
installation then you will get the beneath login screen, enter the User name and password that you have
set during installation
Conclusion: we have successfully performed Ubuntu installation practical.
Experiment:02
Aim: Executing general purpose command DATE, time, cal, clear, banner, tty, script, man.
Commands are as follows:
1) date: date command is used to display the system date and time. date command is also
used to set date and time of the system. By default the date command displays the date in the
time zone on which unix/linux operating system is configured. Syntax: date[OPTION]…[+FORMAT]
date[-u|--utc|--universal][MMDDhhmm[[CC]YY][.ss]]
Example:
2) time: time command in Linux is used to execute a command and prints a summary of real-
time, user CPU time and system CPU time spent by executing a command when it terminates.
‘real‘ time is the time elapsed wall clock time taken by a command to get executed, while ‘user‘
and ‘sys‘ time are the number of CPU seconds that command uses in user and kernel mode
respectively. Syntax: time
[option][COMMAND] Example:
3) cal: If a user wants a quick view of calendar in Linux terminal, cal is the command for you.
By default, cal command shows current month calendar as output. cal command is a calendar
command in Linux which is used to see the calendar of a specific month or a whole year. Syntax:
cal[[month]year] Example:
4) clear: clear is a standard Unix computer operating system command that is used to clear
the terminal screen. This command first looks for a terminal type in the environment and after
that, it figures out the terminfo database for how to clear the screen. And this command will
ignore any command-line parameters that may be present. Also, the clear command doesn’t take
any argument and it is almost similar to cls command on a number of other operating systems.
Syntax: $clear Example:
Terminal Before Executing clear command:
Terminal after Executing clear command:
5) Banner: banner command in linux is used to print the ASCII character string in large letter
to standrad output. Syntax: banner text
Example:
6) tty: The tty command of terminal basically prints the file name of the terminal connected
to standard input. tty is short of teletype, but popularly known as a terminal it allows you to
interact with the system by passing on the data (you input) to the system, and displaying the
output produced by the
system. The tty command of terminal basically prints the file name of the terminal
connected to standard input. tty is short of teletype, but popularly known as a
terminal it allows you to interact with the system by passing on the data (you
input) to the system, and displaying the output produced by the system.
Syntax: tty [OPTION]….
Example:
7) script: script command in Linux is used to make typescript or record all the terminal
activities. After executing the script command it starts recording everything printed on the screen
including the inputs and outputs until exit. Syntax: script [options] [file] Example:
8) man: man command in Linux is used to display the user manual of any command that we
can run on the terminal. It provides a detailed view of the command which includes NAME,
SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS,
EXAMPLES, AUTHORS and SEE ALSO. Syntax: $man [OPTION]… [COMMAND NAME]… Example:
Conclution: We have Successfully performed general purpose command practical.
Experiment No.3
Aim: Working with multiple Linux terminals and basic commands: who, whoami, login,
passwd, su, pwd.
Commands are as follows:
1) who: who command is used to find out the following information :
1. Time of last system boot
2. Current run level of the system 3. List of logged in users and more.
Syntax: who [options] [filename] Example:
s
invoked.
-
un. Syntax: whoami Example:
\
4)
passwd: passwd command in Linux is used to change the user account 4)
passwd: The root user reserves the privilege to change the password for
any user on the system, while a normal user can only change the account
password for his or her own account. Syntax: passwd [options] [username]
Example:
5) su: The su(switch user) utility allows you to run commands
with the privileges of another user, by default the root user. Using su is
the Simplest way to switch to the Administrative account in the current
login session. This is especially handy when the root user is not allowed
to log in to the system through ssh or using GUI display manager.
Syntax: su [OPTIONS] [USER[ARGUMENT…]] Example:
6) pwd: pwd stands for Print Working Directory. It prints the path
of the working directory, starting from the root. pwd is shell built-in
command(pwd) or an actual binary(/bin/pwd). $PWD is an
environment variable which stores the path of the current directory.
This Command has 2 flags
1.pwd -L
2.pwd -P
Syntax: pwd pwd -L pwd -P
Example:
Experiment No.4
Aim: a) User operating services (Editor, GUI, File Handling)
b) Run commands to start, stop, and restart the specified service in Linux.
Editor: There are many ways to edit file in Linux. The editor enables you to edit lines in context with
other lines in the file. You can also use this editor to read a text file. We use gedit for file read and Write
in Linux.
1. Open Gedit
2. Write some text
3. Save file
GUI:
1. The Control Panel the Control Panel on the left-hand side of the screen presents shortcuts for all
of the most used applications. Using these options, we can launch the LibreOffice component, the
Firefox browser, the Software Center and many other applications.
2. The Menu Bar When we launch any application, we will get the associated menu bar at the top
of the application, which will have the different menu options for that application. We can choose to
close the entire window or resize the window, if required.
3. Taskbar On the right-hand side of the screen is the task bar. The taskbar allows us to choose the
change in volume settings, view the status of your internet connect, change your language and other
settings, and view the battery status while working on a laptop.
File Handling:
Linux provides fine-grained control over system services through systemd, using the
systemctl command. Services can be turned on, turned off, restarted, reloaded, or even
enabled or disabled at boot. If you are running Debian 7, CentOS 7, or Ubuntu 15.04 (or later),
your system likely uses systemd.
start a Service systemctl
[command] [service_name]
sudo systemctl start apache2
Experiment No.5
Aim: Execute Process Command – ps, wait, sleep, exit, kill.
1. Ps command:
3.Kill Command
Experiment No.6
Aim: Write a program to calculate total waiting time and turnaround time of process
With first come first serve CPU scheduling algorithm.
Description: First Come First Serve (FCFS) is an operating system scheduling algorithm that
automatically executes queued requests and processes in order of their arrival. It is the
easiest and simplest CPU scheduling algorithm. In this type of algorithm, processes which
requests the CPU first get the CPU allocation first. This is managed with a FIFO queue.
Algorithm:
Start
Step 1-> In function int waitingtime(int proc[], int n, int burst_time[], int wait_time[])
Set wait_time[0] = 0
Loop For i = 1 and i < n and i++
Set wait_time[i] = burst_time[i-1] + wait_time[i-1]
End For
Step 2-> In function int turnaroundtime( int proc[], int n, int burst_time[], int wait_time[], int
tat[])
Loop For i = 0 and i < n and i++
Set tat[i] = burst_time[i] + wait_time[i]
End For
Step 3-> In function int avgtime( int proc[], int n, int burst_time[])
Declare and initialize wait_time[n], tat[n], total_wt = 0, total_tat = 0;
Call waitingtime(proc, n, burst_time, wait_time)
Call turnaroundtime(proc, n, burst_time, wait_time, tat)
Loop For i=0 and i<n and i++
Set total_wt = total_wt + wait_time[i]
Set total_tat = total_tat + tat[i]
Print process number, burstime wait time and turnaround time
End For
Print "Average waiting time =i.e. total_wt / n
Print "Average turn around time = i.e. total_tat / n
Step 4-> In int main()
Declare the input int proc[] = { 1, 2, 3}
Declare and initialize n = sizeof proc / sizeof proc[0]
Declare and initialize burst_time[] = {10, 5, 8}
Call avgtime(proc, n, burst_time)
Stop
Input:
int main()
{
//process id's int
processes[] = { 1, 2, 3};
int n = sizeof processes / sizeof processes[0];
//Burst time of all processes
int burst_time[] = {10, 5, 8};
findavgTime(processes, n, burst_time);
return 0;
}
Output:
Description:
FIFO Page Replacement technique is one of the simplest one to implement amongst
other page replacement algorithms. It is a conservative algorithm.
It is a low-overhead algorithm that maintains a queue to keep a track of all the pages
in a memory.
When a page needs to be replaced, the page at the FRONT of the Queue will be
replaced. The FIFO page replacement technique is not implemented in operating
systems nowadays.
Algorithm :
Step1. Start to traverse the pages.
Step2. If the memory holds fewer pages, then the capacity else goes to step 5.
Step3. Push pages in the queue one at a time until the queue reaches its maximum capacity or
all page requests are fulfilled.
Step4. If the current page is present in the memory, do nothing.
Step5. Else, pop the topmost page from the queue as it was inserted first.
Step6. Replace the topmost page with the current page from the string.
Step7. Increment the page faults.
Step8. Stop
Input:
#include<stdio.h>
int main()
{
int reference_string[10], page_faults = 0, m, n, s, pages, frames;
printf("\nEnter Total Number of Pages:\t"); scanf("%d",
&pages);
printf("\nEnter values of Reference String:\n");
for(m = 0; m < pages; m++)
{
printf("Value No. [%d]:\t", m + 1);
scanf("%d", &reference_string[m]);
}
printf("\nEnter Total Number of Frames:\t");
{
scanf("%d", &frames);
}
int temp[frames]; for(m
= 0; m < frames; m++)
{
temp[m] = -1;
}
for(m = 0; m < pages; m++)
{
s = 0;
for(n = 0; n < frames; n++)
{
if(reference_string[m] == temp[n])
{
s++;
page_faults--;
}
}
page_faults++;
if((page_faults <= frames) && (s == 0))
{
temp[m] = reference_string[m];
}
else if(s == 0)
{
temp[(page_faults - 1) % frames] = reference_string[m];
}
printf("\n");
for(n = 0; n < frames; n++)
{
printf("%d\t", temp[n]);
}
}
printf("\nTotal Page Faults:\t%d\n", page_faults);
return 0;
}
Output:
Join Command: it is used for joining lines of two files on the basis of common field in each file
called as key.
Syntax: join file name1 file name 2 Example:
Cat Command: it is used to create the file and displaying the content of file/files.
Syntax: cat > filename Example:
Split Command: it is used split large file into smaller file.default size is 1000 lines per file
Syntax: split -n filename Example:
Experiment No.9
Aim: Execute file and directory and manipulation commands-diff, comm, pr, chmod, mkdir,
rmdir, cd, pwd, dir, cmp.
Mkdir:
it is used to create a new directory in a current directory
syntax: mkdir directory name example:
cd:
it is used to change directory
syntax: cd directory name example:
rmdir:
it used to delete/remove directory
syntax: rmdir directory name example:
pwd:
this is most used linux command to see the specific unix
directory on which the user is working on.
syntax: pwd example:
common:
this command compares two sorted files
syntax: comm filename1 filename2 example:
pr:
the pr command does minor formating of files on the terminal screen or
for a printer.
syntax: pr option filename example:
chmod:
it is used to change or set three permission(read, write and execute) for
all the three catagories of users.
syntax: chmod catagory operation permission filename example:
cmp:
this command is used to compare files when used without options syntax:
cmp filename1 filename2
example:
dir:
it is used to seen directory syntax:
dir directory name example:
Output:
Output:
Input:
echo "while loop:" echo "until loop:" a=1
a=1 while [ $a -le until [ $a -gt 10 ]
10 ] do echo $a
do echo $a a=`expr $a + 1`
a=`expr $a + 1` done
done
Output:
expression]; then .... fi in bash shell along with a ! Operator. Let us see
various
ways to find out if a file exists or not in bash shell.
This can be done by the shell script by using test conditions. Also, if else fi statement is
used which allows us to make decisions based on the success or failure of a command:
Syntax: if [<test
Condition>] then
<set_of_commands_to_be_executed>
Fi
Input:
File exist : File read: file = File write: file = File execute: file
file = "condition.sh" "condition.sh" "condition.sh" ="condition.sh"
if [ -e $file ] if [ -r $file ] if [ -w $file ] then if [ -x $file ]
then echo "it then echo "file is write" else then
exist" else echo "file is read" echo "file is not write" echo "file is execute" else
echo "it not exist" fi else fi echo "file is not execute" fi
echo "file not read"
fi
Output:
Input:
Input:
file A is newer than file file1="a.sh" file1="a.sh" file1="a.sh" file2="b.sh"
B: file2="b.sh" if [ file2="b.sh" if [ -G $file1 ] then
file1="a.sh" $file1 -ot $file2 ] if [ -O $file1 ] echo "Access by Group"
file2="b.sh" if [ then then echo else
$file1 -nt $file2 ] echo "A Is Older Then B" "Access by echo "Not Access"
then else Owner"
echo "A Is Older Then echo "A Is Newer Then else
B" B" echo "Not Access"
else
echo "A Is Newer Then
B"
Output: