OPERATING SYSTEM FILE Notes | EduRev

: OPERATING SYSTEM FILE Notes | EduRev

 Page 1


 
OPERATING 
SYSTEM 
FILE 
 
 
 
 
 
SUBMITTED TO :-                                                                    SUBMITTED BY :- 
Mrs Mamta Juneja                                                                    Latika Dhiman  
           UE103048 
  CSE, A1, G3 
  UIET Panjab Univ. 
 
 
Page 2


 
OPERATING 
SYSTEM 
FILE 
 
 
 
 
 
SUBMITTED TO :-                                                                    SUBMITTED BY :- 
Mrs Mamta Juneja                                                                    Latika Dhiman  
           UE103048 
  CSE, A1, G3 
  UIET Panjab Univ. 
 
 
INDEX 
1  (a) Introduction to UNIX , LINUX and UBUNTU 
 (b) Installation of UBUNTU 
2 To implement unix/linux commands : 
Echo , cat , touch , man , mkdir , cd , rmdir , pwd , ls , who , whoami , wc , cal , more , less , cp , mv , 
cmp , head , tail 
3 To implement unix/linux commands : 
sort , comm. , diff , grep , whatis , whereis , gzip , gunzip , tar , zip , unzip , chmod 
4 To implement unix/linux commands : 
Tty , rm , bc , tr , cut , umask , free 
5 To implement unix/linux commands : 
Free , find , df , du , ulimit , clear , ps , shutdown , mail , finger , news 
6 To implement unix/linux commands : 
Script , split , write , wall , dd , sleep , adduser , deluser , banner, useradd , userdel, usermod 
7 To implement unix/linux commands : 
ps , & ,nohup , kill , nice , at , batch , crontab 
8 Introduction to vi Editor. 
9 Introduction to command line arguments and logical statements in 
 vi Editor. 
10 To implement the following programs in vi Editor 
1) The  length , breadth and radius of a rectangle and circle are given respectively , find the area , 
perimeter and circumference for each 
2) Find whether a given number is even or odd 
3) The cost price and selling price of an article are given .Determine the profit or loss and also find its 
value. 
4) To take the input as 2 variables and find one raise to the power other. 
11 To implement the following programs in vi Editor 
1) To find the factorial of a given number. 
2)To generate the Fibonacci series for a given number. 
3)To take as input the distance between two cities in kilometer and find the distance in feets , inches , 
meters and centimetre. 
4)To find prime numbers from 1 to 300 
12 To implement the following programs in vi Editor 
1) to enter the marks of five subjects from the student and calculate his/her percentage and grade on 
the basis of it. 
2) to take the input as the basic salary , given that DA=40% and HRA=20% , compute the gross 
salary 
3) To generate all possible combinations of 1, 2 and 3. 
4)To make a menu driven program for various commands like less , cat , pwd  etc , using switch case. 
  
13 To implement the following programs in vi Editor 
1)To check if year passed is leap year or not. and if no input is given then take year as the current 
year. 
2) To find the sum of digits of a given five digit number. 
3)To find the reverse of a given number 
4)To find maximum and minimum from a given list of numbers. 
5)To make a program for bubble sort. 
6)To make a program for binary search. 
Page 3


 
OPERATING 
SYSTEM 
FILE 
 
 
 
 
 
SUBMITTED TO :-                                                                    SUBMITTED BY :- 
Mrs Mamta Juneja                                                                    Latika Dhiman  
           UE103048 
  CSE, A1, G3 
  UIET Panjab Univ. 
 
 
INDEX 
1  (a) Introduction to UNIX , LINUX and UBUNTU 
 (b) Installation of UBUNTU 
2 To implement unix/linux commands : 
Echo , cat , touch , man , mkdir , cd , rmdir , pwd , ls , who , whoami , wc , cal , more , less , cp , mv , 
cmp , head , tail 
3 To implement unix/linux commands : 
sort , comm. , diff , grep , whatis , whereis , gzip , gunzip , tar , zip , unzip , chmod 
4 To implement unix/linux commands : 
Tty , rm , bc , tr , cut , umask , free 
5 To implement unix/linux commands : 
Free , find , df , du , ulimit , clear , ps , shutdown , mail , finger , news 
6 To implement unix/linux commands : 
Script , split , write , wall , dd , sleep , adduser , deluser , banner, useradd , userdel, usermod 
7 To implement unix/linux commands : 
ps , & ,nohup , kill , nice , at , batch , crontab 
8 Introduction to vi Editor. 
9 Introduction to command line arguments and logical statements in 
 vi Editor. 
