You are on page 1of 19

1

Unix Operating System


Operating System:-
An operating system is a collection of programs that coordinates
the operation of computer hardware and software and manages the resources of the
computer system.
The operating system is basically designed as an interface between
the user and a computer so that the user can make optimum use of the computer. It is an
assortment of different types of programs and utilities.
The operating system are categorized into two types. They are
1.Single user operating system
2.Multi user operating system

In the single user operating system only one user can access the
system and system’s resources at a time.
Ex: DOS
In the multi user operating system multiple users can access the
system and system’s resources at a time.
Ex: WINDOWS, UNIX etc.

The example of the multi user operating system is UNIX.


UNIX operating system is a multi-user and multi-tasking operating system.

1
2

History of the UNIX operating system:-

The UNIX operating system was first developed in the late 1960’s
at AT & T Bell Laboratories. The code for the same was originally written in the
Assembly language on the PDP-7 and was consequently machine dependent.
The second version of UNIX was moved to a more advanced
PDP-II computer. For an operating system to prosper it had to be portable and had to
work efficiently on diverse hardware platforms. For the same reasons, the whole UNIX
kernel was recorded in the C language by Dennis Ritchie at the Bell Laboratories in 1973.
Further research on UNIX was conducted by the University of
California at Berkeley and a version called the BSD(Berkeley Software Division) version
of UNIX was released by 1960 UNIX could virtually be ported onto any computer with
power to support it.
In the mid-eighties a corporation called Santa Cruz Operation Inc.
took the lead in developing a version of UNIX for the Intel 80286/80386 family. Today
you can buy versions of UNIX for all the computers ranging from the largest super
computers to the present day micro computers.

Hardware Requirements:-

Every computer has to fulfill certain pre-requisites in terms of


power, memory size and disk space to successfully run the UNIX operating system. A
computer with a 32-bit microprocessor, 3MB of RAM and a hard disk space of about
80MB would give an optimum performance.
Apart from the hardware mentioned above, every UNIX
installation requires a human manager known as the system administrator, who controls
and supervises the UNIX installation.

Features of UNIX Operating Systems:-

The UNIX Operating System offers many salient features . The


important of them are

1.Multi Tasking Capability:-


This capability allows the operating system to perform several
tasks simultaneously. For instance, UNIX can print one document, edit another and sort a
list of files at the same time. Multiple tasks can be carried out by placing other tasks in
the background while the current task done will be in the foreground.
Normally the tasks which do not require interaction from the user
are placed in the background. The more tasks you have running in the background, the
slower will be the system response.
In this environment each operator may perform a different set of
operations on the centralized data. For instance, the operator at counter-1 may work on
reallocation of cancelled seats and the operator in the counter-2 may answer queries on

2
3

the status of reservations. This kind of situation where many tasks are processed by the
processor at the same time is known as multi tasking environment.

2.Multi-user Capability:-

A Multi-user operating system permits several users to use the


same computer to carry out their jobs. Several terminals are connected to a single
powerful computer and each user of the terminal can run programs, access files and print
document at the same time. Need for a multi-user environment arises when several
programmers work on developing modules of the same software. Multi-user environment
ensures complete co-ordination and compatibility and saves a considerable amount of
time by allowing several users on a set of information at a time. Buying a single multi-
user computer is far more economical and efficient than buying several user computers.

3.Portability:-

The UNIX system has been made portable for almost every size of
computer everbuilt. UNIX system can now be used even on powerful micro computers.
The UNIX system provides the environment that allows for easy portability of
applications between micro computers and main frames. Portability has 3 aspects.
1. The system itself can be easily installed on different machines totally varying
architectures. This is possible as almost 90% of UNIX system is written in
machine independent C language and about 10% is written in machine
dependent assembly language.
2. Data on one system can be transferred to another.
3. Application programs written for one system work on another system with
little or no modifications.

4.Communications:-

UNIX supports two major types of communications


