Professional Documents
Culture Documents
Sr.
No. Aim Of the Practical
1 Study Practical:
A. UNIX Architecture
B. Types of OS
C. Flavors of LINUX
1. Unix Architecture
Kernel − The kernel is the heart of the operating system. It interacts with the
hardware and most of the tasks like memory management, task scheduling and file
management.
Shell − The shell is the utility that processes your requests. When you type in a
command at your terminal, the shell interprets the command and calls the program
that you want. The shell uses standard syntax for all commands. C Shell, Bourne
Shell and Korn Shell are the most famous shells which are available with most of
the Unix variants.
Commands and Utilities − There are various commands and utilities which you
can make use of in your day to day activities. cp, mv, catand grep, etc. are few
examples of commands and utilities. There are over 250 standard commands plus
numerous others provided through 3rd party software. All the commands come
along with various options.
Files and Directories − All the data of Unix is organized into files. All files are then
organized into directories. These directories are further organized into a tree-like
structure called the filesystem.
16CE068 Page 1
16CE068 CE221.01 Operating Systems JAINIL PATEL
B. Types of OS
Distributed
A distributed operating system manages a group of distinct computers and makes them appear to be a
single computer. The development of networked computers that could be linked and communicate with
each other gave rise to distributed computing. Distributed computations are carried out on more than one
machine. When computers in a group work in cooperation, they form a distributed system.[7]
Templated
In an OS, distributed and cloud computing context, templating refers to creating a single virtual machine
image as a guest operating system, then saving it as a tool for multiple running virtual machines. The
technique is used both in virtualization and cloud computing management, and is common in large server
warehouses.[8]
Embedded
Embedded operating systems are designed to be used in embedded computer systems. They are
designed to operate on small machines like PDAs with less autonomy. They are able to operate with a
limited number of resources. They are very compact and extremely efficient by design. Windows CE and
Minix 3 are some examples of embedded operating systems.
Real-time
A real-time operating system is an operating system that guarantees to process events or data by a
specific moment in time. A real-time operating system may be single- or multi-tasking, but when
multitasking, it uses specialized scheduling algorithms so that a deterministic nature of behavior is
achieved. An event-driven system switches between tasks based on their priorities or external events
while time-sharing operating systems switch tasks based on clock interrupts
16CE068 Page 2
16CE068 CE221.01 Operating Systems JAINIL PATEL
C. Flavors of LINUX:
Debian, a non-commercial distribution and one of the earliest, maintained by a volunteer developer
community with a strong commitment to free software principles and democratic project management
Knoppix, the first Live CD distribution to run completely from removable media without installation
to a hard disk, derived from Debian
Linux Mint Debian Edition (LMDE) uses Debian packages directly (rather than Ubuntu's)
Ubuntu, a desktop and server distribution derived from Debian, maintained by British
company Canonical Ltd.
Kubuntu, the KDE version of Ubuntu
Linux Mint, a distribution based on and compatible with Ubuntu. Supports multiple desktop
environments, among others GNOME Shell forkCinnamon and GNOME 2 fork MATE.
Trisquel, an Ubuntu-based distribution based on Linux-libre kernel composed entirely of free
software
Elementary OS, an Ubuntu-based distribution with strong focus on the visual experience
without sacrificing performance.
Fedora, a community distribution sponsored by American company Red Hat and the successor to the
company's previous offering, Red Hat Linux. It aims to be a technology testbed for Red Hat's
commercial Linux offering, where new open source software is prototyped, developed, and tested in
a communal setting before maturing into Red Hat Enterprise Linux.
Red Hat Enterprise Linux (RHEL), a derivative of Fedora, maintained and commercially
supported by Red Hat. It seeks to provide tested, secure, and stable Linux server and
workstation support to businesses.
CentOS, a distribution derived from the same sources used by Red Hat, maintained by a
dedicated volunteer community of developers with both 100% Red Hat-compatible versions
and an upgraded version that is not always 100% upstream compatible.
Oracle Linux, which is a derivative of Red Hat Enterprise Linux, maintained and
commercially supported by Oracle
Scientific Linux, a distribution derived from the same sources used by Red Hat, maintained
by Fermilab
Mandriva Linux was a Red Hat derivative popular in several European countries and Brazil, backed
by the French company of the same name. After the company went bankrupt, it was superseded
by OpenMandriva Lx, although a number of derivatives now have a larger user base.
Mageia, a community fork of Mandriva Linux created in 2010.
PCLinuxOS, a derivative of Mandriva, which grew from a group of packages into a community-
spawned desktop distribution
ROSA Linux, another former derivative of Mandriva, now developed independently
openSUSE, a community distribution mainly sponsored by German company SUSE.
SUSE Linux Enterprise, derived from openSUSE, maintained and commercially supported by
SUSE
Arch Linux, a rolling release distribution targeted at experienced Linux users and maintained by a
volunteer community, offers official binary packages and a wide range of unofficial user-submitted
source packages. Packages are usually defined by a single PKGBUILD text file.
Manjaro Linux, a derivative of Arch Linux that includes a graphical installer and other ease-of-use
features for less experienced Linux users. Rolling release packages from Arch repositories are
16CE068 Page 3
16CE068 CE221.01 Operating Systems JAINIL PATEL
held for further testing to achieve increased stability, and packages identified as addressing
security issues of critical or high severity are "fast-tracked" to the stable branch.
Gentoo, a distribution targeted at power users, known for its FreeBSD Ports-like automated system
for compiling applications from source code
Chrome OS, Google's commercial operating system (using Gentoo and its Portage) that primarily
runs web applications
Chromium OS, the fully open-source version of Chrome OS
Slackware, created in 1993, one of the first Linux distributions and among the earliest still
maintained, committed to remain highly Unix-like and easily modifiable by end users
Routers – for example, targeted by the tiny embedded router distribution OpenWrt
Internet of things – for example, targeted by Ubuntu Core
Home theater PCs – for example, targeted by KnoppMyth, Kodi (former XBMC) and Mythbuntu
Specific platforms – for example, Raspbian targets the Raspberry Pi platform
Education – examples are Edubuntu and Karoshi, server systems based on PCLinuxOS
Scientific computer servers and workstations – for example, targeted by Scientific Linux
Digital audio workstations for music production – for example, targeted by Ubuntu Studio
Computer Security, digital forensics and penetration testing – examples are Kali Linux and Parrot
Security OS
Privacy and anonymity – for example, targeted by Tails
Offline use – for example, Endless OS
CONCLUSION:
Here we studied about the structure of linux and also some examples
16CE068 Page 4
16CE068 CE221.01 Operating Systems JAINIL PATEL
2 Study of Unix Architecture and the following Unix commands with option:
User Access: login, logout, passwd, exit
File Handling / Text Processing: cp, mv, rm, sort, cat, pg, lp, pr, file, find, more, cmp,
diff, comm, head, tail, cut, grep, touch, tr, uniq
Information: learn, man, who, date, cal, tty, calendar, time, bc,
whoami, which, hostname, history, wc
System Administrator: su or root, date, fsck, init 2, wall, shut down, mkfs,
mount, unmount, dump, restor, tar, adduser, rmuser
1.
2. User Access
//Here Sudo is for superuser access
1)sudo login-----login to a different user in the terminal
16CE068 Page 5
16CE068 CE221.01 Operating Systems JAINIL PATEL
exit ------logout the user in the terminal which is logged in by login command same as logout
2.Help
man-----gives the manual page of command that is typed after it
Eg. man login
16CE068 Page 6
16CE068 CE221.01 Operating Systems JAINIL PATEL
help-----when written in the form help (command) it gives info about the specific command
3. Directory
mkdir-----used to create a folder
Eg. mkdir samplefolder
16CE068 Page 7
16CE068 CE221.01 Operating Systems JAINIL PATEL
4. Editor
vi----- a programmer’s text editor
16CE068 Page 8
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 9
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 10
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 11
16CE068 CE221.01 Operating Systems JAINIL PATEL
5.
File Handling and Text Processing
cp-----it is used to copy a file or a folder
cp source_filename destination_directory
16CE068 Page 12
16CE068 CE221.01 Operating Systems JAINIL PATEL
*original file
*sort sample
*sample1 file
16CE068 Page 13
16CE068 CE221.01 Operating Systems JAINIL PATEL
*lp sample
*pr sample
*file sample
*find sample
*more sample
16CE068 Page 14
16CE068 CE221.01 Operating Systems JAINIL PATEL
cut----- displays the bytes at specific positions from every line in a file
*cut -b 1 sample
the reason on this output is that h is first byte in first line , m is first byte in second line, I is first byte in third
line
16CE068 Page 15
16CE068 CE221.01 Operating Systems JAINIL PATEL
*grep is sample
16CE068 Page 16
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 17
16CE068 CE221.01 Operating Systems JAINIL PATEL
tty ----- print the file name of the terminal connected to standard input
16CE068 Page 18
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 19
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 20
16CE068 CE221.01 Operating Systems JAINIL PATEL
wc ----- print newline, word, and byte counts for each file
*wc sample
16CE068 Page 21
16CE068 CE221.01 Operating Systems JAINIL PATEL
2 Multi-User Mode Does not configure network interfaces and does not
export networks services
16CE068 Page 22
16CE068 CE221.01 Operating Systems JAINIL PATEL
16CE068 Page 23
16CE068 CE221.01 Operating Systems JAINIL PATEL
10.Terminal
Echo-----used to print a message
16CE068 Page 24
16CE068 CE221.01 Operating Systems JAINIL PATEL
Printf----- format and print data (mostly used in scripting with variables)
11.I/O Redirection
16CE068 Page 25
16CE068 CE221.01 Operating Systems JAINIL PATEL
To send the output produced by the who command to the file called wholist:
To run the program myprog taking input from the file called data and sending the output to the file
called results :
CONCLUSION
3 1. Write a shell script which calculates nth Fibonacci number where n will be provided as input when
prompted.
Solution:
16CE068 Page 26
16CE068 CE221.01 Operating Systems JAINIL PATEL
read n
a=0
b=1
echo -n $a $b
for(( i=2;i<$n;i++ ))
do
c=$(( $a + $b ))
a=$b
b=$c
done
2. Write a shell script which takes one number from user and finds factorial of a given number.
Solution:
echo -n "enter number::"
16CE068 Page 27
16CE068 CE221.01 Operating Systems JAINIL PATEL
read no1
fact=1
for(( i=1;i<=$no1;i++ ))
do
fact=$(( $fact * $i ))
done
echo "Factorial is "$fact
Output:
3. Write a shell script to sort the number in ascending order. (Using array).
16CE068 Page 28
16CE068 CE221.01 Operating Systems JAINIL PATEL
Output:
CONCLUSION
4 1. Write a shell script which will take a file name from the user and finds that whether the file is there or not
in a current working directory and displays the appropriate message.
Solution:
echo -n "Enter file name "
16CE068 Page 29
16CE068 CE221.01 Operating Systems JAINIL PATEL
read filename
f=0
for i in $(ls)
do
if [ $i = $filename ]
then
f=1
break
fi
done
if [ $f -eq 1 ]
then echo "file found"
else echo "Not Found"
fi
Output:
2. Write a shell script which compares two files given by the user and if both files are same then
delete the second one, if not then merge the two files in a new file.
Solution:
16CE068 Page 30
16CE068 CE221.01 Operating Systems JAINIL PATEL
if [ $# -eq 2 ]
then
file1=$1
file2=$2
else
read file1
read file2
fi
f1=0
f2=0
for i in $(ls)
do
if [ $file1 = $i ]
then
f1=1
fi
if [ $file2 = $i ]
then
f2=1
16CE068 Page 31
16CE068 CE221.01 Operating Systems JAINIL PATEL
fi
done
if [ $f3 -eq 2 ]
then
if [ $? -eq 0 ]
then
rm $file2
else
fi
else
fi
Output:
16CE068 Page 32