10 To implement the following programs in vi Editor 
1) The  length , breadth and radius of a rectangle and circle are given respectively , find the area , 
perimeter and circumference for each 
2) Find whether a given number is even or odd 
3) The cost price and selling price of an article are given .Determine the profit or loss and also find its 
value. 
4) To take the input as 2 variables and find one raise to the power other. 
11 To implement the following programs in vi Editor 
1) To find the factorial of a given number. 
2)To generate the Fibonacci series for a given number. 
3)To take as input the distance between two cities in kilometer and find the distance in feets , inches , 
meters and centimetre. 
4)To find prime numbers from 1 to 300 
12 To implement the following programs in vi Editor 
1) to enter the marks of five subjects from the student and calculate his/her percentage and grade on 
the basis of it. 
2) to take the input as the basic salary , given that DA=40% and HRA=20% , compute the gross 
salary 
3) To generate all possible combinations of 1, 2 and 3. 
4)To make a menu driven program for various commands like less , cat , pwd  etc , using switch case. 
  
13 To implement the following programs in vi Editor 
1)To check if year passed is leap year or not. and if no input is given then take year as the current 
year. 
2) To find the sum of digits of a given five digit number. 
3)To find the reverse of a given number 
4)To find maximum and minimum from a given list of numbers. 
5)To make a program for bubble sort. 
6)To make a program for binary search. 
14 To implement the following programs in vi Editor: 
1)To find whether a given integer number is palindrome or not. 
2)To find whether a string is palindrome or not 
3)To calculate overtime rate of 10 employees , given that if they work for more than 40hrs/day then 
the overtime rate is Rs.12/hr 
4) To make a script for the head , tail and more commands in the vi Editor. 
15 1)To find common files in the directories entered by the user and to delete those common files. 
2)To find a given pattern in the file and to change the case of a file. 
3)To get the user to enter a string of ten characters and if 10 characters not entered then print an error 
message. 
16 To implement the following programs in vi Editor: 
1)To rename every file of directory. 
2)To generate backup of a directory. 
3)A shell script receives even number of files ,if even number of files supplied then one is copied to 
second and so on , if odd number of files supplied then print van error message. 
 
17 To implement the following programs in vi Editor: 
1)To display all files in the current directory to which you have read , write and execute permissions. 
2)Write a script that accepts any number of files as arguments , check if it is a file or directory , if 
directory then report it back and if it is a file then give the file name and the number of lines in it. 
3) Write a script that accepts any number of files as arguments , check if the files already exist then 
these files are reported back , if they do not exist then create a sub directory ‘mkdir’ and copy the file 
names into it. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Page 4


 
OPERATING 
SYSTEM 
FILE 
 
 
 
 
 
SUBMITTED TO :-                                                                    SUBMITTED BY :- 
Mrs Mamta Juneja                                                                    Latika Dhiman  
           UE103048 
  CSE, A1, G3 
  UIET Panjab Univ. 
 
 
INDEX 
1  (a) Introduction to UNIX , LINUX and UBUNTU 
 (b) Installation of UBUNTU 
2 To implement unix/linux commands : 
Echo , cat , touch , man , mkdir , cd , rmdir , pwd , ls , who , whoami , wc , cal , more , less , cp , mv , 
cmp , head , tail 
3 To implement unix/linux commands : 
sort , comm. , diff , grep , whatis , whereis , gzip , gunzip , tar , zip , unzip , chmod 
4 To implement unix/linux commands : 
Tty , rm , bc , tr , cut , umask , free 
5 To implement unix/linux commands : 
Free , find , df , du , ulimit , clear , ps , shutdown , mail , finger , news 
6 To implement unix/linux commands : 
Script , split , write , wall , dd , sleep , adduser , deluser , banner, useradd , userdel, usermod 
7 To implement unix/linux commands : 
ps , & ,nohup , kill , nice , at , batch , crontab 
8 Introduction to vi Editor. 
9 Introduction to command line arguments and logical statements in 
 vi Editor. 
10 To implement the following programs in vi Editor 
1) The  length , breadth and radius of a rectangle and circle are given respectively , find the area , 
perimeter and circumference for each 
2) Find whether a given number is even or odd 
3) The cost price and selling price of an article are given .Determine the profit or loss and also find its 
value. 
4) To take the input as 2 variables and find one raise to the power other. 
11 To implement the following programs in vi Editor 
1) To find the factorial of a given number. 
2)To generate the Fibonacci series for a given number. 
3)To take as input the distance between two cities in kilometer and find the distance in feets , inches , 
meters and centimetre. 
4)To find prime numbers from 1 to 300 
12 To implement the following programs in vi Editor 
1) to enter the marks of five subjects from the student and calculate his/her percentage and grade on 
the basis of it. 
2) to take the input as the basic salary , given that DA=40% and HRA=20% , compute the gross 
salary 
3) To generate all possible combinations of 1, 2 and 3. 
4)To make a menu driven program for various commands like less , cat , pwd  etc , using switch case. 
  
