You are on page 1of 54

NAME: HITANSHU RAJA OZA

ROLL NO: 13

CLASS: SE IT2

BATCH: B3

EXPERIMENT NO - 1

Aim: To understand architecture, functioning and installation of Unix Operating System.

a) To understand architecture & functioning of Unix. (Case study on Unix)

UNIX:

Unix is a family of multitasking, multiuser computer operating systems that derive from the


original AT&T Unix, development starting in the 1970s at the Bell Labs research center by Ken
Thompson, Dennis Ritchie, and others.

Initially intended for use inside the Bell System, AT&T licensed Unix to outside parties in the
late 1970s, leading to a variety of both academic and commercial Unix variants from vendors
including University of California, Berkeley (BSD), Microsoft (Xenix), Sun
Microsystems (SunOS/Solaris), HP/HPE (HP-UX), and IBM (AIX). In the early 1990s, AT&T
sold its rights in Unix to Novell, which then sold its Unix business to the Santa Cruz
Operation (SCO) in 1995 the UNIX trademark passed to The Open Group, an industry
consortium founded in 1996, which allows the use of the mark for certified operating systems
that comply with the Single UNIX Specification (SUS). However, Novell continues to own the
Unix copyrights, which the SCO Group, Inc. v. Novell, Inc. court case (2010) confirmed.

Unix systems are characterized by a modular design that is sometimes called the "Unix
philosophy". According to this philosophy, the operating system should provide a set of simple
tools, each of which performs a limited, well-defined function. A unified filesystem (the Unix
filesystem) and an inter-process communication mechanism known as "pipes" serve as the main
means of communication, and a shell scripting and command language (the Unix shell) is used to
combine the tools to perform complex workflows.
Unix distinguishes itself from its predecessors as the first portable operating system: almost the
entire operating system is written in the C programming language, which allows Unix to operate
on numerous platforms.

FEATURES

Some key features of the Unix architecture concept are:

● Unix systems use a centralized operating system kernel which manages system and process
activities.
● All non-kernel software is organized into separate, kernel-managed processes.
● Unix systems are pre-emptively multitasking: multiple processes can run at the same time, or
within small time slices and nearly at the same time, and any process can be interrupted and
moved out of execution by the kernel. This is known as thread management.
● Files are stored on disk in a hierarchical file system, with a single top location throughout the
system (root, or "/"), with both files and directories, subdirectories, sub-subdirectories, and
so on below it.
● With few exceptions, devices and some types of communications between processes are
managed and visible as files or pseudo-files within the file system hierarchy. This is known
as everything is a file. However, Linus Torvalds states that this is inaccurate and may be
better rephrased as "everything is a stream of bytes".

The UNIX operating system supports the following features and capabilities:

● Multitasking and multiuser


● Programming interface
● Use of files as abstractions of devices and other objects
● Built-in networking (TCP/IP is standard)
● Persistent system service processes called "daemons" and managed by init or inet
HISTORY OF UNIX

The history of Unix dates back to the mid-1960s when the Massachusetts Institute of


Technology, AT&T Bell Labs, and General Electric were jointly developing an
experimental time-sharing operating system called Multics for the GE-645 mainframe.Multics
introduced many innovations, but had many problems.

Bell Labs, frustrated by the size and complexity of Multics but not the aims, slowly pulled out of
the project. Their last researchers to leave Multics – Ken Thompson, Dennis Ritchie, Doug
McIlroy, and Joe Ossanna among others – decided to redo the work on a much smaller scale. In
1979, Dennis Ritchie described their vision for Unix.

UNIX ARCHITECTURE

A Unix architecture is a computer operating system architecture that embodies the Unix


philosophy. It may adhere to standards such as the Single UNIX Specification (SUS) or
similar POSIX IEEE standard. No single published standard describes all Unix architecture
computer operating systems - this is in part a legacy of the Unix wars.

Here is a basic block diagram of a Unix system –


Figure 1: Bloch diagram of Unix

The main concept that unites all the versions of Unix is the following four basics −

● 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.

A Unix kernel — the core or key components of the operating system — consists of
many kernel subsystems like process management, scheduling, file management, device
management, network management, memory management, and dealing with interrupts
from hardware devices.

Each of the subsystems has some features:

● Concurrency: As Unix is a multiprocessing OS, many processes run concurrently to


improve the performance of the system.
● Virtual memory (VM): Memory management subsystem implements the virtual
memory concept and users need not worry about the executable program size and
the RAM size.
● Paging: It is a technique to minimize the internal as well as the external
fragmentation in the physical memory.
● Virtual file system (VFS): A VFS is a file system used to help the user to hide the
different file systems complexities. A user can use the same standard file system
related calls to access different file systems.

The kernel provides these and other basic services: interrupt and trap handling, separation
between user and system space, system calls, scheduling, timer and clock handling, file
descriptor 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, cat and 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.
(B). INSTALLATION OF UNIX OPERATING SYSTEM
1. Download and install Virtual Box.