1. Communication between different terminals connected to the same computer.
2. Communication between users of one computer at a specific location to the
users of another type and size of a computer located elsewhere. The two
computers may be located in different offices or different countries or
continents. This type of communication is achieved by a mail system based on
wide area networks which span across continents and may be connected
through telephone lines or satellites.

5.Security:-

The users data is highly secure in the UNIX operating system than
that in any operating system. There are several levels of security in UNIX. The first level
is system security. The standard login procedure before UNIX starts running on the
system ensures that not just anybody can start running UNIX on your system.

3
4

The next level of security is incorporated when it comes to


accessing files. Three permissions namely read, write and execute can be assigned by the
owner of a file to each of his files. All these permissions can be individually conceded or
denied to all other users of the system.
The third level of security allows users to encrypt data files on the
disk so that even if someone does manage to access them they cannot make much sense
of it.

6.Tree structure file system:-

UNIX organizes the file system in a hierarchy by which any file in


the system can be specified by a single consistent name format. Peripheral devices such
as terminals, tape drivers, printers, and disk drives outside the system are represented by
files that are used in the fashion as regular disk files. UNIX file system starts at root(/)
and is expanded in a hierarchy manner just as tree.

7.Time sharing operating system:-

Time sharing is the concurrent use of single computer system by


many independent users. Each user having his or her own programs, each expecting fast
response and each operating independently without an awareness of the use of the facility
by others. It can maximize the use of system resources. Time sharing adds the notion of
servicing all programs frequently, so that the user doesn’t become discouraged with the
waiting time.

8.Tools and Utilities:-

The UNIX system introduced new idea in computing that


problems can be solved and applications can be created by interconnecting a few simple
parts. Large applications can be built from simple sequences of commands. It has many
built in commands and packages which you can use to do different types of tasks and
creating new executable programs. The commands that are provided by the UNIX system
are all external commands.

Structure of UNIX system:-

Unix operating system has the following structure.

4
5

Other application programs


commands
kernal

hardware

The kernal is the UNIX operating system. It is the master program


that controls the computer’s resources allocating them to different users and to different
tasks. When you login, it is the kernal that runs your initialization and get to check
whether you are an authorized user and have correct password. The kernal keeps track of
all the various programs being run, allotting time to each deciding when one stops and
another starts. The kernal assigns storage for our files. The kernal runs the shell
programs. The handles the transfer of information between the computer terminals, tape
drives and printers. In other words, the kernal is the heart of the UNIX operating system.

The shell is a mediator between the user and the UNIX system. It is
also called as the command interpretor. It accepts commands from the user and executes
it and gives the result to the user. UNIX provides different number of shells. The shells
provided by the UNIX are

1. Bourne shell (or) Standard shell($)


2. C shell(%)
3. Korn Shell($)
4. Sco shell

Procedure to login to UNIX:-

The first step in using UNIX is always login to the computer.


Logging in means identifying yourself to the computer which gives you access to your
home directory, where you can execute UNIX commands and create, store and edit files.
To do this you need a user or login name and a password which you should obtain from
the system administrator.

Login:-

5
6

When your terminal or personal computer are turned on, you can
see a login prompt in the following manner.

Login:

Once you see the prompt, type your user or login name exactly as
well as been assigned to you by the system administrator, matching upper and lower case
letters. Since UNIX is case sensitive, the login name TTYP0 is different from ttyp0 or
Ttyp0.

Password:-

To keep unauthorised people away from UNIX account, you are required
to enter a password before you login to your account. You can login after entering
your login name and pressing return, you will see the password prompt as follows

Password:

Now type your password again exactly as well as it has been assigned to
you so that the password cann’t be read by other users, since it doesn’t appear on the
screen as you typed it. Some accounts, usually public accounts to be used by the
number of users doesn’t need password. If your account is public, you will not see
the password prompt and can ignore the instructions regarding passwords. If you
have typed both login and password correctly, you will be logged into your account.

UNIX Directory Structure:-

The UNIX file system consists of the hierarchial structure of both