13 To implement the following programs in vi Editor 
1)To check if year passed is leap year or not. and if no input is given then take year as the current 
year. 
2) To find the sum of digits of a given five digit number. 
3)To find the reverse of a given number 
4)To find maximum and minimum from a given list of numbers. 
5)To make a program for bubble sort. 
6)To make a program for binary search. 
14 To implement the following programs in vi Editor: 
1)To find whether a given integer number is palindrome or not. 
2)To find whether a string is palindrome or not 
3)To calculate overtime rate of 10 employees , given that if they work for more than 40hrs/day then 
the overtime rate is Rs.12/hr 
4) To make a script for the head , tail and more commands in the vi Editor. 
15 1)To find common files in the directories entered by the user and to delete those common files. 
2)To find a given pattern in the file and to change the case of a file. 
3)To get the user to enter a string of ten characters and if 10 characters not entered then print an error 
message. 
16 To implement the following programs in vi Editor: 
1)To rename every file of directory. 
2)To generate backup of a directory. 
3)A shell script receives even number of files ,if even number of files supplied then one is copied to 
second and so on , if odd number of files supplied then print van error message. 
 
17 To implement the following programs in vi Editor: 
1)To display all files in the current directory to which you have read , write and execute permissions. 
2)Write a script that accepts any number of files as arguments , check if it is a file or directory , if 
directory then report it back and if it is a file then give the file name and the number of lines in it. 
3) Write a script that accepts any number of files as arguments , check if the files already exist then 
these files are reported back , if they do not exist then create a sub directory ‘mkdir’ and copy the file 
names into it. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
PRACTICAL :-1 
 
a) AIM :- Introduction to unix linux and UBUNTU. 
UNIX :- 
Unix (officially trademarked as UNIX, sometimes also written as UNIX in small caps) is 
a multitasking, multi-user computer operating system originally developed in 1969 by a group 
of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas 
McIlroy, Michael Lesk and Joe Ossanna. The Unix operating system was first developed in assembly 
language, but by 1973 had been almost entirely recoded in C, greatly facilitating its further development 
and porting to other hardware. Today's Unix system evolution is split into various branches, developed 
over time by AT&T as well as various commercial vendors, universities (such as University of California, 
Berkeley's BSD), and non-profit organizations. 
The Open Group, an industry standards consortium, owns the UNIX trademark. Only systems fully 
compliant with and certified according to the Single UNIX Specification are qualified to use the trademark; 
others might be called Unix system-like or Unix-like, although the Open Group disapproves of this term. 
However, the term Unix is often used informally to denote any operating system that closely resembles 
the trademarked system. 
Unix operating systems are widely used in servers, workstations, and mobile devices. The Unix 
environment and the client–serverprogram model were essential elements in the development of 
the Internet and the reshaping of computing as centered in networksrather than in individual computers. 
Originally, Unix was meant to be a programmer's workbench more than to be used to run application 
software. The system grew larger as the operating system started spreading in the academic circle, as 
users added their own tools to the system and shared them with colleagues.  
Both Unix and the C programming language were developed by AT&T and distributed to government and 
academic institutions, which led to both being ported to a wider variety of machine families than any other 
operating system. As a result, Unix became synonymous with open systems
 
Unix was designed to 
be portable, multi-tasking and multi-user in a time-sharing configuration. Unix systems are characterized 
by various concepts: the use of plain text for storing data; a hierarchical file system; treating devices and 
certain types of inter-process communication (IPC) as files; and the use of a large number of software 
tools, small programs that can be strung together through acommand line interpreter using pipes, as 
opposed to using a single monolithic program that includes all of the same functionality. These concepts 
are collectively known as the Unix philosophy. Kernighan and Rob Pike summarize this in The Unix 
Programming Environment as "the idea that the power of a system comes more from the relationships 
among programs than from the programs themselves." 
Under Unix, the operating system consists of many utilities along with the master control program, 
the kernel. The kernel provides services to start and stop programs, handles the file system and other 
common "low level" tasks that most programs share, and schedules access to avoid conflicts when 
programs try to access the same resource or device simultaneously. To mediate such access, the kernel 
has special rights, reflected in the division between user-space and kernel-space. 
Page 5


 
OPERATING 
SYSTEM 
FILE 
 
 
 
 
 
SUBMITTED TO :-                                                                    SUBMITTED BY :- 
Mrs Mamta Juneja                                                                    Latika Dhiman  
           UE103048 
  CSE, A1, G3 
  UIET Panjab Univ. 
 
 
INDEX 
1  (a) Introduction to UNIX , LINUX and UBUNTU 
 (b) Installation of UBUNTU 
2 To implement unix/linux commands : 
Echo , cat , touch , man , mkdir , cd , rmdir , pwd , ls , who , whoami , wc , cal , more , less , cp , mv , 
cmp , head , tail 
3 To implement unix/linux commands : 
sort , comm. , diff , grep , whatis , whereis , gzip , gunzip , tar , zip , unzip , chmod 
4 To implement unix/linux commands : 
Tty , rm , bc , tr , cut , umask , free 
5 To implement unix/linux commands : 
Free , find , df , du , ulimit , clear , ps , shutdown , mail , finger , news 
6 To implement unix/linux commands : 
Script , split , write , wall , dd , sleep , adduser , deluser , banner, useradd , userdel, usermod 
7 To implement unix/linux commands : 
ps , & ,nohup , kill , nice , at , batch , crontab 
8 Introduction to vi Editor. 
9 Introduction to command line arguments and logical statements in 
 vi Editor. 
10 To implement the following programs in vi Editor 
1) The  length , breadth and radius of a rectangle and circle are given respectively , find the area , 
perimeter and circumference for each 
2) Find whether a given number is even or odd 
3) The cost price and selling price of an article are given .Determine the profit or loss and also find its 
value. 
4) To take the input as 2 variables and find one raise to the power other. 
11 To implement the following programs in vi Editor 
1) To find the factorial of a given number. 
2)To generate the Fibonacci series for a given number. 
3)To take as input the distance between two cities in kilometer and find the distance in feets , inches , 
meters and centimetre. 
4)To find prime numbers from 1 to 300 
12 To implement the following programs in vi Editor 
1) to enter the marks of five subjects from the student and calculate his/her percentage and grade on 
the basis of it. 
2) to take the input as the basic salary , given that DA=40% and HRA=20% , compute the gross 
salary 
3) To generate all possible combinations of 1, 2 and 3. 
4)To make a menu driven program for various commands like less , cat , pwd  etc , using switch case. 
  