1)Installing VirtualBox.exe.
2)Setup VirtualBox in the required location
3)Select all options and Click on Next.
4)Click on install.
5)VirtualBox is now installing.
2. Download iso file of ubuntu
3. Installation of Ubuntu on Virtual Box
1) Open Virtual Box.

2) Click on New and select Version as Ubuntu


3)Select Memory (RAM) as 2048 MB.

4)Select option of a virtual hard disk


5)Select VirtualBox Disk Image(VDI) as hard disk type.

6)Select Dynamic allocated storage on physical hard disk.


7)Select size of virtual hard disk as 21GB after saving it in the respective folder.

8)Ubuntu is added into VirtualBox, now we need to install it.


9)Click on Start and then click on Install Ubuntu.
10)Select appropriate Layout and click on Continue.
11)Select the pre selected options and click Continue.
12)Installation type must be “Erase disk and install Ubuntu” and click Install Now.
13)Click on Continue.

14)Select “India Time” for further installation.


15)Enter your credentials and click Continue.
16)Ubuntu is now installing its requirements and packages.
17)When installation of an OS is completed it asks for restart, hence click on Restart Now.
18)After installing you need to login, Click on your name.
19)Enter your password to login successfully.
20)Ubuntu is up and running.

Conclusion: Hence we have successfully created case study for UNIX and Installation of UNIX
operating system
NAME: HITANSHU RAJA OZA

ROLL NO: 13

CLASS: SE IT2

BATCH: B3

EXPERIMENT NO - 2

AIM: To learn and execute Unix general purpose commands

COMMANDS:

date: date command prints the date and time.


clear: This command clears your screen.

cal: The cal command is used to display the calendar.


uptime: The uptime command tells us how long the system has been running.

w: The w command is a quick way to see who is logged on and what they are doing.

whoami: The whoami command is used to print the current user’s login name.

uname: This command prints the name of the current OS.


whereis: The whereis command is used to search and locate source or files in the system. The command
will return the path where the files are located. Following eg searches and returns the path where Mozilla
is located.

which: The which command is used to show the full path of the given executable command. Following
eg displays the location of the executable command killall.

man: The man command provides in depth information about the requested command or allows users to
search for commands related to a particular keyword. The following eg displays all information about
which command.
pwd: This command displays the current working directory.

ls: This command is used to list the details about files and directories.
history: This command will return the full history of the terminal.

echo: The echo command will return the same words as specified.

id: The id command is used to find out user id and group id of the current user or any other user.
ping: The ping command sends requests packets to the network host and reports on the response from the
remote server.

exit: It will close the terminal.

CONCLUSION: Hence, we have successfully implemented Unix general purpose commands.


NAME: HITANSHU RAJA OZA

ROLL NO: 13

CLASS: SE IT2

BATCH: B3

EXPERIMENT NO - 3

3A)
AIM: Study of File manipulating commands and network commands.

A)FILE MANIPULATION COMMANDS


THEORY:
1)ls: Lists the names of files in a particular Unix directory.
2)wc: The wc command in UNIX is a command line utility for printing newline, word and byte counts for
files.
3)touch: The touch command is used to create files and modify them.
4)cat: Used to read files, write over the files.
5)cp: cp stands for copy. This command is used to copy files or group of files or directory.
6)mv: Used to move files from one directory to others.
7)rm: This command is used to remove files and directories.

OUTPUT:

1. ls:

2. wc:

3. touch:
4. cat:

5. cp:

6. mv:

7. rm:
B)NETWORKING COMMANDS

THEORY:
1)ipconfig: “ifconfig in unix”This command displays all TCP/IP network configuration values and
refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings.
2)netstat: : The netstat command displays network status and protocol statistics. It is a networking tool
used for troubleshooting and configuration that can also serve as a monitoring tool for connections over
the network.
3)ping: Tests the ability of the source component to reach the specified destination component.
4)nslookup: The nslookup command queries internet domain name servers in two modes. Interactive
mode allows you to query name servers for information about various hosts and domains, or to print a list
of the hosts in a domain. In noninteractive mode, the names and requested information are printed for a
specified host or domain.
5)nmap: Nmap is Linux command-line tool for network exploration and security auditing

OUTPUT:

1. ipconfig:
2. netstat:
3. ping:

4. nslookup:
5. nmap:

CONCLUSION: Hence we studied about file manipulating and networking commands in Unix.
3B)
AIM: Study of UNIX file system (TREE STRUCTURE).

THEORY: File system in Unix is a logical method of organizing and storing large amounts of
information in a way that makes it easy to manage. Files are organized into directories and these
directories are organized into a tree-like structure called file system. At the very top of the file system is
the root directory represented by “/”.

Directories and its description:

1. /: Denotes root of the file system.

2. /bin: Stands for ‘binaries’. This is where the executable files are located. These files are available to all
users

3. /dev: Stands for ‘devices’. These are device drivers.

