Sei sulla pagina 1di 37

UNIX

What is an operating system?

• It is a control program for a computer


– Acts as an interface to the hardware- make
efficient use of the hardware.
– Allocates computer resources and
schedules tasks.
– Helps create and manage your file system.
UNIX Operating System
UNICS

Uniplexed Information and Computing Systems

UNIX
• The first Unix OS was developed by Ken
Thompson and Dennis Ritchie at Bell
Laboratories in 1969.
• 1971 – first edition

• Since then the Unix system has evolved


through constant upgradtions and
enhancements to become the most popular
operating environment after MSDOS
• Much of the subsequent development
occurred at the University of California at
Berkeley
– BSD – Berkeley Software Distribution

• UNIX is now a family of operating systems:


– AIX from IBM
– HP-UX from Hewlett-Packard
– GNU Linux from Free Software Foundation
– Solaris, SunOS from Sun Microsystems
Unix Features
• Portability

About 95% of the OS is written in C


programming language. Therefore, it can be
easily ported to other machines.

Unix run on many machines including micro


computers, mini computers, mainframes and
super computers.
• Multi tasking operating system

Unix system can run more than one program


at a time. This feature of the OS permits a
user to perform less urgent jobs in the
background, while doing more important
ones in the foreground.
• Multi user operating system

Unix system can support more than one user


at a time, each concurrently running a
different set of programs.

The system resources are shared based on


the concept of time sharing, with each user
allotted a time slice without him/her being
aware of it. In fact it will appear to the user
that the system is completely dedicated to
him/her.
The cost such a system is less because one
person cannot generally use all of the
resources a computer has to offer.
• Hierarchical file structure

The file structure resembles an inverted tree.


All directories branch from the root directory
with each containing one or more files.

Each user has one primary directory and as


many subdirectories as required.
Unix Software Components
User

Shell
Kernel

H/W

Shell Shell
User User
• Utilities

The Unix system include a family of several


hundred built-in commands called utilities or
tools. These utilities perform functions that
are universally required by users.

Examples:
Text editing, spell checking, mathematical
calculations, printing etc.
• Shell

Shell is a command processor.

A program that reads and interprets the


commands you enter and and passes them to
the kernel for processing. Therefore, the shell
acts as an interface between the user and the
Kernel insulating the user from the knowledge
of the Kernel.
There are three popular shells in use today:

Bourne shell (sh)


Korn shell (ksh)
C shell (csh)
• Kernel

The core of the Unix system is called the


Kernel. It is a collection of programs mostly
written in C.
 There is only one Kernel for any system

 It communicates directly with the system


hardware.

 Co-ordinates many functions –allocates memory


and other system resources to the processes
going on at any given time

 Decides process priorities

 Keeps track of the contents and locations of all the


files in the file systems.
Once the shell has translated the user
commands into instructions, it is the kernel
that carries out these instructions.
• Shell prompt
An indication from the shell that it is ready to
receive the next command from the
command line.

C-shell: % (percentage sign)


Bourne /Korn shell: $ (dollar sign)
Files and Directories
Within Unix, a file is any source from which
data can be read, or any target to which data
can be written. Therefore, a file refers to a
repository of data like a disk file or to a
physical device. (example: keyboard –source
of I/P, display –O/P target, printers - O/P
target)
Note:

Unix makes very little distinction between the


various types of files. Therefore, the printer
or tape drive is treated as a file in much the
same way as a disk file.

Unix has 3 types of files:

Ordinary files.
Directory files.
Device files.
Ordinary file (Regular file)

This is the traditional definition of a file.


Ordinary files contain data and are stored on
disk or tape. These are the files you will be
working with most of the time.
Directory File

A directory is stored on disk and contains no


data, but keeps an account of all the files and
sub directories that it contains.

a directory file contains 2 fields:


Name of the files
Pointer to separate disk area which
contains the file attributes (creator, read-
only flags etc)
Device files

A device file is an internal


representation of a physical device
(example: printer, hard disk, terminal).
Ie. all the devices on your system can
be accessed as files.
There are two types of users:
 Ordinary users
 Root (super user/system administrator)

Root
Root is the administrative user account
created during installation and has
complete access to the system.
Home Directory

When you log in to a system, Unix


automatically places you in a directory called
the home directory.
File structure
File names:

No two files in the same directory can have


the same name.
Files in different directories can have the
same name.
File names can have:
Uppercase letters, lower case letters,
numbers , underscore, period.

A file name can contain up to 256 characters


File name extension

A file can have any number of extensions.


Therefore, you can use extensions freely to
make the file names easy to understand.

Example:
note.4.05.2005
Invisible file names

A file name beginning with a period is called


an invisible file name. ls does not normally
display invisible files.
/

bin dev usr etc

<file 1> <file 2>

Nimal Sunil …….


• /bin - Contains the standard Unix utilities.

• /dev – All files that represent peripheral


devices such as printers, terminals etc are
stored in this directory.

• /etc – Contains system administration and


configuration commands.

• /etc/passwd – The list of all the users who


have permission to use the system are stored
in this file.
Example:
To send data to the screen of another
user’s terminal, all you have to do is
write data to the file that represents
that device.
The file system in Unix is a collection of all
these files organized in a hierarchical (an
inverted tree) structure.