13 To implement the following programs in vi Editor 
1)To check if year passed is leap year or not. and if no input is given then take year as the current 
year. 
2) To find the sum of digits of a given five digit number. 
3)To find the reverse of a given number 
4)To find maximum and minimum from a given list of numbers. 
5)To make a program for bubble sort. 
6)To make a program for binary search. 
14 To implement the following programs in vi Editor: 
1)To find whether a given integer number is palindrome or not. 
2)To find whether a string is palindrome or not 
3)To calculate overtime rate of 10 employees , given that if they work for more than 40hrs/day then 
the overtime rate is Rs.12/hr 
4) To make a script for the head , tail and more commands in the vi Editor. 
15 1)To find common files in the directories entered by the user and to delete those common files. 
2)To find a given pattern in the file and to change the case of a file. 
3)To get the user to enter a string of ten characters and if 10 characters not entered then print an error 
message. 
16 To implement the following programs in vi Editor: 
1)To rename every file of directory. 
2)To generate backup of a directory. 
3)A shell script receives even number of files ,if even number of files supplied then one is copied to 
second and so on , if odd number of files supplied then print van error message. 
 
17 To implement the following programs in vi Editor: 
1)To display all files in the current directory to which you have read , write and execute permissions. 
2)Write a script that accepts any number of files as arguments , check if it is a file or directory , if 
directory then report it back and if it is a file then give the file name and the number of lines in it. 
3) Write a script that accepts any number of files as arguments , check if the files already exist then 
these files are reported back , if they do not exist then create a sub directory ‘mkdir’ and copy the file 
names into it. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
PRACTICAL :-1 
 