files and directories. This file system is just like an inverted tree. At the top of the
structure, it is a single directory called root directory. All other directories in the file
system branch out from the root directory. At the bottom of the structure there are some
files some of them which are used by UNIX to setup the operating system, executable
commands and some of which are created by the users of the system. The following
format shows the structure of the UNIX file system.

Root Directory(/)

USR BIN TMP DEV ETC

6
7

The usr directoryconsists of the home directories of all the users


which contains several subdirectories and files. When the administrator creates an user it
automatically creates a sub directory in the usr directory.

The bin directory consists of all the executable files related to the
UNIX commands. By default all the commands which you can use in the UNIX
environment are external commands. There must be an executable file for each command.

The tmp directory consists of all the temporary files to work with
UNIX environment.

The dev directory consists of all the device drivers files which will
be used to control different types of devices, terminals etc.

The etc directory consists of all files related to the passwords of the
users.

Security in UNIX file system:-

Ownership and permissions:-

The owner of a file or directory is usually the person who has


created the file or directory originally. In UNIX system it is not possible for the creator of
the file to transfer to someone else. The owner of a file can assign various permissions
allowing access to that directory or a file. For every file and every directory in the file
system, there are three classes of users may have the access.

1.Owner:-
The owner is the user who has initially created the file.

2.Group:-

Many users might be working on a single big project and related to


a group. Unix recognises group of users and accordingly there is a group ownership
associated with each file and directory.

3.Others:-

All other users of the UNIX system other than the owner and the
group people are called as others.

1.Read Permission:-

A user who has read permission for a file can look at the contents
of the file. A user who has read permission for a directory can find out what files are

7
8

there in the directory. To read the directory the user must have the execute permission.
Whether the user can see the contents of the file in the directory depends on the read
permission for the files themselves in addition to the read and execute permission for the
directory.

2.Write Permission:-

A user who has write permission for a file can change the contents
of that file. A user who has write permission for a directory can change the contents of
the directory. You can create new files and remove existing files. Whether you can
change the contents of existing file in the directory depends on the write permission for
the files themselves.

3.Execute Permission:-

A user who has execute permission for a file can use the filename
as a UNIX system command. A user who has execute permission for a directory can
change to that directory and can copy the files from that directory provided you can also
have the read permission for that directory.

Changing permissions:-

The command “chmod” changes the mode of a file or directory.


The mode can only be changed by the owner or by the super user. Each file has some
kind of permissions. If you type ls –l, it displays the first column in the following manner.

drw-rw-rw-

These 10 letters word denote the permissions. The first letter tells
about the nature of the file. If it is ‘d’ it is actually a directory. If it is ‘-‘, it is an ordinary
file. The rest of the 9 letters can be split into words of 3 letters each. The first three letters
tells you about the owner’s permissions, the second about the group permissions and the
third about the others permissions. It consists of letters “rwx” in that order some of them
being replaced by ‘-‘. If r is present, then one can read the file. A ’-‘ in its place indicates
that reading permission is denied. A ‘w’ denotes writing permission and ‘x’ denotes the
execute permission. In total 8 possibilities occur which are denoted by the number
between 0 to 7 .

--- 0+0+0=0
--x 0+0+1=1
-w- 0+2+0=2
-wx 0+2+1=3
r-- 4+0+0=4
r-x 4+0+1=5
rw- 4+2+0=6
rwx 4+2+1=7

8
9

These numbers are generated by assigning the values 0 to ‘-‘, 1 to


‘x’, 2 to ‘w’, 4 to ‘r’ and adding them as shown above. This helps us to replace a word of
a word of 9 letters by a 3 digit as 657. In this the first digit denotes permissions for the
owner, the second digit denotes permissions of the group, the third indicates the
permissions of the others.

Commands:-

1.General purpose utilities:-

1.Banner:-

This command prints any string of upto 10 characters in large