4. /etc: Supervisor directory commands, configuration files, disk configuration files, valid user lists,
groups, ethernet, hosts, where to send critical messages

5. /lib: Contains shared library files and sometimes other kernel-related files

6. /home: Contains the home directory for users and other accounts

7. /mnt: Used to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive
and floppy diskette drive, respectively

8. /proc: Contains all processes marked as a file by process number or other information that is dynamic
to the system
9. /sbin: Contains binary (executable) files, usually for system administration. For example, fdisk and
ifconfig utilities

10. /tmp: Holds temporary files used between system boots.

11. /usr: Used for miscellaneous purposes, and can be used by many users. Includes administrative
commands, shared files, library files, and others.

12. /usr/bin: This directory stores all binary programs distributed with the operating system not residing
in /bin, /sbin or (rarely) /etc.

CONCLUSION: Hence we studied the unix file system(tree structure).


3C)
AIM: Study of .bashrc/etc and Environment variables.

THEORY: An environment variable is a value that can affect the way running process will behave on a
computer. They help programs know what directory to install files in, where to store temporary files etc.
Eg of ENVs in Unix:
$USER: Gives the current user name
$PATH: Gives path of directories for commands
$PWD: Displays path of current working directory
$HOME: Gives path of home directory
$HOSTNAME: Displays the user(host) name.
$LANG: Displays the system’s language
$EDITOR: Gives the default file editor
$UID: Displays ID of the current user
$SHELL: Displays path of user’s shell program

OUTPUT:

CONCLUSION: Hence we studied about .bashrc/etc and environment variables.


3D)
AIM: Study file and directory permissions.

THEORY: Every file and directory on your Unix system is assigned to user owner, group or others.
File Permissions: Basic unix file permissions are Read, Write and Execute.
Read(r): Used to view contents of a file.
Write(w): Used to modify or remove contents of a file.
Execute(x): User with permission can run a file.
Directory Permissions: They are the same as file permissions except for a few differences.
Read: Users can read the contents. Users can look at the filenames inside the directory.
Write: Users can add or delete files from the directory.
Execute: A user must have execute access to the bin directory in order to execute the ls or the cd
command.

OUTPUT:

CONCLUSION: Hence we studied about file and directory permissions in Unix.


EXPERIMENT NO - 4

AIM: Study of Vi Editor

THEORY: vi editor is the default editor in Unix OS. We can create a new file or edit an existing file
using vi editor.
vi filename: Creates a new file if it doesnt exist, otherwise opens an existing file.
Command Mode: It is used to perform administrative tasks such as saving files, executing commands,
moving the cursor etc. To enter command mode, enter ‘Esc’ key.
Insert Mode: Used to insert text into the file. Everything that's typed in this mode is interpreted as input
and placed in the file.
vi always starts in command mode.
To exit vi editor, go to command mode and type “:wq”.This will save the content and exit the editor. “:w”
saves the content written in the file and “:q” is used to quit the editor.

OUTPUT:
1) hello world:
2) calculator:
3) even or odd:

CONCLUSION: Hence we implemented shell script programs for displaying hello world, to perform
basic calculator operations, to check if a number is even or odd using vi editor.
EXPERIMENT NO - 5

5A)
AIM: SHELL SCRIPT PROGRAM TO CHECK WHETHER GIVEN FILE IS A DIRECTORY OR
NOT.

THEORY: vi editor is used to write the script program. ‘#!/bin/bash’ will execute the program in bash
and not some other shell. ‘fi’ is used to close the if statement.

OUTPUT:
CONCLUSION: Hence we wrote a shell script program which checks if a given file is a directory or not.
5B)
AIM: SHELL SCRIPT TO COUNT NO OF FILES IN A DIRECTORY

THEORY: The easiest way to count files in a directory on Linux is to use the “ls” command and pipe it
with the “wc -l” command.
$ ls | wc -l
$ ls /filename |wc -l
In order to count files recursively on Linux, you have to use the “find” command and pipe it with the
“wc” command in order to count the number of files.
$ find <directory> -type f | wc -l

OUTPUT:

CONCLUSION: Hence we wrote a shell script program to count the number of files and directories.
5C)
AIM: Write a program using sed command

THEORY: ‘sed’ command stands for stream editor. It can be used on files to perform functions like
searching, find and replace, insertion etc. Most common use of ‘sed’ command is for substitution or for
find and replace. It also supports regular expression which allows it for pattern matching.

For substitution:
$sed ‘s/a/b/’ filename
Here: ‘s’ specifies substitution operation, ‘a’ is the word in file that is to be substituted, ‘b’ is the word
which substitutes ‘a’

OUTPUT:
i. to substitute /replace a string.

ii. replacing the nth occurance of a pattern in a line.

iii. parenthesize first character of each word


iv.replacing string on a specific no of line.

v. duplicating the replaced line with /p flag.

CONCLUSION: Hence we performed different programs with the help of ‘sed’ commands.

You might also like