a) AIM :- Introduction to unix linux and UBUNTU. 
UNIX :- 
Unix (officially trademarked as UNIX, sometimes also written as UNIX in small caps) is 
a multitasking, multi-user computer operating system originally developed in 1969 by a group 
of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas 
McIlroy, Michael Lesk and Joe Ossanna. The Unix operating system was first developed in assembly 
language, but by 1973 had been almost entirely recoded in C, greatly facilitating its further development 
and porting to other hardware. Today's Unix system evolution is split into various branches, developed 
over time by AT&T as well as various commercial vendors, universities (such as University of California, 
Berkeley's BSD), and non-profit organizations. 
The Open Group, an industry standards consortium, owns the UNIX trademark. Only systems fully 
compliant with and certified according to the Single UNIX Specification are qualified to use the trademark; 
others might be called Unix system-like or Unix-like, although the Open Group disapproves of this term. 
However, the term Unix is often used informally to denote any operating system that closely resembles 
the trademarked system. 
Unix operating systems are widely used in servers, workstations, and mobile devices. The Unix 
environment and the client–serverprogram model were essential elements in the development of 
the Internet and the reshaping of computing as centered in networksrather than in individual computers. 
Originally, Unix was meant to be a programmer's workbench more than to be used to run application 
software. The system grew larger as the operating system started spreading in the academic circle, as 
users added their own tools to the system and shared them with colleagues.  
Both Unix and the C programming language were developed by AT&T and distributed to government and 
academic institutions, which led to both being ported to a wider variety of machine families than any other 
operating system. As a result, Unix became synonymous with open systems
 
Unix was designed to 
be portable, multi-tasking and multi-user in a time-sharing configuration. Unix systems are characterized 
by various concepts: the use of plain text for storing data; a hierarchical file system; treating devices and 
certain types of inter-process communication (IPC) as files; and the use of a large number of software 
tools, small programs that can be strung together through acommand line interpreter using pipes, as 
opposed to using a single monolithic program that includes all of the same functionality. These concepts 
are collectively known as the Unix philosophy. Kernighan and Rob Pike summarize this in The Unix 
Programming Environment as "the idea that the power of a system comes more from the relationships 
among programs than from the programs themselves." 
Under Unix, the operating system consists of many utilities along with the master control program, 
the kernel. The kernel provides services to start and stop programs, handles the file system and other 
common "low level" tasks that most programs share, and schedules access to avoid conflicts when 
programs try to access the same resource or device simultaneously. To mediate such access, the kernel 
has special rights, reflected in the division between user-space and kernel-space. 
The microkernel concept was introduced in an effort to reverse the trend towards larger kernels and 
return to a system in which most tasks were completed by smaller utilities. In an era when a standard 
computer consisted of a hard disk for storage and a data terminalfor input and output (I/O), the Unix file 
model worked quite well, as most I/O was linear. However, modern systems include networking and other 
new devices. As graphical user interfaces developed, the file model proved inadequate to the task of 
handling asynchronous events such as those generated by a mouse. In the 1980s, non-blocking I/O and 
the set of inter-process communication mechanisms were augmented with Unix domain sockets, shared 
memory, message queues, and semaphores. Functions such as network protocols were moved out of the 
kernel. 
Standards 
Beginning in the late 1980s, an open operating system standardization effort now known 
as POSIX provided a common baseline for all operating systems; IEEE based POSIX around the 
common structure of the major competing variants of the Unix system, publishing the first POSIX 
standard in 1988. In the early 1990s, a separate but very similar effort was started by an industry 
consortium, theCommon Open Software Environment (COSE) initiative, which eventually became 
the Single UNIX Specification administered by The Open Group. Starting in 1998, the Open Group and 
IEEE started the Austin Group, to provide a common definition of POSIX and the Single UNIX 
Specification. 
In 1999, in an effort towards compatibility, several Unix system vendors agreed on SVR4's Executable 
and Linkable Format (ELF) as the standard for binary and object code files. The common format allows 
substantial binary compatibility among Unix systems operating on the same CPU architecture. 
The Filesystem Hierarchy Standard was created to provide a reference directory layout for Unix-like 
operating systems, particularly Linux. 
Components 
The Unix system is composed of several components that are normally packaged together. By including – 
in addition to the kernel of an operating system – the development environment, libraries, documents, and 
the portable, modifiable source-code for all of these components, Unix was a self-contained software 
system. This was one of the key reasons it emerged as an important teaching and learning tool and has 
had such a broad influence. 
The inclusion of these components did not make the system large – the original V7 UNIX distribution, 
consisting of copies of all of the compiled binaries plus all of the source code and documentation 
occupied less than 10MB, and arrived on a single 9-track magnetic tape. The printed documentation, 
typeset from the on-line sources, was contained in two volumes. 
The names and filesystem locations of the Unix components have changed substantially across the 
history of the system. Nonetheless, the V7 implementation is considered by many to have the canonical 
early structure: 
? Kernel – source code in /usr/sys, composed of several sub-components: 
? conf – configuration and machine-dependent parts, including boot code 
? dev – device drivers for control of hardware (and some pseudo-hardware) 
Read More
Offer running on EduRev: Apply code STAYHOME200 to get INR 200 off on our premium plan EduRev Infinity!