letters composed of hash(#) sign. This command is useful for printing names at the
beginning of printouts.

Syn:- banner string…

Ex:- $ banner sushma

2.Cal:-

This command prints a calendar.

Syn:- cal [[month]year]

This command prints a calendar for the specified year. If the month
is also specified, a calendar for that month only is printed. If no arguments are specified,
the current, previous and next month calendar are printed along with the current date and
time. The year must be a number between 1 to 9999, month number is a number between
1 and 12 or you can specify enough characters to specify a particular month.

Ex:- $ cal
$ cal 2001
$ cal 4 2000
$ cal sep 2002

3.Date:-

This command prints and sets the current system date and time.
The UNIX system maintains an internal clock meant to run perpetually. This is possible
because when the system is shut down, a battery backup keeps the clock ticking. This is
possible because when the system is shut down, a battery backup keeps the clock ticking.
This clock actually stores the number of seconds elapsed since January 1,1970.

Ex:- $date

9
10

The command can also be used with suitable format specifiers as


arguments. Each format is preceded by a + symbol, followed by the % operator,and a
single character describing the format.

For example you can print only the month using the format +%m

Ex:- $date +%m


10

The month name can be printed by the format +%h

Ex:- $date +%h


Oct

4.Echo:-

This command is used to print user defined messages on the screen


as well as to print a variable value.

Ex:- $echo good morning


$echo “good morning”
e=10 echo $e

5.bc:-

bc is the calculator. You can use any numbering system or degree


of precision you want. You can also stores intermediate results in variables.

Ex:- $bc
12+5
17
ctrl+d
$

The output is shown in the next line. To come out from the
calculator press ctrl+d.Then $ prompt will be displayed.

Directory handling commands:-

Home directory:-

10
11

Your home directory is the directory you are placed in when you
login to your UNIX account. This directory has the same name as your login name. Every
time you login, UNIX setup a variable called home that identifies your home directory.

The following example displays your home directory name.

$ echo $home

cd:-

This command changes the current or working directory to the


user’s home directory or to the specified directory.

Syn:- cd directoryname

If you don’t specify a directory, cd makes your home directory as


current directory. If the directory is a subdirectory of the current directory you can use its
short name, otherwise you must use the full path of the directory.

Ex:- $ cd office

Mkdir:-

This command creates a new directory in the UNIX environment.

Syn:- mkdir [-p] [-m mode] dirname

-p - If you specify this option mkdir creates a directory by creating all non
existent parent directories.

-m mode- It allows you to set a diferent permission mode for the directory when you
create it.

Ex:- $ mkdir sun


$ mkdir –p sun/sush/sumari
$ mkdir –m 742 sls

Rmdir:-

The rmdir command removes directories.

11
12

Ex:- $ rmdir sls

Like mkdir, rmdir also can delete one or more directories at a time.

Ls:-

This command lists the contents of the current directory.

Ex:- $ ls

Ls –l or l - lists the contents in the long format. If you apply –l to the ls


command displays the contents in the following long format

-rwx-w---x 1 ttyp0 group 32 sep 1 10:25 abc

Ex:- $ ls –l

File handling commands:-

Cat:-

Cat is one of the most well known commands of the UNIX system.
It is mainly used to display the contents of a file on the terminal.

Ex:- $ cat sun

This command is also used to create a file. The syntax of creating a


new file is

Cat > filename

Ex:- $ cat > sush


Adasdsfsdgfdgfdgfdggfdgfdgggfdg
Ctrl+d
$

cp:-

The cp command copies files.

Syn:- cp file1 file2


Cp file directory

12
13

Cp directory1 directory2

The first syntax copies one file to another file. The second syntax
copies a file or group of files into a directory. The cp command copies a copy of a file
with a new name or to a different directory and leaves the original file as it is.

Ex:- cp test sample

Mv:-

This command moves and renames files and subdirectories.

Syn:- mv file1 file2


Mv file directory
Mv directory1 directory2

If your argument consists of two filenames, mv gives file1 to the


new name file2. if the first argument is a filename and the second argument is the name
of the directory, the file is moved into the directory. If both arguments are directory
names, two actions are possible. On all systems if the second name doesn’t exist, the new
one will be created otherwise it moves from one to another directory.

Ex:- mv office sun

Cmp:-

This command compares two files, if the files are same, it returns
no output. If the files are different, it returns the line number and byte position of the first
difference. Only two files may be compared at a time.

Syn:- cmp [-l] file1,file2

-l - prints the byte number and the different bytes for each difference.

$ cmp sample test

Filter commands:-

Head:-

This command takes a file as the standard input and gives first few
lines as output.

Syn:- head [-count] file

13
14

By default head prints the first 10 lines of the input as output. If


you specify the count, head prints first count number of lines as output.

Ex:- head sample


$ head –20 sample

tail:-

This command takes a file as the standard input and gives last few
lines as output.

Syn:- tail [- or + number] file

By default tail prints the last 10 lines of the input as output. If you
specify the count, tail prints last count number of lines as output. You can change this by
specifying the distance from the beginning or end of the file, at which tail is to start. A
number following a + indicates the distance from the beginning.

Ex:- tail sample


$ tail –20 sample
$ tail +20 sample

paste:-

This command merges lines of files. Each file is treated as a


column or a series of columns and the columns concatenated horizontally. This is done by
replacing the new line character at the end of the first line is the first file with a tab and
then appending the first line is the first file with a tab and then appending the first line of
the second file and so on. This command is useful for preparing tables.

Paste file1 file2

Ex:- paste sun sush

Communication commands:-

Mesg:-

Permits or denies messages sent to a terminal.

Syn:- mesg [n | y]

14
15

This command with argument n does not permit messages from


any user to your terminal. Mesg with argument y permits messages from any user to your
terminal. Without any option, it displays the current message status.

Ex:- mesg
$ mesg n
$ mesg y

write:-

Writes a message to another user’s terminal.

Syn:- write user [tty]

The write command copies lines from your terminal to that of any
other user. When first called, it sends the message “Message from your logname your tty
…”. The recepient of the message should wait for message. You can type your message
and press ctrl+d to terminate the message. At this pont, it dispalys as “(end of message)”
and sends the message to another terminal.

To terminate the message, press ctrl+d for end of file and coming
out of the message window to $ prompt or press ctrl+o to interrupt the command right in
the middle.

Talk:-

Talks to another user.

Syn:- talk person [ttyname]

Talk is a visual communication program which copies lines from


your terminal to that of another user.

If you wish to talk to someone on your own machine, then person


is just the person’s login name. If you wish to talk to a user on another host the person is
of the form user@host. If you want to talk to a user who is logged in more than one, then
the ttyname argument may be used to indicate the appropriate terminal name. When first
called, it sends the message.

Message from machine name … talk


Connection requested by
yourname@yourmachine,talk;respond
with:talk yourname@your-machine

To the user to whom you wish to talk. At this point the recepient of
the message should reply by typing.

15
16

Talk yourname@yourmachine

It doesn’t mean that from which machine the recepient replies, as


long as his login name is the same. Once communication is established, the two parties
may type simultaneously with their output appearing in separate windows. Type ctrl+l
which causes the screen reprinted. In addition ctrl+w is defined as a wide key character.

To exit,just type your interrupt character (ctrl+d)

Ex:- $ talk bdps ttyp2

16
17

Conclusion:-

Now-a-days UNIX operating systems is used in many applications.


Since UNIX operating system is a multi tasking,multi-user operating system it is very
useful in the LAN. Since it supports portability it is preferable than any other operating
systems. Since it provides security to all the files and directories it is much secure and
useful in different applications.

17
18

Bibliography

UNIX CONCEPTS & APPLICATIONS


-Sumitabha Das

UNIX OPERATING SYSTEM


-Harely Hahn

THE DESIGN OF THE UNIX OPERATING SYSTEM


-Maurice J.Bach

18
19

Introduction To Operating Systems 1

2 History Of UNIX
2

3 Hardware Requirements
2

4 Features Of UNIX
2-4

5 Structure Of UNIX
5

6 Procedure To Login To UNIX


6

7 UNIX Directory Structure


7

8 Security In UNIX File System


9

9 UNIX Commands
9-16

10 Conclusion
17

Bibliography 18

19

You might also like