Sei sulla pagina 1di 369


Structure Page Nos.

1.0 Introduction 5
1.1 Objectives
1.2 What is Graphical User Interface?
Evolution of Human and Machine Interactioi~
Coinmon Graphical User Interfaces
Functionality of Graphical User Interface
GUI design consideration: psychological factors
GUI design consideration: standards
GUl Examples
1.8.1 Microsoft Windows
1.8.2' Macintosh Toolbox
1.8.3 X-windows
1.8.4 NeXT

Solutions/ Answers
Further Readings

The Graphical User Interface (GUI) is one of the most revolutionary changes to
occur ill the evolution ofthe modern computing system. The interaction between
inan and computer in the design of operating system has changed from a
character-oriented system to the now more graphics-oriented system. This
revolution has increased the accessibility and usability of computer systems to the
general public.

We will look at GUI features of the various operating systems with little
knowledge of operating system or memorized commands. The software providing
such features supports Modern User Interface concept such as desktop
metaphor, which makes computers available to the majority of people who are
either novices or non-programmers. The personal computer was invented for these

We will start with the basic definition move on to basic components and finally look
into some systems to find out what GUI facilities they are supporting.

After going through this unit, you should be able to:

define what GU1 is and how it is different from character oriented system,

define all the terms related with GUI, and

identify important features of several GUIs.

Operatirig System
The term "user interface" originated in the engineering environment in the late 1970s.
Virtually everyone who interacted directly with computers had been an engineer and a
programmer, but new kinds of users were emerging: the non-programming user. These
users often reacted more negatively to difficulties in dealing with a machine. New
f0rm.s of interaction were needed, new interfaces, were required, attention flowed to
"the user interface".

With the introduction of the Macintosh in 1984, Apple Computer popularised the
user interface as it is known today. Apple's user interface is now commonly
referred to as a Graphical User Interface or GUI. The GUI has become associated
with a common feature set available in a number of product offerings. Common
features include:

Secondary user-input devices. Usually a pointing device and typically a mouse.


I Point and shoot functionality with screen menus that appear or disappear
under pointing-device-control.

Icons that represent files, directories and other application and system entities.

Dialog boxes, button, sliders, check boxes and many other graphical
metaphors that let the programmer and user tell the computer what to do and
how to do it.

Today's GUIs have expanded basic functionalities to support not only grkphics, but also
dimensions, color, height, video, and highly dynamic interaction. Modem user interfaces
can simulate a very realistic view of a real, three-dimensional world.


The primary means of communication with computers earlier had been through command-
based interfaces. In command interfaces, users have to learn a large set of commands to
get theirjob(s) done. In earlier computer systems paper tapes, cards and batch jobs were
the primary means of communicating these commands to the computers. Later, time-
sharing systems allowed the use of CRT terminals to interact/communicate with the
computer. These early systems were heavily burdened by users trying to share precious
computer resources such as CPU and peripherals.

The batch systems and time-sharing led to command-driven user interfaces. Users had
to memorise commands and options or consult a large set of user manuals. The early
mainframe and minicomputer systems required a large set of instruction manuals on
how to use the system. In some systems, meaningful terms were used for command
names to help the end-user. But in other systems the end-user had to memorise several
sequences of keystrokes to accomplish certain tasks.

Early users of computes were engineers and what we now call expert users; user3
who had a lot of interest in knowing more about computer systems and the technology.
Command line interfaces were acceptable to the majority of these users. In the 1970s,
computers were introduced to a new class of users: secretaries, managers and non-
technical people. These new users were less interested in learning computer
technology and more interested in getting theirjobs done through the machine. The
command-based interfaces caused many of these new users to develop computer
phobia. Imagine the thought of memorising commands made up of "Control-Alt-Del" to
boot the system.
To make life easier for the end -user, a large collection of devices have been Graphical llsrr
invented to control, monitor and display information. The early (and still widely used) Interface
peripherals are the keyboard and the video terminal. But, it was not until the late
70s, that research projects at some universities led to the invention of pointing
devices and windowing systems. The mouse and joystick were among some of the
few pointing devices that were invented in this period. Also, research pioneers
invented the notion of splitting the screen to allow multiple windows and direct
manipulation of objects.

In the 70s, researchers designed powerful new workstations armed with graphical
user-interfaces. The basic assumption of these new workstations was that one user
could have a powerful desktop computer totally dedicated to that user's task. Thus,
the computer is not only used to perform the task, but can also provide a much more
intuitive and easy-to-use environment. In this unit we will examine the common


This section presents a list of terms used commonly with the graphical user interface
(GUI): GUIs are systems that allow creation and manipulations of user interfaces
employing windows, menus, icons, dialog boxes-mouse and keyboard. Macintosh toolbox,
Microsoft Windows and X-Windows are some examples of GUIs.

1) Pointing Dqvices

Pointing devices allow users to point at different parts of the screen. Pointing devices
can be used to invoke a command from a list of commands presented in a menu. They
can also be used to manipulate objects on the screen by:
Selecting objects on the screen

Moving objects around the screen, or

Merging several objects into another object.

Since the 1960s, a diverse set of tools have been used as pointing devices including the
light pen, joystick, touch sensitive screen and a mouse. The popularity of the mouse is
due to the optimal coordination of hand and easier tracking of the cursor on the screen.

2) Pointer
A symbol that appears on the display screen and that you move to select objects and
commands. Usually the pointer appears as a small angled arrow.

3) Bit-Mapped Displays

As memory chips get denser and cheaper, bit displays are replacing character-based
display screens. Bit-mapped display made up of tiny dots (pixels) are independently
addressable and much finer resolution than character displays. Bit-mapped displays
have advantages over character displays. One of the major advantages is graphic
manipulation capabilities for vector and raster graphics, which presents information in
the final form on paper (also called WYSIWYG: What You See Is What You Get).

4) Windows

When a screen is split into several independent regions, each one is called a window.
Several applications can display results simultaneously in different windows. Figure I
presents a screen with two windows.
Operating System
Fundamentals &

Figure 1: Screen with two windows

The end-user can switch from one application to another or share data between
applications. Windowing systems have capabilities to display windows either tiled or
over-lapped, Figure 2. Users can organise the screen by resizing the window or
moving related windows closer.

Figure 2: Overlapped Windows

5 ) Menus
A menu displays a list of commands available within an application (Figure 3). From
this menu, the end-user can select operations such as File, Edit or Search. Instead of
remembering commands at each stage, a menu can be used to provide a list of items.
Each menu item can be either a word or an icon representing a command or a
function. A menu item can be invoked by moving the cursor on the menu item and
selecting the item by clicking the mouse.
Instead of memorising commands to each stage, the user selects a command from a
menu bar displaying a list of available commands. For example, Figure 3 displays the
menu bar. This tnenu bar displays a list of commands available such as File, Edit and
the appropriate action is taken.
Graphical User

Figure 3: Menu Bar

When a menu item is invoked it could cause other menus, called pull-down menus, to
appear. Pull-down menus (Figure 4 ) are used to present a group of related
commands or options for a menu item. Figure 4 presents the File pull-down menus.
Pull-down and pop-up menus display option commands available for each selection.
Figure 4 shows the pull-down menu displayed when the Character menu item is
selected. The user can then select from different character styles.

Figure 4: Pull-down M e n u

6) Dialog boxes
Dialog boxes (Figure 5) allow more complex interaction between the user and the
computer. Dialog boxes employ a collection of control objects such as dials, buttons,
scroll bars and editable boxes. For example, in Figure 5, a dialog box is used to open
a file.
In graphical user-interfaces, textual data is not only a form of interaction. Icons
represent concepts such as file folders, wastebaskets, and printers. Icons symbolize
words and concepts commonly applied in different situations. Figure 4 shows paint
utility with its palette composed of icons. Each one of these icons represents a certain
type of painting behaviour. Once the pencil icon is clicked, for example, the cursor can
behave as a pencil to draw lines. Applications of icons to the user-interface design are
still being explored in new computer systems and software such as the NeXT
computer user interface.
Dialog boxes are primarily used to collect information from the user or to present
information to the user.

Operating System
Fundamentals &

Figure 5: Dialog Box

Among the information obtained are the number of copies and page numbers to be
printed. Dialog boxes are also used to indicate error message in the form of alert
boxes. Dialog boxes use a wide range of screen control elements to communicate with
the user.
7) Icons
Icons are used to provide a symbolic representation of any systemluser-definedobject
such as file, folder, address, book, applications and so on. Different types of objects
are represented by a specific type of icon. In some GUIs, documents representing
folders are represented by a folder icon (Figure 6). A folder icon contains a group of
files or other folder icons. Double clicking on the folder icon causes a window to be
opened displaying a list of icons and folder icons representing the folder's

h&-- - ---- . - -,.-* . - - - .. .

" o h - Tncapr-
F-?! B 6 J a @ 3 s : yIb OIDhl
Jllm---n~- L @ @ ? - T *am

Figure 6: Icons

8) Desktop Metaphor
The idea of metaphors has brought the computer closer to the natural environment of
the end-user. The concept of physical metaphor paradigm, developed by Alan Kay,
initiated most of the research for graphic user interfaces based on a new p r o g d m i n g
approach called object-oriented programming. Discussion of this subject is beyond this Graphical User
unit. The physical metaphor is a way of saying that the visual displays of a computer Interface
system should present the images of real physical objects.
For example, the wastepaper basket icon can be used to discard objects from the
system by simply dragging the unwanted objects into the dustbin, as in real life. The
desktop metaphor probably has been the most famous paradigm. Because of the
large set of potential office users, this metaphor can have the most dramatic effect.
In this paradigm, the computer presents information and objects as they would
appear and behave in an office, using icons for folders, in-baskets, out-baskets and
In a desktop metaphor, users are not aware of applications. Users deal with files,
folders, drawers, a clipboard and an outbox. Instead of starting the word process and
loading file, users merely open the report document, which implicitly invokes the word
processor, Clicking the mouse on an icon representing the report causes the word
processor to get started and to load the report file implicitly. Today, several computing
environments provide this capability.
9) The3D GUI
The desktop metaphor GUI is 2% D. It is 2D because its visual elements are two-
dimensional: they lie in the xy plane, are defined in 2D coordinates, are flat and contain
only planar regions (areas). It is 2% D because where visual elements overlap they
obscure each other according to their priority. In a 3D GUI the visual elements are
genuinely three-dimensional: they are situated in xyz space, are defined in terms of 3D
coordinates, need not be flat and may contain spatial regions (volumes).
The design considerations for a 3D GUI appear more complex than for a 2% D GUI.
To begin with, the issues of metaphor and elements arise afresh. The desktop
metaphor with its windows, icons, menus and pointing device elements is firmly
established for 2!4D GUIs. Tn contrast no clearly defined metaphor and set of
elements for 3D GUIs are manifest -yet. 3D GUIs offer considerably more scope
for metaphors than 2%D GL.Tls; there are many metaphors which could be based on
our physical 3D environment, includingthe obvious extension of the desktop metaphor
into a 3D environment, including the obvious extension ofthe desktop metaphor into a
3D office metaphor. On the other hand, much more abstract metaphors are possible,
such as one based "starmaps" where objects are simply placed somewhere in
"cyberspace". Likewise the elements of a 3D GUI may resemble, or differ
substantially from, the elements of the 2% D GUI.
The various prototypes have been developed to design the same elements in the
3D GUI as in the 2 'I2Ddesktop GUI: windows, icons, menus, a general space in
which to arrange the visual elements, a cursor and an input device to manipulate
the cursor.


The development environment for most GUTSconsists of four major components:
A windowing system, .
An imaging model,
An application program interface (APT), and

A set of tools and frameworks for creating interfaces and developing integrated
Operating System Windowing systems allow programs to display multiple applications at the same time.
Fundamentals & Windowing systems include programming tools for building movable and resizeable
windows, menus, dialog boxes and other items on the display. Some GUIs contain
proprietary windowing systems, such as Macintosh. Others use common windowing
systems such as X-window or simple X.
An imaging model defines how fonts and graphics are created on the screen. Imaging
models handle, for example, typeface and size in a word processor and lines in a
drawing program. This component of the system environment has taken on increasing
sophistication as applications incorporate complex curves, color, shading and dimension.
Some GUIs support more than one imaging model.
The API is a set of programming language functions that allow the programmer to
specify how the actual application will control the menus, scroll bars and icons that
appear on the screen. Like windowing models, APIs align with particular GUIs.
Finally, GUI development environments can include toolkits and frameworks. Most
of these toolkits are based on object-oriented approach.
Although the structure of the basic development for most GUIs is similar, there are
major differences in how the GUI is integrated with the operating system. Some, like
the Macintosh and NeXT GUIs, are closely integrated with the operating system.
Others, like X Window or Microsoft's Windows, can be set up as options to be selected
by the user when the computer boots up.
Programming of software for GUIs across these components is fairly complex and
challenging. Commercial developers who want to support multiple environments find
their task further complicated by the absence of standards across heterogeneous
computing platforms. The higher-level toolkit component is intended to mitigate much of
this difficulty.
Although the graphical user interface has become a standard component of most
systems, no standards in windowing systems, imaging models, APIs, or high-level
toolkits have emerged. However, three major camps of GUIs dominate. The first camp
is IBM's System Application Architecture (SAA), which includes primarily Microsoft's
Windows and PM (Presentation Manager). The second camp is UNIX systems,
usually built around X Window. The third camp is the Macintosh. In the next section we
will describe the object-oriented functionality of representative GlUs in these camps,
including Windows, X (upon which most of the UNIX camp is based), NeXT and

G F Check Your Progress 1

1) What is GUI and what are its features?

2) Define the features of the following:
a) Window
b) Pull-down menu
c) Dialogbox
d) Pointing devices
3) What is the difference between Bitmapped and character based displays? Graphical User


There are some empirical studies that have identified basic psychological factors that
one should consider in the design of a good GUI. In this section we focus our
discussion to three primary contributing human factors, which are: the physical limits
ofvisual acuity, the limits of absolute memory, and the Gestalt Principle.
Visual Acuity
Visual acuity is the ability of the eye to resolve detail. This refers to the amount of
information one can put on the screen. The retina of the eye can only focus on a very
small portion of a computer screen, or anything for that matter, at any one time. This
is because, at a distance greater than 2.5 degrees from the point of fixation, visual
acuity decreases by half. Therefore, a circle of radius 2.5 degrees around the point of
fixation is what the user can see clearly.
At a normal viewing distance of 19 inches, 5 degrees translates into about 1.7 inches
Assuming a standard screen format, 1.7 inches is an area about 14 characters wide .
and about 7 lines high. This is the amount of information that a user can take in at any
one time, and it limits the effective size of icons, menus, dialog boxes, etc. If the user
must constantly move his eyes across the screen to clearly focus, the GUI design is
causing a lot of unnecessary and tiring eye movement.
Information Limits
Once the user has a desired fixation point, there is a limit to the amount of information
that the person can process at one time. A GUI design rule of thumb is that the range
of options or choices should never be more than five or six. It has been shown that
absolute identification using one-dimensional criteria was about seven items, plus or
minus two. Miller introduced the concept of recoding as a method that people use to
store information. It has also been pointed out that by expanding the identification
criteria from one to more dimensions people could handle more choices and remember
more. Later researchers have expanded this work to develop the concept that people
chuck information together in order to remember more information. This research has
a direct impact on GUI design, especially concerning the number of menu items and
Gestalt Principle
The Gestalt Principle states that people use a top-down approach to organisiiig data.
This principle can influence how one should organise graphical information on the
screen. The Gestalt school of GUI designers have attempted to identify criteria that
cause people to group certain items together in a display. Proper grouping results in a
necessary redundancy of selection information that aids the user. For example, if the
user knows where one item in a group is on a screen, he will expect other like items to
be there also. If one groups the items in line with this expectation, it allows for
accurate locating and better transfer of information to the user.
The top-down approach also allows for the development of emergent features. An
emergent feature is a global property of a set that is not evident when one views each
Operating System item locally. Since global processing tends to be automatic, one can argue that an
Fundamentals & emerged feature reduces the attention demand as a user operates a multi-element
display. For this performance enhancement, one must use the Gestalt Principle in the
initial placement, and the resulting organisation must be compatible with the user's
cognitive view of the task.


Considering the above psychological factors, one could come to the conclusion that
one could easily extrapolate these factors to the design of a good GUI. Empirical
studies of GUI show that this intuition is not always the case. It directly leads to the
conclusion that a good GUI would use a lot of icons. Unfortunately, too many
randomly placed icons violate the limits of absolute memory. Using the Gestalt
Principle, one can group like items together using factors like color to add more
informational dimensions. Too many colors, however, destroy the global visual
grouping of the items. The user then begins to concentrate on the GUI. Any primary
cognitive task attention devoted to the interface may interfere with the primary task.
One can derive basic GUI standards from basic human factors, however. The
standards are the presentation of information, the grouping of information, and
information sequencing.
Amount of Information Presented
The amount of information to present is the most basic of GUI design considerations.
H.E. Dunsmore showed that making screens less crowded improves screen clarity
and readability. As sucli, GUI designers usually follow the guidance that the interface
should display only what the user needs to perform the current operation. Empirical
researchers show that limiting the information to that necessary for the user reduces
errors and time to perform tasks. Errors and performance time increase as the GUI
presents more information. Of course, it requires a thorough analysis of the tasks that
the user must perform in order to display only the necessary amount of information.
Compared to a randomly placed screen, a well-designed screen can reduce the time
needed to perform a task by as much as 40%. Ways to conserve screen space are:

1) Appropriate use of abbreviations: Many design documents recommend using

complete words whenever possible. Due to screen sizing constraints, i{is not
always possible to use complete words. When complete words are not possible,
abbreviations should be contextual and consistent. A good contextual example is
"h," which is usually a good abbreviation to use for help. The number of
abbreviations should not only be contextual but also be kept to the minimum. As
a poor example, in the UNIX system, the "Is" command lists files in a directory.
The "Is" command has 17 different one-letter abbreviations that change the
output options of the "Is" command. The one-letter abbreviations have little
contextual link to the options they represent. In fact, the UNIX system is a good
example of what not to do.

2) Avoid unnecessary detail: For example, use whole numbers if one does not need
decimals. Keep the window and icon designs clear and simple. Even when
users prefer more complex icons, elaborate icons add nothing to performance.
Studies show that when icon designs are too complex, time to complete a task
actually increases. In studies with 3-D and 2-D graphical displays, users
preferred the 3-D displays. There were no differences in performance between
the two graphical displays, however.

3) Use concise wording: Screens have limited space. Screen designers should avoid
the tendency to place additional data on the screen just because the data is
available. More objective limits of screen density vary from the thresholds of
25% to 80%. There is no empirical research that substantiates any performance Graphical User
enhancement with any specific threshold. Interface

1) Use familiar data formats: With more familiar formats, the user will need less
information to complete the task. An example for data entry is the standard
USA address format of street, city, state, and zip code. In addition to requiring
less instruction, the user will perform the operation faster than if the format is

5) Use tabular formats with column headings: Tabular formats allow for efficient
labeling of related data. It is especially preferable for data location tasks. Simply
splitting items on one long line into two lines result in productivity improvements
of 20%.

Grouping of Information
Given a set of information to display, there are many ways one can display the
information. Proper grouping improves the information's readability and can highlight
relationships between the information.
There are several techniques to aid in the grouping of information, which include:

1) Color: Presenting different groups in different colors clearly creates some degree
of grouping among the elements of the same color. GUIs that utilise color well
increase productivity. If like color items are in close proximity, the visual
association is stronger than if the like color items are further apart. In addition to
changing the item's colors, one can use different colors for the background and
foreground. The effectiveness of this technique decreases as the number of
screen colors increases. Overuse of color degrades performance, however.

2) Graphical Boundaries: Drawing boundaries around elements is the most common

method of grouping elements in GUI. Although there is no empirical evidence to
show that these groupings improve performance, users prefer this type of
groupings compared to other methods. Another method of grouping is to group
tasks within icons. Icon grouping is easy because many icons can have common
attributes. Icons are also small and therefore use less space. Another -
advantage of icons is that recognition is faster for pictures than for text. This
makes it easier for the novice to learn a system. Studies also show that icons
have smaller error rates than textual interfaces and the same as for menu
r interfaces. Conversely though, empirical studies have shown that, counter
intuitively, icons do not lead to greater increases in performance.

3) Highlighting: Besides color, there are several other methods of highlighting

including reverse video, brightness, underlining, and flashing. The most common
use of highlighting is reverse video to indicate an item that is currently selected.
GUIs usually use brightness to show which items are not active at a given time.
Underlining is effective if it does not interfere with the legibility of characters.
Flashing will both get attention and annoy if the user cannot turn offthe flashing.
Therefore, one should use flashing only to convey an urgent need. Apple
Macintosh uses flashing to signal only program or data destruction. Regardless
of which type of highlighting, one needs to apply it conservatively. Overuse of
highlighting causes confusion among users and defeats its purpose. Additionally,
if one highlights the wrong information, the user has more difficulty detecting the
important information.

Information Sequencing
One needs to lay out a screen in a manner that allows the user to easily find any
information 011 it. Most designers advocate the use of the de facto GUI screen
Operating System standards. This is because many users now expect certain modes of operation in all
Fundamentals & GUIs. For example, most users expect the top of screen to contain the headings for
the pull-down menus. The top right is the default location for icons representing the
disk availability. In the Macintosh GUI, the bottom right contains the trash icons used
for deleting files.
Within a window, there are also many standard modes. A window title is usually at the
top. Scroll bars are on the right and bottom for vertical and horizontal window
movement. A box for closing the window is at the top left. Icons for resizing the
window are at the four corners.
Studies show that most users initially scan the screen starting at the upper-left corner.
This corner should be the obvious starting point for applications invoked from within the
window. This permits a left-to-right and top-to-bottom reading, which is standard for
Western cultures.

The optirnuni sequence for screen presentations is a collection of various factors,

1) Sequence of use: One needs to present the user the information in the order that
the user will probably utilise it.

2) Conventional Usage: If a common convention is in general usage, the GUI design

should continue using it. For example, in the standard window layout, the file
option is usually to the far left of the menu bar.

3) Importance: The designer needs to place the more important information at a

prominent location. For example, if several entries are possible, the GUI should
lead off with the required ones and end with the optional ones.

4) Frequency of use: One should pace the most frequently utilised commands at the
beginning. For example, in a menu list, the most frequency utilised commands
should be at the top of the list.

5) Generality versus Specificity: The more general items should precede the more
specific items, especially when there is a hierarchical relationship among the data.

6) Alphabetical or Chronological: Ifthere is no other rules for ordering data element,

then one should adopt some other technique such as an alphabetical or a temporal
listing. Card [I I] showed that selection time was faster for alphabetical than for
any other functional grouping.


The goal of any GUI is to allow the user to work through the computer and application
to concentrate on the primary cognitive task. The user should not be concerned with
the user interface. Any attention devoted to the interface interferes with the main task.
This section presents Graphical User Interfaces. Some popular GLTls will be covered to
provide a broad picture of the subject. There are a great many popular GUIs around
including X Windows, Microsoft Windows, NeXTYsNeXTStep and others.

1.8.1 Microsoft Windows (MS-WINDOWS)

MS-Windows is the most popular GUI for IBM personal computers. IBM and
Microsoft announced OS/2 as a new operating system for 80286 and 80386 personal
computers. The 0,912 Standard Edition 1 .I adds Presentation Manager (PM) for its
graphical user interface. The user interfaces of Windows and PM are very similar but
their APIs are different. Microsoft's strategy is to use Windows as a springboard for
Windows provides an environment that enhances DOS in many ways. The major Graphical User
benefits of Windows are: Interface

1) Common Look and Feel: All windows applications have the same basic look
and feel. Once you know one or two Windows applications, it is easy to learn
another one.
2) Device Independence: Windows presents a device-independent interface to
applications. Unlike most of today's DOS applications, a Windows application is
not bound to the underlying hardware such as mouse, keyboard or display.
Windows shields the application from this responsibility. The application deals
with the Windows API to manipulate any underlying devices.
3) Multitasking: Windows provides non-preemptive multitasking support. Users
can have several applications in progress at the same time. Each application can
be active in a separate window.
4) Memory Management: Windows also provides memory management to break
the 640K limitation of MS-DOS. An application has the ability to use the
extended memory, share data segments with other applications and unwanted
segments to disk.
5) Support for existing DOS applications: Windows allows most standard DOS
applications to run under it directly. Any application that does not control the
PC's hardware, use the PC BIOS or MS-DOS software interrupts, can run in its
own window.
6) Data Sharing: Windows allows a data transfer between application Clipboard.
Any type of data can be transferred from one window with the clipboard. The
Dynamic Data Exchange (DDE) protocol defines how two applications can
share information. Information such as bitmap, metafile, character strings and
other data formats call be shared.
Support for Object Orientation
In order to create screen objects such as windows, the application developer defines a
class (similar to record) specifying the necessary properties. Instances of class can
then be created. Several applications can share the same windows simultaneously. To
communicate with Instances of a window class, messages are sent and received by a
special function called the window function. The windows handle all messages such
as re-drawing the screen, displaying icon or pop-up menus and changing the contents
of the client area.
Creation and Manipulation of a Window
MS Windows presents a pre-defined style for user-defined windows; it presents the
structure of a window, followed by a discussion of windows manipulation.
1) Structure of a window: Figure 7 displays possible elements for a window. The
caption bar (or title bar) displays the name of application within the window. The
system menu box contains names of commands available in all applications, such
as minimise, maximize, resize and close. The minimize boxclicked once reduces
the window to an icon. The maximize box enlarges the window to the full screen.
The menu bar contains a list of commands In the application. The client area is
the area inside the window, which is under the application control.

2) Creating windows: Each window created on the screen is a member of some

user defined window class. Window classes are created by the application
program. Several window classes can be active simultaneously. Each window
clads in turn can have several instances active at the same time. There are no
predefined generic window classes that come with MS-Windows.
Operating System To create a window the following steps must be taken:
Fundamentals &
Networking a) Set up a window class structure which defines the attributes of the window
class. Attributes that can be defined include:

i) the window function, which handles all messages for this class

ii) the icon and the cursor used for this class of windows
iii) the background color of the client area
iv) the window class menu

v) the re-drawing filnction used when resizing horizontally or vertically.

Title Bar Menu Bar

System Menu


Status Bar
Figure 7: MS-WINDOWS screen element

3) Manipulating windows: An application can choose to display the Windows, resize

the window, display additional information in the client area, and so on.
Pop-up and Child Windows

Pop-Up and child windows are special type of windows, and are used to communicate
information between the application and the end-user. They remain on the screen for a
sllort period of time. In this example, the pop-up Display information about a given file
such as date and time of creation and the size. Dialog boxes, as discussed earlier, are
a more sophisticated form of pop-up windows.
MS-Windows provides a collection of predefined child windows. These are the most
common usage of child windows. These predefined classes are button, scroll bars,
listbox, edit and static class. A developer can also define child windows that can be
controlled by any user-defined operation.

1 Resources
Resources are used to manage windows and user-defined object. MS-WINDOWS
provides nine kinds of resources to application developers. These resources are :
icons, cursors, menus, dialog boxes, fonts, bitmaps, char strings, user-defined
resources, and keyboard accelerators.
I) Icons and cursors: Windows defines a few types of icons and cursors. An icon Graphical User
or a cursor is essentially a bit-mapped region that is used to represent and Interface
symbolise a window or cursor. A developer can also define an original icon or
cursor using the ICONEDIT utility.

2) Menus: Each window can have its own menu bar. A menu item can be a
character string or a bitmap. Each item of a menu bar in turn can have a pop-up
menu presenting a list of options. Currently, Windows does not support nesting of
pop-up menus within other pop-up menus. (Windows 3.0 provides this
functionality). But a pop-up menu can invoke a dialog box. When a menu is
selected, Windows sends one or more messages to the Window function of the
Window containing the menu bar. These messages can be interpreted to perform
the function corresponding to the menu item.

3) Dialog boxes: These provide another mechanism besides pop-up menu and
menu bar to obtain information from the end-user. Dialog boxes are much inore
flexible than menu bars or pop-up menus. Dialog boxes usually contain a group of
child windows such as buttons, scroll bars, and'editable fields. Just like windows,
dialog boxes have a function that is used to process messages received from the
user upon selection of options. Generally, dialog boxes appear as pop-up
windows. The user selects the option needed from the dialog box and the dialog
box disappears. Figure 8 depicts an example of a dialog contains an edit box, a
list box, and open and cancel buttons. The end-user can specify the name of a
file either by selecting from the list box or by typing the name ofthe file in the
edit box. By clickingon the open button, the application will open the selected

4) Fonts: Windows provides a few families of fonts with different sizes and shapes:
Modern, Roman, Swiss, Helvetica, and Script. Application processors and
desktop publishingcan define additional fonts as needed.

5) Bitmaps: They are used to represent icons, cursors, or draw picture on the
screen. Both mono and color bitmaps can be defined.

Figure 8: Dialog Box (MS-Windows) with an edit box, a list box, and push buttons

6) Character strings: Character strings are handled as resources mainly to

provide a manageable solution to internationalisation of a window application.
Instead of including a character string as part of the code, it can be placed in a
resource file handled as a resource. Once in a resource file, different versions of
Operh. ~g System the same character string resource file can exist for different languages. This
Fundamentals & separation of the character strings from the code makes internationalising the
application much easier, and also makes maintaining the application much simpler.

7) User-Defined Resources: These can be used for many purposes and support
any user-defined data type. Any arbitrary data can be managed as a userdefined
Resources are defined in a text file called a resource script. They are compiled through
a utility called the Resource Compiler and linked with the windows application.
Resources are read only data. Once a resource script is compiled, it can be shared
with other window applications.
Graphics Device Interface
Graphics in Windows are handled by the Graphics Device Interface (GDI). Both vector
and raster color graphics are supported by GDI. GDI supports only two-dimensional
graphics. Vector graphics are supported by a set of vector drawing functions such as
drawing a line, point, and polygon etc. pie chart.
Raster graphics are supported by pixel manipulation. RaSter graphics can be stored or
manipulated either as a bitmap or as a metafile. A bit-mapped representation of the
graph can be manipulated using utilities such as BitBlt, PatBlt, and StretchBlt. A
metafile provides binary encoding of GDI functions such as to draw vectors and to fill
a region with a bitmap. Metafiles take up less disk space than a bit-mapped
representation since they do not represent each pixel directly on disk. When metafiles
are played, they execute the function encoding and perform the necessary graphics
operations to display the graphics output.

I @=

Check Your Progress 2

What are the four major components of GUI? Explain the functioning of any one

2) How does MS-Windows enhance DOS environment?

I .3) How are graphics supported in MS-Windows?

1.8.2 Macintosh Toolbox
The tremendous success of the Macintosh computer popalarized the window-style menu-
driven user interface. Macintosh got its earlv start from A ~ ~ l eLisa.
The Macintosh GUI is called the Toolbox. The Toolbox consists of a collection of Graphical User
utilities to manipulate Macintosh's resources. In this section we present an overview
of Tool box functionally, examine the object-oriented features of the Toolbox snd
discuss major components of the toolbox's user interface features.
Functional Overview
The Tool box provides a collection of utilities to access and manipulate Macintosh
hardware and software resources. It provides a set of utilities to manipulate interface
components such as windows, menu bar, and dialog boxes. These are discussed in the
following sections. Some ofthe other utilities provided are:

1) Fonts Manager: allows manipulation of system and user-defined fonts.

2) Event Manager: provides monitoring of events generated by keyboard and


3) Desk Manager: provides access to desk utilities such as the calculation.

4) Text Edit: provides simple text editing capabilities such as cut and paste.

5) Memory Manager: provides a set of routines to manipulate dynamic memory.

6) Pile Manager: provides a set of routines to manipulate files and transfer data
between files and applications.

7) Silver Driver: provides access to sound and music capabilities.

8) Toolbox Utilities: provides a set of general routines to manipulate icons,

patterns, strings, fixed-point arithmetic, and so forth.
The Toolbox can be manipulated either from the assembly language or Macintosh
Programmer's Workshop (MPW) language (Pascal, C, C++). Toolbox can be
accessed from non-MPW languages including Think C. One of the major features of
the Toolbox is that most of the Toolbox utilities reside in ROM. This provides a very
responsive user interface.
From this point on, we will concentrate on the user components of the Macintosh
Toolbox such as the Window Manager, the Manager, the Menu Manager, the Dialog
Manager, the Scrap Manager, the Draw, and the Resource Manager.
Object-Oriented Features of Toolbox
Just like Microsoft Windows, the Macintosh Toolbox design is object-oriented. For
example, the applicatioii developer defines a new type of window by the template for
a new class of windows. Messages are sent between Toolbox application to change
the behaviour of screen objects such as windows and cursors. When a window needs
to be drawn or resized, a message is sent to the window definition function to
perform the appropriate action.

The Window Manager

The Window Manager allows the application developer to manipulate windows on the
screen. It deals with issues such as overlapping windows, resizing windows, moving
windows around the screen, or changing a window from a foreground to a background
window. Developers can create and manipulate pre-defined Toolbox windows with
any desired shape and form. For example, the user can create a circular or a
hexagonal window.

Toolbox comes with a series of pre-defined windows. The most popular of these
windows is the document window. The document window, depicted in Figure 9, has
Operating System the following regions: Title bar, Close Box, Scroll bar(s), Size Box and content region.
Fundamentals & The Title bar contains the title of the window. By clicking and holding the mouse
within the region, the window can be dragged to a different screen. The Close Box is
used to shut the window. Clicking inside this box will cause the window to disappear.
The Size Box is used to resize the window. The horizontal or vertical Scroll bars can
be used to scroll the contents of the window. The content region is the area that is
controlled by the application.
Case Box Title Bar

Courses Region ScroI Bar slit bar

Figure 9: Macintosh Toolbox Document Window

When crkating a document window anyone of the components described above can
be omitted. For example, anyone of the Scroll bars can be absent from the document
New types of windows can be created through either the Window Manager or the
Resource Manager. The Resource Editor can be used to create a window template. A
window template essentially defines a class of windows that can be instantiated by an
application. For each class of window, defined by the system or there exists a function
called the window definition function. This function is used to handle the behaviour
and appearance of the window. When a window needs to be drawn or resized, a
message is sent to the window definition function to perform the action for that type
of window.
The Window Manager provides a large collection of routines to create, display, hide
and activate/deactivate windows on the screen.
The Resource Manager
The Resource Manager provides access to various resources such as the windows,
fonts, icons and menus. A user-defined resource such as a window is defined as Resource
Editor. The template of the window and the window definition function is stored in a file
called the resource file. A unique resource identifier is used to access a pre-defined
resource. Resource identifier can be used to recognise the type of resource and the
actual resource file to be read.
The Menu Manager
The Menu Manager provides a set of routines to create and manipulate menus. A
menu bar, &pic ted in Figure 10, can contain a list of one or more menu items. Each
menu item highlights itself when clicked with the mouse; this item is selected. The
developer can define a menu using the standard bar. Menus can be stored as a
resource and managed by the Resource Manager. Once given to Manager, a unique
identifier is used to reference the menu.
Graphical User

Figure 10: Macintosh Menu Bar

A menu item can even invoke a pull-down menu, which can be used to or choose
additional selections, see Figure I l . A menu item in a pull-down menu can then
invoke a dialog or an alert box. A menu item can be a textual icon. Unlike MS
Windows, menus in Toolbox cannot be a part of a window Menus and only used to
define the menu bar, which is associated with one Macintosh screen.
The Control Manager
The Control Manager provides a set of routines to define objects like buttons, check
boxes and scroll bars. Controls are usually a window. For example, the scroll bars can be
defined as part of a document. Most often controls are defined as part of a dialog or an
alert box.

Figure 11: Macintosh Pull-down Menu

The Dialog Manager

I The Dialog Manager provides a set of routines and data structures to manipulate dialogs
I and alert boxes. Dialog boxes are used to get additional information from the end-user of
an application. An alert box is used to provide information such as a warning or a cautionary
Operating System The Scrap Manager
Fundamentals &
The Scrap Manager allows the user to move data from one application to another. A
portion of one window can be cut and placed in the scrap manager and then pasted into
another window. Once a portion ofa window is cut, it is placed in the clipboard. The user
can paste the contents of the clipboard into another window.

The name X, as well as part of the initial design, was derived from an earlier window
system called W developed at Standford University. Currently, the X Window system
is supported by an X Consortium of primarily UNIX-based hardware and software
vendors as a standard base for user interfaces across most UNIX product lines.
Figure 12 illustrates the components of UNIX GUIs based on X Windows.

The X Window system does not define any particular style of interface but rather
provides a mechanism for supporting many styles. X is also network-based. In
contrast with PM, the X architecture is based on the premise that an application can
run one computer, while the graphical presentation of the application's output and
responses from the user can occur on another computer. As such, X provides a
flexible set of primitive window operations but carefully avoids dictating the look and
feel of any particular application. X's device-independent functionally allows it to
serve as a base for a variety of interface styles. X does not provide user interface
components such as buttons, menus, or dialog boxes.

CXI Motif DEC Open

Windows Look

I HP X Widgets

X Window
.XU1 X View
r l Kits

System Window Server

Proprietary II Un:itcikas I Display
I News

Operating I UNIX I
System I I
Figure 12: Components of major UNIX-based GUIs

An interface supporting X can theoretically use any X-Window display. The

application program sends calls to the X-Window Library, which packages the
requests as X packets and sends calls to the X-Window server. The server decodes
the X packets and displays them on the screen. Exactly how the packets will be
displayed (i.e. will look) on a workstation depends on the set of pre-designed window
elements called widgets that are unique to the particular workstation in the system
environment. The ultimate look on one workstation may differ substantially from that
on another, but the response to a user's action on these different-looking interfaces
wi I1 6e the same. Several hq brids of X exist.
The application-programming model for X, like PM and Windows, is event-driven, and
the categories of events are similar. Like PM, X programs rest in wait loops until the
underlying window-management system generates an event. Window hierarchy
management is also common to the architecture of both systems. Like PM's window,
windows in X are organized as parents and children, so attributes can be inherited and
effects of the events applied to related members.
Since does not support any part~cularinterface style, most programmes build Graphical User
applications with libraries that provide an interface to the base window system. One Interface
standard programming interface to X is the C language library known as X Library or
Xlib. This library defines functions for access and control over the display, windows
and input devices. Although commonly used, the library can be difficult and tedious to
work with and often results in hundreds of lines of code for a GUI. A better solution is
a higher-level toolkit, such as the X Toolkit (Xt), upon wllicll many other X Window
toolkits are based.
X Toolkit is the foundation upon which most of the commercial toolkits are based and
is a good example for describing object-oriented functionally. The X Toolkit consists of
two parts: a layer known as Xt Intrinsics and a set of widgets. Xt Intrinsics supports
many of the available widget sets. The widget set implemellts user interface
components including scroll bars, menus and buttons. Xt intrinsics provides a
framework that allows the programmer to combine the components. Both parts are
integrated with Xlib, allowing programmers access to higher-level libraries. A typical
X programming environment is illustrated in Figure 13.

7 Wldget Set

Xt lntrinsics

Xlib C Language Interface

r Network Connection

L X Server

Figure 13: Typical X Window Development Environment

The common distinction in object-oriented programming between an application

programmer (consumer) and a class library programmer (producer) fits well into the X
environment. The X application programmer is likely to use a combination of a higher-
level toolkit (e.g., theToolkit's Xt Intrinsic), Xlib, and a widget set. The class library
programmer, whose job is to create new widgets, is likely to use the capabilities from
within one of the higher-level toolkits.

Depending on the toolkit, the widget programmer may be able to take advantage of
object-oriented capabilities. Xt Intrinsic, for example, uses an object-oriented approach
and organises widgets into classes. Xt Intrinsic defines the basic architecture of a
widget. This allows widgets to work together smoothly when built by different
programmers or potentially when selected from different widget sets. /

A typical widget consists of two basic parts: a class record and an instance record.
Each of these components is implemented as a C structure containing data and
pointers to methods. Intrinsics defines the organisation of each structure. All widgets
belonging to a class share a copy of common data methods for that class. Each
individual widget has its own copy of instance-specific data. A widget's class record is
usually allocated and initialised statically at compile time; a unique copy of the instance
record is created at run time for each individual widget.

Since all widgets belonging to the same class share the same class record, the class
record must contain only static data that do not relate directly to the state of an
individual widget. For example, every widget's class record includes a field containing
the widget's class name. The class record also contains methods that define the
Operating System
Fundamentals &
appearance and behaviour ofall widgets in the class. Although most of these methods
operate on the data in the widget's instance records, the methods themselves are
shared by all widgets in a class.
Many object-oriented languages provide inheritance as a langcage construct. The
Xt Intrinsics Is written in the C language, which does not directly support object-
oriented programming. Xt itself supports inheritance with a subclassing mechanism.
'To use Xt's subclassi~lgcapabilities, the programmer first finds an existing widget
with similar functiolls (a common step in objt-t-criented design), writes a subclass
that can inherit existing data and methods, a!.,! then adds new data and methods as
If a similar widget cannot be found, then a foundation class called Core is subclassed.
All widget classes are subclasses of the core widget class. Like the class Window in
PM, Core contains the basic methods for initializing, displaying, and destroying widgets,
and reacting the external resizing. Core also stores basic properties (e.g., the
geometry) of widgets and the data for handling events.
New widget classes inherit the methods (called resources) defined by their superclass
by specifically including the definition ofthe superclass structure in the definition ofthe
new class. Xt Intrinsics provides two mechanisms for inheriting the methods defined by
a superclass. The first mechanism is referred to as chaining. When a method is
chained. Xt Intrinsics invokes the method defined by a widget's superclass first and
then invokes the widget's method. This allows a widget to inherit part of a method
from its superclass.
Xt Intrinsics also provides a mechanism for inheriting methods that are not chained.
This is done by using special symbols to specify methods in the widget's class records.
Each sylnbol is defined by the superclass that added the method to the widget's class
record. These symbols can be used by a subclass of the widget class Core and do not
have to be redefined by each widget class. Only classes that contribute new methods
to the class record need to define new symbols. When a widget class specifies one of
these symbols in the class record, Intrinsics copies the corresponding method used by
the widget's superclass into the widget's class structure at class initialisation time.
Figure 14 illustrates this architecture and shows the relationship between the class
record and instance records of several widgets belonging to widget class core.

Core: Class
Record Core Class

Basic: Class Record

Core Class Part Basic
Core Part

Basic: Instance Basic: Instance

Record Basic Core Record Basic Part
Core Part

Figure 14: Inheriting from Widget Class Core

The Xt Intrinsics uses a data-abstraction technique to hide the implementation of a

widget from applications that use the widget. Applications that use a widget see only
the incomplete definition of the widget and therefore cannot directly access fields in
the widget structure.
Applications declare all widgets as type Widget, which is known as opaque type. This Graphical User
means the application has a pointer to the widget structure but does not have access Interface
to the real definition of the data that it represents. The application cannot access the
contents of the data structure.
Another object-oriented technique promoted in X Windows is to extract some general
functionality from two or more new widget classes and create a metaclass. A
metaclass is an abstract class that is not intended to be instantiated directly but serves
as a superclass for other similar widgets. Wlien creating a complete new widget set, it
is frequently useful to create a class of hierarchy or metaclasses. With this approach,
the top metaclass in the hierarchy defines elements that all widget classes in the set
have in common, and each subclass becomes more and more specialised. Such an
organisation allows the widget programmer to create new widget classes with the
least amount of effort, although there is some extra initial effort required to design and
create metaclasses. For example, this approach is used by the X Widget set from HP,
where most basic widgets inherit from the primitive metaclass and most composite
widgets inherit from the Manager widget class.

@= Check Your Progress 3

I) What types of utilities are provided in Toolbox? Explain their features.

2) Explain the function~ngof Resources Manager and Menu Manager of Toolbox.

3) What is the basic philosophy of X-windows? How is it different from the rest of

1.8.4 NeXT
The NeXT computer, with its three-dimensional user interface, was introduced in
1988. It has grabbed the attention of the computer industry. The machine has been
hailed as the most innovative computer invented in recent times. The computer was
initially intended for the educational market. But the NeXT Corporation decided to
widen the market for its machine to the commercial arena.
We provide a brief overview of the IVeXT software tools and capabilities, followed by
a discussion of the capabilities of the user-interface design.
Overview of NeXT Software
I The NeXT computer is designed to reach a wide range of users from non-technical to

power users. The non-technical users can deal with the graphic user interface to perform
Operating System tasks by manipulating menus, icons, and dialog boxes. The power user can directly interact
Fundamentals & with its Mach Operating system.
The NeXT system software comprises three major pieces: the Mach operating system,
applications and the NeXT user interface. The Mach operating system, developed at
Carnegie Mellon University, is a re-designed UNIX. Mach re-designs the UNIX kernel
to reduce the size.
NeXT also comes with a set of bundled applications. Currently, there are new
applications being developed that take adv-lntageof NeXT hardware and sofhvare
capabilities. Some of the applications supported on NeXT are NeXT SQL Database i
Server, Mathematica (symbolic mathematics package, WYSIWYG editors and word I
processors, and more.
NeXT User Interface 1

The third and last component, the NeXT user interface, is the most impressive piece of
NeXT technology. The NeXT user interface draws heavily on direct manipulation and
modem graphic user interfaces.TheNeXT user interface is composed of four components.
Workspace Manager, Interface Builder, Application Kit, and NeXT Window Server.
The Workspace Manager allows the user to manage files and directories and to
execute programs. When a user logs into a NeXT machine, the Workspace Manager is
started, Figure 15. The Directory Browser window is used to navigate through the
files on disk.

Figure 15: NeXT Workspace Manager Directory Browser

The Interface Builder lets the user create interfaces on the screen without writing a
single line of code. Users simply select the menu, control and screen objects from a
palette, and then move the controls to the desired location.
The Application Kit is a library of user-interface objects. It is used in conjunction with
the Interface Builder to design user interfaces. The Application Kit is discussed in the
next section.
The Window Server handles all screen activities, such as drawing windows and
handling events such as mouse clicks. The window Server itself does not perform the
drawing and screen 110 commands. Display Postscript, designed by Adobe and NeXT,
handles all such activities. Up to now, Postscript has been used only as a language for
printer engines. With tlie advent of the Postscript, both screen and printer share the
same protocol. Therefore one drawing method is used to display objects on the screen
and the printer.
I Objects
Graphical User

Figure 16: Application Kit

Application Kit
The Application Kit provides an extensive library of predefined classes. The hierarchy
of classes is shown in Figure 16. These classes provide functionality to define user
interfaces composed of menus, windows, buttons, slide bars, and sound. Each class
within the hierarchy defines the behaviour of its objects. For example, a menu knows
how to handle mouse events, when clicking on a menu item. Window objects know how
to resize the window.
The Application Kit can be extended by adding new s~~bclasses to the hierarchy. To
add new subclasses, the class definition is written using the Objective C language.
Each NeXT machine comes with a copy of Objective C. Objective C is an object-
oriented extension of C. The language is a superset of C incorporating object
orientation features from Smalltalk. Just like Smalltalk, it comes with a large
collection of predefined classes to simplify the software development task. The
language supports abstract data types, inheritance, and operator overloading. Unlike
C++, Objective C does not extend the definition of any existing C language construct.
It relies totally on the introduction of new colistructs and operates to perform tasks
such as class definition or message passing.
To develop user interfaces, designers can use Application Kit from Objective C
directly. This would be very much like developing an application using MacApp. They
call create instances of objects from the Application Kit hierarchy and modify the
Operating System attributes by calling the methods attached to the class definition. But the other niethod
Fundamentals & of defining user interface, using the Interface Builder, is much easier than coding it
entirely in Objective C.
Designing User Interfaces with Interface Builder
The Interface Builder provides an easy to use utility to design a user interface using the
muse and the screen. The Interface Builderis similar to an icon editor or screen
painter. Designers can define the screen layout by selecting the screen objects from the
lnterface Builder palettes. The Interface Builder also helps to define the user-defined
class and make connections between objects. Not all of the coding is automatic; the
Application Kit and the Objective C language are also needed.
Defining a user interface using the Interface Builder requires the following steps:
1) Define layout of screen: the interface designer defines a user interface by
simply selecting screen objects from the Interface Builder palettes, see Figure
17. After picking an object from a palette using the mouse, the object can be
dragged into the destination window and resized as desired.
The lnterface Builder palettes include objects such as windows, menus, buttons,
fields radio buttons and more. At the top of the palettes window, three buttons
allow the interface developer to select a wide array of user-interface objects.
2) Define the user-defined classes: the developer defines a new class definition
using the Classes Window. The Classes Window allows the developer to extend
the Application Kit class hierarchy. The developer navigates through the class
hierarchy and creates a new subclass within the hierarchy. Methods and outlets
(see next step) are defined for this new class definition. When a class is defined
this way, only the template of the class is created.

Figure 17: NeXT interface Builder palette .

3) Making connections: up to this point we have defined the layout of the user
interface. At this step, the developer needs to make connections among
application objects. For example, when a stroller's slide bar is moved, a message
is sent to an application object to perform certain actions like shifting the text.
Again the Inspector is used to connect user interface objects with methods of
classes within the application.
4) Actual application code: the previous stepsare handled by Interface Builder
directly. The last step is accomplished by writing the application code in Objective
C. When the developer is done with the first two steps, the lnterface Builder
defines the source files necessary to build the application. These files contain the
template for the class definitions and the connections made among objects. At this
stage, the developer needs to extend these source files. Extensions are made to
specify the logic of the program and the code for method definitions.
Check Your Progress 4 Graphical User
1) What are the major components of NeXTSTEP? How do these elements

2) How are applications written in NeXTSTEP environment?

The GUI has already made a tremendous contribution to the increased usability of
computer systems. It is with great excitement that we look forward to future
innovations in human-computer interfaces. GUI development is at the vanguard of
creativity in many areas, such as ergonomics, software development tools, computer I

infancy of GUls. There remains much to be done in terms of increasing the 1

we discussed several issues related to GUI including functioninn of several popular

cp Check Your Progress 1

1) GUI is a system that allows creation and manipulation of user interfaces
employing windows, menus, icons, dialog boxes, etc.
The basic features of GUI are:
Pointing device such as mouse, which controls cursor.
Point and shoot functionality under control of device, which cause screen
menus to appear or disappear.
Support ofwindows, which graphically display the status of a computer
Icons that represent files, directories and other application and system

and how to do it.

2) a) When a screen is split into several independent regions each one is called a
window. Several applications can display results simultaneously in different
windows. The user can switch from one window to another window.
Windowing systems have capabilities to display windows either tiled or
lapped. Users can organize the screen by resizing the window or moving
related windows closer. 31
Operating System b) No model answer is given.
Fundamentals &
c) No model answer is given.

d) No model answer is given.

3) Bit-mapped display is made up oftiny dots (pixel) that is independently

addressable and has much finer resolutions than character displays. Bit-mapped
displays have advantages over character displays. One of the major advantages is
of graphic capability.

2 Check Your Progress 2

1) There are four major components of GUI.

i) A windowing system
ii) An emerging model
iii) An application program interface

iv) A set of tools and frameworks for creating interfaces and developing
integrated application.
The API (Application Program Interface) is a set of programming language functions
that allow the programmer to specify how the actual application will control the menus
scroll bars and icons that appear on the screen. Like in windowing models, APIs align
with particular GUls. The features vary from package to package.

2) There are several ways MS-Windows enhance DOS environment.

i) Device independence. It presents a device independent interface to

applications. Unlike most oftoday's DOS applications, a window application
is not bound to the underlying hardware such as mouse, keyboard or display

ii) Multitasking. Users can have several applications in progress at the same
time. Each application can be active in a separate window.
iii) Memory management. Windows also provide memory management, the
640K limitation of MS-DOS. An application has the ability to extend
memory and share data segments with other applications.

iv) Data sharing. Clipboards allow data transfer between application clipboard.
Any type of data can be transferred from one window to another through
the clipboard.

3) No model answer is given.

Check Your Progress 3

1) The toolbox provides a collection of utilities to access and manipulate Macintosh

hardware and software resources. It provides a set of utilities to manipulate
windows menu bar and dialog boxes. Some of the other utilities provided are:

i) Fonts manager: allows manipulation of system and user defined fonts.

ii) Event manager: provides monitoring of events generated by keyboard and

iii) Text edit: provides simple text editing capabilities such as cut and paste.

iv) Toolbox utilities: provides a set of general routines to manipulate strings,

fixed point arithmetic and so forth.
Graphical User
Structure Page Nos.
2.0 Introduction 34
2.1 Objectives 35
2.2 What is an Operating System? 35
2.3 Evolution sf ~ p t ? ~ ~ iSysteiii
\llg 36
3,3: 1 SeAal processing
2.3.2 Batch Processing
2.3.3 MultipYogtaniMilig
2,4 Operating System Structure
2.4.1 Layered Structure Approach
2.4.2 Virtual MaehinC
2..4:3 ellent-server Model
1.4.4 Kernel Approach
2,.5 Classification of Advanced Operating System
25 1 Architecture Drired Operating System
2.5.2 Application Driven Operating Systeni
2.6 ~haf~cteristics
of Modern Operating System
2.6.1 Microkernel Architecture
2.6.2 Multithreading
2.&3 Syrrimetrie Mtl\tiprocessin~

2.9 Further ~eddiiigs 54

An opefatirig system is a system software which may be viewed as an organized
C O I \ ~ ? Cof
~ ~software
O~ consisting of procedures for operating a computer and providing
an etlvironment for execution of programs. It acts as an interface between users and
the hardware of a computer system.

There are many important reasons for studying operating systems. Some of t l ~ c mare:

1) User interacts wit11 the computer through the operating system in order to
accoinplisl~his task since it is his primary interface with a computer.

2) It helps users to u~lderstandthe inner functions of a computer very closely.

3) Many concepts and techniques found in the operating system have general
applicability in other applications,

The introductory concepts and principles of an operating system will be the main
issues for discussion in this unit. The unit starts with the basic definition and then goes
on to explain the stages of evolution of operating systems. It further gives details of.
several approaches to operating system design.

In the last two subsections of the unit we classify an advanced operatit g, system and
explain some characteristics of modern operating systerns.
2) No model answer is provided.

3) The X window system does not define any particular style of interface but
provides a mechanism for supporting many styles. X is also network-based in
contrast with other GUls, or the X architecture is based on the premise that an
application can run on one computer while the graphical presentation of the
application's output and the responses from the user can occur on another

Check Your Progress 4

I) No model answer is given.

2) No model answer is given.

1) Communication of ACM, April 1993.

2) Object Orientation: Concepts, Languages, Databases. User Interfaces,

Khosafian, Setrag & Razmik Abnours, New York; Wiley & Sons, 1990.
- "


Structure Page Nos.
2.0 Introduction 34
2.1 Objectives 33
2.2 What is an Operating System? 35
2.3 Evolution of ~ p & l ' t \ f lSystem
3.3, l Serial Processing
2.3.2 Batch Processing
2.3.3 Multi@Wgtnrntfling

2.4 Operating System Structure

2.4.1 Layered Structure Approach
2.4.2 Virtual Maehinl
2;4J elien't-server ~ o d e l
2.4.4 Kernel Approach
2.5 Classification ofAdvanced Operating System
2.5.1 Architecture Driven Operating System
2.5.2 Applikati~tlDrived Operating Systenl
2.6 ~harai:teristjcsof Modern Operating System
2.6.1 Microkernel Architecture
2.6.2 Multithreadifl%
2.6.3 symmetric Mi~tiprocessin~

2.9 Further ~ e ~ d f d g s 54

An operatifig system is a system software which may be viewed as an organized
selletztion of software consisting of procedures for operating a computer and providing
an eflvironment for execution of programs. It acts as an interface between users and
the hardware of a computer system.

There are many important reasons for studying operating systems. Some of thcin are:

1) User interacts with the computer through the operating system in order to
accomplish his task since it is his primary interface with a computer.

2) It helps users to understand the inner functions of a computer very closely.

3) Many concepts and techniques found in the operating system have general
applicability in other applications.

The introductory concepts and principles of an operating system will be the main
issues for discussion in this unit. The unit starts with the basic definition and then goes
on to explain the stages of evolution of operating systems. It further gives details of
several approaches to operating system design.

111 the last two subsections of tile unit we classify an advanced opelati1:g system and
explain some characteristics of modern operating systerns.
Operating System etc., which replace assembly language for system programming. The use of system
Fundamentals & calls in C or Pascal programs very much resemble pre-defined fiinctions or subroutine

As an example of how system calls are used, let us consider a simple program to copy
data from one file to another. 111an interactive system, the following system calls will
be generated by the operating system:
Prompt message for inputting two file names and reading it from the terminal.
Open source and destination file.
Prompt error message in case the source file cannot be open because it is
protected against access or because the destination file cannot be created since
there is already a file with this name.
Read the source file
Write into the destination file
Display status information regarding various Read/Write error conditions. For
example, the program may find that the end of the file has been reached or that
there was a hardware failure. The write operation may encounter various errors,
depending upon the output device (no more disk space, physical end of tape,
printer out of paper and so on).
Close both files after the entire file is copied.
As we can observe, a user program makes heavy use of the operating system. All
interaction between the program and its environment must occur as the result of
requests from the program to the operating system.
Operating System Commands: Apart from system calls, users may interact with
the operating system directly by means of operating system commands.
For example, if you want to list files or sub-directories in MS-DOS, you invoke dir
command. In either case, the operating system acts as an interface between users
and the hardware of the computer system. The fundamental goal of computer
systems is to solve user problems. Towards this goal computer hardware is
designed. Since the bare hardware alone is not very easy to use, programs
(software) are developed. These programs require certain common operations,
such as controlling peripheral devices. The command function of controlling and
allocating resources are then brought together into one piece of software; the
operating system.
To see what operating systems are and what operating systems do, let us consider
how they have evolved over the years. By tracing their evolution, we can identi@ the
common elements of operating systems and examine how and why they have
developed as they have.


An operating system may process its task serially (sequentially) or concurrently
(several tasks simultaneously). It means that the resources of the computer system
may be dedicated to a single program until its completion or they may be allocated
among several programs in different stages of execution. The feature of the operating
system to execute multiple programs interleaved fashion or different time cycles is
called multiprogramming systems. In this section, we will try to trace the evolution
of the operating system. In particular, we will describe serial processing, batch
processing and multiprogramming.
2.3.1 Serial Processing Introduction to
Operating System
Programming i n 1's and 0's (machine language) was quite common for early computer
systems. lnstructions and data used to be fed into the computer by means of console
switches or perhaps through a hexadecimal keyboard. Programs used to be started by
loading the program comp~lterregister with the address of the first instruction of a
program and its result (program) used to be examined by the contents of various
registers and memory locations of the machine. Therefore. programming in this style
caused a low utilisatio~~of both users and machine.
The advent of lnputloutput devices, such as punched cards, paper tape and language
translators (Compiler IAsse~nblers)brought a significant step in computer system
utilisation. Programs started being coded into programming language first changed into
object code (binary code) by translator and then automatically loaded into memory by
a program called ioader. After transferring control to the loaded program, the
execution of a program begins and its result gets displayed or printed. Once in
memory, the program may be re-run with a different set of input data.
The process of develop~nentand preparation of a program in such an environment is
slow and cu~nbersomedue to serial processing and numerous manual processing. In a
typical sequence first the editor is called to create a source code of user program
written in programming language, then the translator is called to convert a source code
into binary code and then finally the loader is called to load the executable program
into the main memory for execution. If syntax errors are detected, the whole process
must be redone from the beginning.
The next development was the replacement of card-decks with standard inputloutput
and some useful I':jrary programs, which were further linked with user programs
through system software called linker. While there was a definite improvement over
machine language approach, the serial mode of operation is obviously not very
efficient. This results in low utilization of resources.
2.3.2 Batch Processing
Utilisation of compi~terresources and improvement in programmer's productivity was
still a major problem. During the time that tapes were being mounted or the
programmer was operating the console, the CPU was sitting idle.
The next logical step in the evolution of the operating system was to automate the
sequencing of operations involved in program execution and in the mechanical aspects
of program development. Jobs with similar requirements were batched together and
run through the computer as a group. For example, suppose the operator received one
FORTRAN program, one COBOL program and another FORTRAN program. If he
runs them in that order, he would have to set up for FORTRAN program environment
(loading the FORTRAN compiler tapes), then set up COBOL program and finally
FORTRAN program again. If he runs the two FORTRAN programs as a batch,
however, he could set up only once for FORTRAN thus saving operator's time.
Batching similar jobs brought utilisation of system resources quite a bit. But there were
still problems. For example, when ajob is stopped, theoperator would have to notice
that fact by observing the console, determine why the program stopped and then load
the card reader or paper tape reader with the next job and restart the computer.
During this transition from one job to the next, the CPU sat idle.
To overcome this idle time, a small program called a resident monitor was created
which is always resident in the memory. It automatically sequenced one job to another
job. The resident monitor acts according to the directives given by a programmer
through control cards, which contain information Iike marking ofjob's beginnings and
-ehdings, commands for loading and executing programs, etc. These co~nmandsbelong
to job control language. These job control language commands are included with
user program and data. Here is an example ofjob control language commands.
Operating System $COB - Execute the COBOL compiler
Fundamentals &
Networking $JOB - First card of a job
$END - Last card of a job
$LOAD - Load program into memory
$RUN - Execute the user program
Figure 2 shows a sample card deck set up for a simple batch system.


I - I

1 $COB
$JOB -

Figure 2: Card Deck for Cobol Program for a Simple Batch Syscern

With sequencing of program execution mostly automated by batch operating system,

the speed discrepancy between the fast CPU and the comparatively slow inputloutput
devices such as card readers, printers emerged as a major performance bottleneck.
Even a slow CPU works in the microsecond range, with millions of instructions per
second. A fast card reader, on the other hand, might read 1200 cards per minute.
Thus, the difference in speed between the CPU and its inputloutput devices may be
three orders of magnitude or more.
The relative slowness of inputloutput devices can mean that the CPU is often waiting
for inputloutput. As an example, an assembler or compiler may be able to process
300 or more cards per second. A fast card reader, on the other hand, may be able to
read only 1200 cards per minute. This means that assembling or compiling a 1200
card program would require only 4 seconds of CPU time but 60 seconds to read.
Thus, the CPU would be idle for 56 out of 60 seconds or 93.3 per cent of the time.
The resulting CPU utilization is only 6.7 per cent. The process is similar for output
operations. The problem is that while an inputloutput is occurring, the CPU is idle,
waiting for the inputloutput to complete; while the CPU is executing, inputloutput
devices are idle.
Over the years, of course, improvements in technology resulted in faster inputloutput
devices. But CPU speed increased even faster. According to Moore's Law, CPU
speed is getting doubled every 18 months. Therefore, the need was to increase the
throughput and resources utilization by overlapping inputloutput and processing
operations. Channels, peripheral controllers and later dedicated inputloutput
processors brought a major improvement in this direction. DMA (Direct Memory
Access) chip which directly transfers the entire block of data from its own buffer to
main memory without intervention by the CPU was a major development. While the
CPU is executing, DMA can transfer data between high-speed inputloutput devices
and the main memory. The CPU requires to be interpreted per block only by DMA.
Apart from DMA, there are two other approaches to improving system performance
by overlapping input, output and processing. These are called buffering and
Quffering is a method of overlapping input, outppt and processing of a singlejob. The
idea is quite simple. After data bas been read and the CPU is about to start operating
on it, the input device is instructed to begin the jiext input immediately. The CPU and
iqput device are then both busy. With luck, by the time the CPU is ready for the next
data item, the input device will have finished readlng it. The CPU can then begin
processing the newly read data, while the input device starts to read the following data.
Similarly, this can be done for output. In this case, the CPU creates data that is put into
a buffer until an output device can accept it.

If the CPU is, on the average, much faster than an input device, buffering will be of
little use. If the CPU is always faster, then it always finds an empty buffer and has to
wait for the input device. For outpyt, the CPU can proceed at full speed until,
eventually, all system buffers are full. Then the CPU must wait for the output device.
This situation occurs with inputjoutput bound jobs where the amount af iaput/output
device, the speed of execution is controlled by the input/output devlce, not by the speed
of the CPU.

A more sophisticated form pf inputloutput buffering is called SPOOLING

(Simultaneous Plieripheyal Operation 011Cine) which essentially uses the hard disk
(secondary memory) as a very large buffer ( ~ i ~ u3)
output files.
r efor reading and for storing I

1 Figure 3: Spooling I
Buffering overlaps input, output and processing of a singlejob whereas Spooling
allows CPU to overlap the input of one job with computation and output of
other jobs. Therefore this approach is better than buffering. Even in a simple system,
the spooler may be reading the input of one job while printing the output of a different
I job.
2.3.3 Multiprogramming
Buffering and Spooling improve system performance by overlapping the input, output
and computation of a singlejob, but both ofthem have their limitations. A single user
cannot always keep CPU or I10 devices busy at all times. Multiprogramming offersa
more efficient approach to increase system performance. In order to increase the
resource utilisation, systems supporting multiprogramming approach allow more than
one job (program) to reside in the memory to utilise CPU time at any moment. More
number of programs competing for system resources better will mean better resource
uti lisation.
The idea is implemented as follows. The main memory of a system contains more than
one program (Figure 4).
Operating System Primary Memory
Fundamentals &




. . .
. . .

Figure 4: Memory Layout in Multiprogramming Environment

The operating system picks one of the programs and starts executing. During
execution of program 1 it needs some I10 operation to complete in a sequential
execution environment (Figure 5a).The CPU would then sit idle whereas in a
multiprogramming system, (Figure 5b) the operating system will simply switch over to
the next program (program 2).
Program 1 Program 2

(a): Seauential Execution -

1 (b): Execution in Multiprogramming Environment

Figure 5: Multiprogramming

When that program needs to wait for some I10 operation, it switches over to program
3 and so on. Ifthere is no other new program left in the main memory, the CPU will
pass its control back to the previous programs.
Multiprogramming has traditionally been employed to increase the resources utilisation
of a computer system and to support multiple simultaneously interactive users
Compared to the operating system, which supports only sequential execution, the
multiprogramming system requires some form of CPU and memory management
strategies. which will be discussed in the next section.
Introduction to

Since operating system is a very large and complex software, supports a large number
of functions. It should be developed as a collection of several smaller modules with
carefully defined inputs, outputs and functions rather than a single piece of software. In
this section, we will examine different operating system structure.

2.4.1 Layered Structure Approach

The operating system architecture based on layered approach consists of a number of
layers (levels), each built on top of lower layers. The bottom layer is the hardware; the
highest layer is the user interface. The first system constructed in this way was the
THE system built by E.W. Dijkestra (1968) and his students. The THE system was a
simple batch operating system which had 32k of 27 bit words.
The system supported 6 layers (Figure 6).

Figure 6: The layered structure of THE operating system

As shown in Figure 6, layer 0 dealt with hardware; the higher layer 1 handled
allocation ofjobs to processor. The next layer implemented memory management.
Level 3 contained the device driver for the operator's console. By placing it, as well as
I10 buffering, at level 4, above memory management, the device buffers could be
placed in virtual memory. The 110 buffering was also above the operator's console, so
that VO error conditions could be output to the operator's console.
The main advantages of the layered approach is modularity which helps in debugging
and verification of the system easily. The layers are designed in such a way that it uses
operation and services only of a layer below it. A higher layer need not know how
these operations are implemented, only what these operations do. Hence each layer
hides implementation details from higher-level layers. Any layer can be debugged
without any concern about the rest of the layer.
The major difficulty with the layered approach is definition of a new level i.e. how to
differentiate one level from another. Since a layer can use the services of a layer below
it, it should be designed carefully. For example, the device driver for secondary memory
must be at a lower level than the memory management routines since memory
management requires the ability to use the backing store.

2.4.2 Virtual Machine

It is a concept which creates the illusion of a real machine. It is created bfa virtual
machine operating system that inakes a single real machine appear to be several real
machines. This type of situation is analogous to the communication line ofTelephone
Company, which enables separate and isolated conversations over the same wire(s).
Operating System The following Figure illustrates this concept.
Fundamentals &
A Real Machine

system OS



. l l C I I .







Disk Virtual
Input device

I Figure 7: Creation of several virtual machines by a single physical 111achine

I From the user's viewpoint, a virtual machine can be made to appear ve1.J.similar to an
existing real machine or they can be entirely different. An important aspect of this.
technique is that each user can run the operating system of his own choice. This fact
is depicted by OS, (Operating System I), OS,, OS, etc. as in Figure 7.

1 To understand this concept, let us try to understand the difference between

conventional multiprogramming system (Figure 8) and virtual tnacl~ine
multiprogramming (Figure 9). In conventional multiprogramming, processes are

allocated a portio~iof the real machine resources. The same machine resources are
distributed among several processes.

Conventional multi-
programming operating system

I 47 Figure 8: Conventional multiprogramming

Virtual Machine
Operating System

Virtual Virtual
Machine Machine
1 2 N

Figure 9: Virtual Machine Multiprogramming

In the virtual multiprogramming system, a single real machine gives the illusion of
several virtual machines, each having its own virtual processor, storage and I10
devices possibly with much larger capacities.
The virtual machine has many uses and advantages:

1) Concurrent running of dissimilar operating systems by different users.

2) Elimination of certain conversion problems.

3) Software development: Programs can be developed and debugged for machine

configurations that is different from those of host (for example virtual operating system
VM1370 can produce virtual 370 that are different from the real 370 such as larger
main memory).

4) Security and Privacy: The high degree of separation between independent

virtual machines aids in ensuring privacy and security. The most widely used operating
system in this category is VMl370. It manages IBMl370 computer and creates the
illusion that each of several users has a complete system 370 (including wide range of
110 devices) which can run different operating systems at once, each of them on its
own virtual machine.
It is also possible through software to share files existing on physical disk and much
information through virtual communication software.
The virtual machines are created by sharing the resources of the physical computer.
CPU scheduling can be used to share the CPU and make it appear that users have
their own processor. Users are thus given their own virtual machine. They can run on
their virtual machines any software desired. The virtual machine software is
concerned with multiprogram~ningmultiple virtual machines onto a physical machine
but need not consider any other software support from user.
The heart of the system, know11as the virtual machine monitor, runs on the bare
hardware and does the multiprogramming, providing not one, but several virtual
machines to the next layer up, as shown in Figure 7. However, unlike all other
operating systems, these virtual machines are not extended machines, with files and
other nice features. Instead, they are exact copies of the bare hardware, including
kernelluser mode, 110, interrupts, and everything else the real machine has.

Because each virtual machine is identical to the true hardware, each one can run any
operating system that will run directly on the hardware. In fact, different virtual
machines can, and usually do, run different operating systems. SOIIIC run one of the
descendants of OS1360 for batch processing, while other ones run a simple, single-
user, interactive system called CMS (Conversational Monitor System) for time-sharing
Operating System When a CMS program executes a system call, the call is trapped to the operating
Fmodamentals & system in its own virtual machine, not to VMl370; just as it would if it were running on
a real machine instead of a virtual one. CMS then issues the normal hardware 110
instructions for reading its virtual disk or whatever is needed to carry out the call.
These 110 instructions are trapped by VM1370, which then performs them as part of
its simulation of the real hardware. By making a complete separation of the functions
of multiprogramming and providing an extended machine, each of the pieces can be
mush simpler and more flexible.
The virtual machine concept has several advantages. Notice that there is complete
protection. Each machine is completely isolated from all other virtual machines, so
there is no problem with protection. On the other hand, there is no sharing. To provide
sharing, two approaches have been implemented. First, it is possible to share a
minidisk. This scheme is modeled after a physical shared disk, but implemented by
software. With this technique, files can be shared. Second, it is possible to define a
network of virtual machines, each of which can send information over the virtual
communications network. Again, the network is modeled after physical communication
networks, but implemented in software.
Such a virtual machine system is a perfect vehicle for operating systems research and
development. Normally changing an operating system is a difficult process. Since
operating systems are large and complex programs, it is difficult to be sure that a
change in one point does not cause obscure bugs in some other part. This situation can
be particularly dangerous because of the power of the operating system. Since the
operating system executes in monitor mode, a wrong change in a pointer could cause
an error that would destroy the entire file system. Thus, it is necessary to test all
changes to the operating system carefully.
But the operating system runs on and controls the entire machine. Therefore, the
current system must be stopped and taken out of use, while changes are made and
tested. This is commonly called system development time. Since it makes the system
unavailable to users, system development time is often scheduled late at night or on
A virtual machine system can eliminate much of this problem. System programmers
are given their own virtual machine and system development is done on the virtual
machine, instead of on a physical machine. The normal system operation seldom need
be disrupted for system development.

2.4.3 Client-Sewer Model

VM1370 gains much in simplicity by moving a large part ofthe traditional operating
system code (implementingthe extended machine) into a higher layer itself. VM1370
is still a complex program because stimulating a number of virtual 370s is not that
simple (especially ifyou want to do it efficiently).
A trend in modern operating systems is to take this idea of moving up into a higher
layers even further, and remove as much as possible from the operating system,
leaving a minimal kernel. The usual approach is to implement most of the operating
system functions in user processes. To request a service, such as reading a block of a
file, a user process (now known as the client process) sends the request to a server
process, which then does the work and sends back the answer.
In this model, shown in Figure 10, all that the kernel does is to handle the
communication between clients and servers. By splitting the operating system up into
parts, each part is made to handle one facet of the system, such as file service,
process service, and terminal service or memory service. This way, each part
becomes small and manageable. Furthermore, because all the servers run as user-
{nodeprocesses, and not in kernel mode, they do not have direct access to the Introduction to
hardware. As a consequence, if a bug in the file server is triggered, the file service Operating System
niay crash, but this will not usually bring the whole machine down.

1I Client I Client I Process I Terminal I ....... I File I Manay I


Figure 10: The Client-Server Model

Another advantage oftlie client-server model is its adaptability to use in distributed

systems (Figure 11). If a client communicates with a server by sending it messages,
the client need not know whether the message is handled locally in its own machine, or
whether it was sent across a network to a server on a remote machine. As far as the
client is concerned, the szme thing happens in both cases: a request was sent and a
reply came back.

Machine 1 Machine 2 Machine 3 Machine 4

Client File Process Terminal

----+ server server server
Kernel Kernel Kernel Kernel

Message from Client to Server

Figure 11: The Client-Server Model in a distributed System

'The picture painted above of a kernel that handles only the transport of messages from
clients to servers and back is not completely realistic. Some operating system functio~is
(such as loading commands into the physical 110 device registers) are difficult, if not
impossible, to do from user-space programs. There are two ways of dealing with this
problem. One way is to have some critical server processes (e.g., I10 device drivers)
actually run in kernel mode, with complete access to all the hardware, but still
communicate with other processes using the normal message mechanism.
The other way is to build a minimal amount of mechanism into the kernel, but leave
the policy decisions up to servers in user space. For example, the kernel might
recognize that a message sent to a certain special address means to take the contents
I of that message and load it into the I10 device registers from some disk, to start a disk
read. In this example, the kernel would not even inspect the bytes in the message to
see if they were valid or meaningful; it would just blindly copy them into the disk's
device registers. (Obviously some scheme for limiting such messages to authorized
. processes only must be used). The split between mechanism and policy is an important
concept; it occurs again and again in operating systems in various contexts.
2.4.4 Kernel Approach
Kernel is that part of operating system which directly makes interface with hardware

system. Its main functions are:

Operating System To provide a mechanism for creation and deletion of processes.
Fundamentals &
To provide processor scheduling, memory management and 110 management
To provide a mechanism for synchronisation of processes so that processes
synchronise their actions.
To provide a mechanism for interprocess communication.
The UNIX operating system is based on kernel approach (Figure 12). It consists of - ,

two separable parts: (i) Kernel (ii) System Programs.

As shown in the Figure 12, the kernel is between system programs and hardware.
The kernel supports the file system, processor scheduling, memory management and
other operating system functions through system calls. The UNIX operating system
supports a large number of system calls for process management and other operating
system functions. Through these system calls, the program utilises the services of the
operating system (kernel).

Figure 12: UNIX operating system structure

Check Your Progress 1

1) What is a system call?

2) Define the essential difference between:
a) Spooling
b) Buffering
Introduction to
Operating System

1 The drive for advanced operating systems has come from two directions. First, it has
I come from advances in the architecture of multicomputer systems and is now driven
by a wide variety of high-speed architectures. Hardware design of extremely fast
parallel and distributed systems is fairly well understood. These architectures offer
great potential for speed up but they also present a substantial challenge to operating
system designers. The following Figure I3 gives a broad classification of the
advanced operating system.
1C Advanced operating ..

Architecture driven ~ ~ ~ l i c a tdriven


Figure 13: Classification of Advanced OS

A second class advanced operating system is driven by applications. There are several
important applications that require special operating system support, as a requirement
as well as for efficiency. General-purpose operating systems are too broad in nature

time systems, have received considerable attention in the past and the operating system
issues for these systems have been extensively examined.
2.5.1 Architecture Driven Operating System
A brief discussion of three operating systems in the category of the Architecture

A network operating system is a collection of software and associated protocols that

allows a set of autonomous computers, which are interconnected by a computer network,
to be used together in a convenient and cost-effective manner. In a network operating
system, the users are aware of the existence of multiple computers and can log in to
remote machines and copy files from one machine to an other machine.
Some of typical characteristics of network operating systems which make it different
from a distributed operating system (discussed in the next section) are the followings:
Each computer has its own private operating system instead of running part of a
global system wide operating system.
I Each user normally works on hislher own system: using a different system
requires some kind of remote login, instead of having the operating system
, dynamically allocate processes to CPUs.
Users are typically aware of where each of their files are kept and must move
file from one system to another with explicit file transfer commands instead of
having file placement managed by the operating system.
Operating System The system has little or no fault tolerance; if 5% of the personal computers crash, only
Fundamentals & 5% of the users are out of business.
The network operating system offers many capabilities including:
Allowing users to access the various resources of the network hosts.
Controlling access so that only users in the proper authorization are allowed to
access particular resources.
Making the use of remote resources appear to be identical to the use of local
Providing up-to-the minute network documentation on-line.
As we said earlier, the key issue that distinguishes a network operating system from a
distributed one is how aware the users are of the fact that multiple machines are being
used. The visibility occurs in three primary areas; file system, protection and program

Distributed Operating System

Distributed operating systems are operating systems for a network of autonomous
computers connected by a communication network. A distributed operating system
controls and manages the hardware and software resources of a distributed system
such that its users view the entire system as a powerful monolithic computer system.
When a program is executed in a distributed system, the user is not aware of where
the program is executed or of the location of the resources accessed.

The basic issues in the design of a distributed operating system are the same as in a
traditional operating system, viz., process synchronisation, deadlocks, scheduling, file
systems, interprocess communication, memory and buffer management, failure
recovery, etc. However, several idiosyncrasies of a distributed system, namely, the
lack of both shared memory and a physical global clock, and unpredictable
communication delays make the design of distributed operating systems much more

Network operating systems focus on the use of remote services and resources
existing on a network of computer systems. Distributed operating systems focus on
effective utilization of resources in distributed computing environments.

Distributed systems provide many advantages concerning cost-effectivenessof both

computations and resources. The primary advantages are:

Resource sharing



Incremental growth

Resource sharing has been the main motivation for distributed systems. The
earliest form of a distributed system was a computer network which enabled the
use of specialized hardware and software resources by geographically distqnt
users. Resource sharing continues to be an important aspect of distributed systems
today. However, the nature of distribution and sharing of resources has changed
due to advances in networking technology. Sharing of resources is now equally
meaningful in a local area network (LAN), for example sharing laser printers in
the lab.
One aspect of reliability is availability of a resource despite failures in a system. A Introduction to
distributed environment can offer enhanced availability of resources through Operating System
redundancy of resources and communication paths. For example, availability of a disk
resource can be increased by having two or more disks located at different sites in the
system. If one disk is unavailable due to a disk or site failure, a program can use some
other disk. The availability of a data resource, e.g., a file, can be similarly enhanced by
keeping copies of the file at various sites in the system.

Communication between users at different locations is greatly facilitated using a

distributed system. There are two important aspects to communication. First, users
have unique id's in a distributed system. Their use in communication automatically
invokes the security mechanisms of the OS, thereby ensuring privacy and authenticity
of communication. Second, use of a distributed system also implies continued
availability of communication when users migrate to different sites of a system.

Distributed systems are capable of incremental growth, i.e., the capabilities of a system
(e.g. its processing power) can be enhanced at a price proportional to the nature and
size of the enhancement. A major advantage of this feature is that enhancements need
not be planned in advance. This is in contrast to the classical mainframe architectures
where enhancements often took the form of upgradation, that is, replacement of
subsystems by more powerful ones -hence enhancement costs tended ta be
disproportionate to the nature and size of an enhancement.

Distributed systems today cover a wide spectrum of computer hardware, software and
topological configurations; resource sharing services range from off-line access to real-
time access and topologies vary from locally distributed to geographically distributed.

Multiprocessor Operating Systems

A typical multiprocessor system consists of a set of processors that share a set of

physical memory blocks over an interconnection network. Thus, a multiprocessor
system is a tightly coupled system where processors share an address space. A
multiprocessor operating system controls and manages the hardware and software
resources such that users view the entire systems as a powerful uniprocessor system;
a user is not aware of the presence of multiple processors and the interconnection

The basic issues in the design of a multiprocessor operating system are the same as in
a traditional operating system. However, the issues of process synchronisation,task
scheduling, memory management, and protection and security become more complex
because the main memory is shared by many physical processors.

2.5.2 Application Driven Operating System

A brief discussion of three operating systems in the category of the Architecture
Driven OS follows:

Multimedia Operating System

The operating system is the shield of the computer hardware against all software
components. It provides a comfortable environment for the execution of programs, and
it ensures effective utilisation of the computer hardware. The operating system offers
various services related to the essential resources of a computer: CPU, main memory,
storage and all input and output devices.

For the processi~igof audio and video, multimedia application demands that humans
perceive these media in a natural, error-free way. These continuous media data
Operating System originate at sources like microphones, cameras and files. From these sources, the data
Fundamentals & are transferred to destinations like loudspeakers, video windows and files located at
the same computer or at a remote station. On the way from source to sink, the digital
data are processed by at least some type of move, copy or transmit operation. In this
data manipulation process there are always many resources which are under the
control of the operating system. The integration of discrete and continuous multimedia
data demands additional services from many operating system components.

The major aspect in this context is real-time processing of continuous media data.
Process management must take into account the timing requirements imposed by the
handling of multimedia data. Appropriate scheduling methods should be applied. In
contrast to the traditional real-time operating systems, multimedia operating systems
also have to consider tasks without hard timing restrictions under the aspect of

To obey timing requirements, single components are conceived as resources that are
reserved prior to execution. This concept of resource reservation has to cover all
resources on a data path, i.e. all resources that deal with continuous media. It also
may affect parts of the application that process continuous media data. In distributed
systems, for example, resource management also comprises nehrork capacity.

The communication and synchronization between single processes must meet the
restrictions of real-time requirements and timing relations among different media. The
main memory is available as a shared resource to single processes.

In multimedia systems, memory management has to provide access to data with a

guaranteed timing delay and efficient data manipulation functions. For instance,
physical data copy operations must be avoided due to their negative impact on
performance; buffer management operations (such as are known from communication
systems) should be used.

Database Operating System

Database systems place special requirements on operating systems. These

requirements have their roots in the specific environment that database systems
support. A database system must support: the concept of a transaction; operations to
store, retrieve, and manipulate a large volume of data efficiently; primitives for
concurrency control, and system failure recovery. To store temporary data and data
retrieved from secondary storage, it must have a buffer management scheme.

Real-time Operating System

The main characteristics of the real-time systems is the correctness of the

computation. This correctness does not apply to error-free computation, but also on
the time in which the result is processed and produced. Therefore, the real-time
systems must execute its critical workload in time to prevent failures. Examples of
applications requiring support of real-time systems are process control, air traffic
control, guidance of missile systems, etc.

Real-time systems also place special requirements on operating system, which have
their roots in the specific application that the real-time system is supporting. Adistinct
feature of real-time systems is that jobs have completion deadlines. A job should be
completed before its deadline to be of use (in soft real-time system) or to avert a
disaster (in hard real-time systems). The major issue in the design of real-time
operating systems is the scheduling ofjobs in such a way that a maximum number of
jobs satis@ their deadlines. Other issues include designing languages and primitives to
effectively prepare and execute a job schedule.
@= Check Your Progress 2 lntroduction to
Operating System
1) What are the basic design issues in the distributed operating systems.

2) What is the basic difference between Network operating systems and

Distributed operating systems.


Over the years, there has been a gradual evolution of operating system structure and
capabilities. However, in recent years a number of new design elements have been
introduced into both new operating systems and new releases of existing operating
systems that create a major change in the nature of operating systems. These modern
operating systems respond to new developments in hardware and new applications.
Among the key hardware drivers are mdtiprocessor machines, greatly increased
machine speed, high speed network attachments, and increasing the'size and variety
of memory storage devices. In the application arena, multimedia applications, Internet
and Web access, and clientjserver computing have influenced operating system
The rate of change in the demands on operating systems requires not just
modifications and enhancements to existing architectures but new ways of organising
the operating system. A wide range of different approaches and design elements has
been tried in both expiremental and commercial operating systems, but much of the
work fits into the following categories:
Microkernel architecture
Most operating systems, until recently, featured a large monolithic kernel. Most of
what is thought of as operating system functionality is provided in these large kernels,
including scheduling, file system, networking, device drivers, memory management and
more. Typically, a monolithic kernel is implemented as a single process with all
elements sharing the same address space. A microkernel architecture assigns only
a few essential functions to the kernel, including address spaces, interprocessor
communication (IPC), and basic scheduling. Other OS services are provided by
processes, sometimes called servers, that run in user mode and are treated like any
other application by the microkemel. This approach decouples kernel and server
development. Servers may be customised to specific application or environment
requirements.The microkernel approach simplifies implementation, provides flexibility,
and is well suited to a distributed environment. In essence, a microkernel interacts
with local and remote server processes in the same way, facilitating construction of
distributed systems.
Operating System 2.6.1 Microkernel Architecture
Fundamentals &
A microkernel architecture assigns only a few essential functions to the kernel,
including address spaces, interprocess communication (IEBC), and basic scheduling.
Other OS services are provided by processes, soinetimes called servers, that run in
user mode and are treated like any other application by the microkernel. This
approach decouples kernel and server development. Servers may be customised to
specific application or environment requirements. The microkernels approach
simplifies implementation, provides flexit-ility, and is well suited to a distributed
environment. In essence, a microkernel interacts with local and remote server
processes in the same way, facilitating constructio~lof distributed systems.

2.6.2 Multithreading
Multithreading is a technique in which a process executing an application is divided
into threads that can run concurrently. We can make the following distinction:
r, Threads: A dispatchable unit of work. It includes a processor context (which
includes the program counter and stack pointer) and its owl1 data area for a stack
(to enable subroutine branching). A thread executes sequentially and is
interruptable so that the processor can turn to another thread.
Process: A collection of one or more threads and associated system resources
(such as memory containing code and data, open files, and devices). This
corresponds closely to the concept of a program in execution. By breaking a
single application into multiple threads, the programmer has great control over the
modularity of the application and the timing of application related events.
Multithreading is useful for applications that perform a number of essentially
independent tasks that do not need to be serialised. An example is a database server
that listens for and processes numerous client requests. With multiple threads running
within the same process, switching back and forth among threads involves less
processor overhead than a major process switch between different processes.
Threads are also useful for structuring processes that are part of the OS kernel as
described in subsequent chapters.

2.6.3 Symmetric Multiprocessing

Until recently, virtually all single-user personal computers and workstations contained
a single general-purpose microprocessor. As demands for performance increase and
as the cost of microprocessors continues to drop, vendors have introduced computers
with multiple microprocessors. To achieve greater efficiency and reliability, one
technique is to employ symmetric multiprocessing (SMP), a term that refers to a
computer hardware architecture and also to the operating system behaviour that
reflects that architecture. A symmetric multiprocessor can be defined as a standalone
computer system with the following characteristics:
1) There are multiple processors.

2) These processors share the same main memory and I10 facilities, interconnected
by a communications bus or other internal connection scheme.
3) All processors can perform the same functions (hence the term Symmetric).
The operating system of an SMP schedules processes or threads across all of the
processors. SMP has a number of potential advantages over uniprocessor
architecture, including the following:
8 Pesformancc: If the work to be done by a computer can be organised so that
some portions of the work can be done in parallel, then a sysfe.-.,with multiple
processors will yield greater performance than one with a single processor of the Introduction to
Operating System
same type. With multiprogramming, only one process can execute at a time;
meanwhile all other processes are waiting for the processor. With
multiprocessing, more than one process can be running simultaneously, each on a
different processor.
Availability: In a symmetric multiprocessor, because all processors can perform
the same functions, the failure of a single processor does not halt the machine.
Instead, the system can continue to function at reduced performance.
Incremental growth: A user can enhance the performance of a system by
adding an additional processor.
Scaling: Vendors can offer a range of products with different price and
performance characteristics based on the number of processors configured in the
It is important to note that these are potential rather than guaranteed benefits. The
operating system must provide tools and functions to exploit the parallelism in an SMP
Multithreading and SMP are often discussed together, but the two are independent
facilities. Even on a uniprocessor machine, multithreading is useful for structuring
applications and kernel processes. An SMP machine is useful for non-threaded
processes, because several processes can run in parallel. However, the two facilities
complement each other and can be used effectively together.
An attractive feature of an SMP is that the existence of multiple processors is
transparent to the user. The operating system takes care of scheduling of threads
or processes on individual processors and of synchronisation among processors. A
different problem is to provide the appearance of a single system for a cluster of
I separate computers - a multicomputer system. In this case, we are dealing with a
collection of entities (computers), each with its own main memory, secondary
memory, and other I10 modules. A distributed operating system provides the illusion
I of a single main memory space and a single secondary memory space, plus other
unified access facilities, such as a distributed file system. Although clusters are
becoming increasingly popular, and there are many cluster products on the market,
I the state of the art for distributed operating systems lags that of uniprocessor and
SMP operating systems.
I The most recent innovation in operating system design is the use of object oriented
technologies. Object oriented design lends discipline to the process of adding modular
I extensions to a small kernel. At the operating system level, an object-based structure
enables programmers to customise an operating system without disrupting system
integrity. Object orientation also eases the development of distributed tools and a full-
blown distributed operating system.

The operating system is an essential component of system software, which
consists of procedures for managing computer resources. Initially computers were
operated from the front console. System software such as Assemblers, Loaders
and Compilers greatly helped in software development but also required substantial
setup time. To reduce the setup time an operator was hired and similar jobs were
batched together.
Batch systems allowed automatic job sequenting by a resident monitor and improved
the overall utilisation of systems greatly. The computer no longer had to wait for
human operations - but CPU utilisation was still low because of slow speed of I10
Operating System devic s compared to the CPU. A new concept buffering was developed to improve
Fundamentals &
syst m performance by overlapping the input, output and computation of a singlejob.
Spooling was another new concept in improving the CPU utilisation by overlapping
input of one job with the computation and output ofother jobs.
Operating systems are now almost always written in a higher-level language
(C, PASCAL, etc.). UNIX was the first operating system developed in C language.
This feature improves their implementation, maintenance and portability.
The operating system provides a number of services. At the lowest level, there are
system calls, which allow a running program to make a request from the operating
system directly. At a higher level, there is a command interpreter, which supports a
mechanism for a user to issue a request without writing a program.
In this unit, we began with tracing the evolution of the operating system through serial
processing, batch processing and multiprogramming. We also presented different
operating system models: Layered structured, Kernel based, virtual machine system
and client server model.
At the end we presented classification and characteristics of emerging operating

Check Your Progress 1

1) System calls provide the interface between a running program and the operating
system. User programs receives OS services through the set of system calls.,
2) Both buffering and spooling are used to improve system performance. Buffering
overlaps input, output and processing of a singlejob whereas spooling allows
CPU to overlap the input of the job with computation and output of another jabs.
Spooling is better than buffering.
Check Your Progress 2
1) The basic design issues of a distributed operating system are the ~alneas in a
conventional operating system, viz., process synchronisation, deadlocks,
scheduling, file systems, interprocess communication, memory and buffer 1

management, failure recovery, etc., but what makes its design complexity are the
lack of shared memory and common physical global clock and unpredictable
communication delays.
2) The basic difference between the two is that the network operating system I
focuses on the use of remote services and resources existing on a network
operating system whereas the distributed operating system focuses on the
effective utilisation of resources on distributed environment.


1) Operating System Concepts by Abraham Silberschatz and James L. Peterson,

Addision Wesely.
2) Operating Systems Design and Implenlentation by Andrew S . Tanenbaum,
Prentice Hall of India.
Structure Page Nos.
3.0 Introduction 55
3.1 Objectives 56
3.2 Why Computer Networks? 56
3.3 The Topologies 57
3.4 Characteristics of the OSI Layers 59
3.5 OSI Model and Communication Between Systems 60
3.6 Interaction Between OSI Model Layers 60
3.7 Protocols 60
3.8 Types of Networks 61
3.8.1 Local Area Networks (LANs)
3.8.2 Metropolitan Networks (MANS)
3.8.3 Wide Area Networks (WANs)
3.9 Medium
3.10 Data Flow
3.11 Physical Connection
3.12 Transmission Media
3.13 Connecting Devices
3.13.1 Repeaters
3.13.2 Hubs
3.13.3 Bridges
3.13.4 Routers
3.13.5 Gateways
3.14 Summary 84
3.15 Solutions/Answers 84
3.16 Further Readings 86

A network can consist of two computers connected together on a desk or it can
consist of many Local Area Networks (LANs) connected together to form a Wide
Area Network (WAN) across a continent. In simple terms it is an interconnected set
of some objects. For decades, we have been familiar with the Radio, Television,
Railways, Banks and various other types of networks. In recent years, the computer
network, a new form of network is becoming more and more visible in our day-to-day
life. A computer network is an interconnected set of autonomous computers.
Autonomous means each of them can function independent of others, i.e., each
computer has individual processors. Simply we can say each computer (terminal,
node) should not be a dump terminal. The key is that two or more computers are

. .

send and receive back information more quickly.

After going through this unit, you should be able to:
define what a network is?
understand what is the need of a computer network and the applications of networks;
list types of networks. topologies and mediums finally, and
how devices are connected though repeater, bridges, router, Gateway.

a) Communication medium: It offers a powerful communication medium among a

group of people widely separated on the earth.

b) Resource Sharing: Resources like files, printers, hard drives, or CPU can be
shared throu~ha com~uternetwork.


d) Higher flexibility: A heterogeneous system can be connected in a computer

network, by which users get better flexibility.

Applications of computer network
a) Electronic Mail (e-mail or Email). The most widely used network application is
E-mail, which is forwarding of electronic files to an electronic post office for the
recipient to pick up.
b) Scheduling programs allow people across the network to schedule appointments
directly by calling up their fellow worker's schedule and selecting a time!
c) Videotext is the capability of having a two-way transmission of picture and sound.
Games like distance education lectures, etc. use videotext.
d) Groupware is the latest network application. It allows user groups to share
documents, schedules databases
e) Teleconferencingallows people in different regions to "attend" meetings using
telephone lines.

f) Automated Banking Machines allow banking transactions to be performed

everywhere: at grocery stores, drive-in machines etc.

h) Teleco~nmutingallows employees to perform office work at home by "Remote

Access" to the network.

i) Value Added Networks are common carriers such 'as ERNET, Satyam ,VSNL
etc. (they can be private or public companies) who provide additional leased line
connections to their customers. These can be Frame Relay, ATM (Asynchronous
Transfer Mode), X.25, etc.

(i) Marketing and sales Marketing professionals use computer network to collect,
Introduction to
Networking Concept
exchange and analyse data relating to customer needs.

The topology is the geometric arrangement (either physically or logically) ofthe linking
devices (usually called nodes) and the links, connecting the individual computers or nodes
together. Five basic topologies:
I) Bus topology
2) Ring topology
3) Star topology
4) Mesh topology
5) Combined topologies.
1) The Bus Topology
1n the bus topology there is a single bus that carries all the data to the entire network.
A bus is a single continuous communication cable to which all the computers are
connected. A cable or bus runs throughout tlie office to which all the workstations are
connected. The bus topology is also kiiow~ias linear bus.
When one workstation wants to talk to another the message or signal travels down the
bus in both directions. Each one reads the message to see if it matches its address.
The bus topology is a passive topology. It means that the computers connected to the
bus amplify the signal on the bus.
The main advantage of bus topology is that it is quite easy to set up. Any workstation
can be easily moved to another location as bus runs throughout the office. Another
benefit of this layout is that if one computer on the bus fails, it does not affect the rest
of the traffic on the bus.
A network with bus topology cannot become too big as all the traffic is on a single bu;.
The entire network can be down only if the bus has a break. The open ends of bus
must be terminated to prevent signal bounce. If one or both ends of the bus are not
terminated, the whole network can be down.
Disadvantages include difficult reconfiguration and fault isolation I
2) The Ring Topology
In the ring topology all the workstations are connected in the shape of a ring. The ring
does not have an end. It is made up of short segments that' connect one PC to the next
and so on, until all the computers are joined in a circle. The signals travel only in one
direction and from one PC to tlie next until it reaches the appropriate node. It is also
difficult to move a workstation or to add more computers to an existing ring.
In ring topology the wiring for a ring could be arranged in a circle throughout a building
or a group of buildings. The signal travels in one direction only from one computer to
the next. The ring topology is an active topology. Each computer boosts the signal (like
a repeater) and passes to the next computer till it reaches the destination computer. A
drawback of this topology is that if one computer fails, tlie entire network is down.
Iiowever, now some ring networks are so designed that a faulty workstation is
automatically bypassed. Another drawback is that the traffic is in only one direction.
This topology is not used for a large number of nodes.
--- -

Operating System 3) The Star Topology

Fundamentals &
Networking In tlie star topology all the stations are connected to a central computer or hub
creating a star configuration. The devices are not directly linked to each other
Messages pass from the nodes to the hub, where they are processed or passed along
to another node. The hub controls the traffic on tlie network. If the hub fails, the
entire network becomcs inoperative, but if a node fails it does not affect the rest of
the traffic on the network.
All clientlserver networks use this topology. But since cable from each node must
be connected to a central hub, tlie length of total wiring required increases very
much. A hub can be an active hub or a passive hub. A passive hub simply organizes
the wiring and works just like a wiring panel for various connections. It does not
need any power connection. An active hub does what a passive hub does, but
besides this it regenerate and retransmits the signals the way a repeater does. An
active hub needs a power connection.
4) Mesh Topology

In a mesh topology, every node has a dedicated point-to point link to every other
node. Simply dedicated means that the links carry traffic only between the two nodes.
So mesh topology does not have traffic congestion proble~nsevery node has n-1
link,for a fully connected mesh topology Iiaviug n nodes. So the total number of links
will be 11 (n-I).This also means that every node has (n-1) 110 ports.
Advantages of Mesh topology

1) Use of dedicated links guarantees that each connection can carry its own data
load. Thus eliminates the traffic problem.

2) If one link fails, it does not affect the rest of network. This means it is robust.
3) Point to point links make fault identification and fault isolation easy.

4) Privacy or security is high, since the other link cannot gain access to the
dedicated link where the message is travelling.

Disadvantages of mesh topology

1) More cabling and I t 0 ports are required, because every node must be connected
to every other node.

2) Cost is very high, because more number of node and cabling required.

3) Installation and reco~lfigurationis difficult.

5) Combined Topologies
A network does not have to stick with one topology. Any two topologies or all the
topologies can be used in a network. For example, a hub may be connected to other
hubs using a bus and the workstations may be connected by a star.
Two maln hybrid topologies are:

1 ) The Star Bus Topology

The star bus topology is a cornbination of bus and star topologies. I11 this topology the
hubs of many star topology networks are linked together with a linear bus or trunk. or
example, we want to link three star topology ~etworkstogether. In each network, the
nodes are connected to its own hub. Thus we have three hubs. These three hubs are
connected by a bus topology.
2) The Star Ring Topology Introduction to

three hubs of the networks are connected to a fourth hub (main hub) in star pattern.


There are primarily two architectural models for designing computer networks. OSI
model & TCPIIP model. In this section we shall discuss one such model.
The seven layers of the OSI reference model can be divided into two categories:
upper layers and lower layers.
The upper layers of the OSI model deal with application issues and generally are
implemented only in software. The highest layer, the application layer, is czosest to the
end user. Both users and application layer processes interact with software
applications that contain a communications component. The term upper layer is
sometimes used to refer to any layer above another layer in the OSI model.
The lower layers of the OSI model handle data transport issues. The physical layer
and the data link layer are implemented in hardware and software. The lowest layer,
the physical layer, is closest to the physical network medium (the network cabling, for
example) and is responsible for actually placing information on the medium.
Figure I illustrates the division between the upper and lower OSI layers.

Application Presentation

Figure 1: Two Sets of Layers Make Up the OSI Layers

Each layer bas well defined filnctionalities and standard protocols for implementing
thes fuoctionalities.

Information being transferred from a software application in one computer system to a
software application in another must pass through the OSI layers. For example, if a
software application in System A has information to transmit to a software application
Operating System ' in System B, the application program in System A will pass its information to the
Fundamentals & application layer (Layer 7) of System A. The application layer then passes the
information to the presentation layer (Layer 6), which relays the data to the session
layer (Layer 5 ) , and so on down to the physical layer (Layer 1). At the physical layer,
the information is placed on the physical network medium and is sent across the
medium to System B. The physical layer of System B removes the information from
the physical medium, and then its physical layer passes the information up to the data
link layer (Layer 2), which passes it to the network layer (Layer 3), and so on, until it
reaches the application layer (Layer 7) of System B. Finally, the application layer of
System B passes the information to the recipient application program to complete the
communication process.


A given layer in the OSI model generally communicates with three other OSI layers:
the layer directly above it, the layer directly below it, and its peer layer in other
networked computer systems. The data link layer in System A, for example,
communicates with the network layer of System A, the physical layer of System A,
and the data link layer in System B. Figure 2 illustrates this example.

Figure 2: OSI Model ~ a ~ e Communicate

r; with Other Layers

Just like human beings need to have a common languages to speak to one another,
digital devices and computers also need to have common 'languages' to be able to
communicate with one another. The binding function of 'common language' in cirg~tal
communication is performed by communication protocols.

connected but not communicating,just as a person speaking Hindi cannot be

understood by a person who speaks only Tamil.
A protocol defines the following three aspects of communication.

1) Syntax: The'format of data being exchanged, character set used, type of error
correction used, type of encoding scheme (e.g., signal level) being used. For
example, a simple protocol may use first eight bit for address of sender, the
second eight bit for address of receiver and the rest of bit for message itself.

2) Semantics: Type and order of messages used to ensure reliable and error free
information transfer.
3) Timing: Define data rate sejection and correct timing for various events during Introduction to
data transfer. Simply when data should be sent and how fast they can be sent. Networking Concept

It has been accepted that the complexity of writing cornrnunication software can be
reduced by adapting the principle of protocol layering. The idea here is to partition
communication functions into a vertical set of layers. Each layer performs a related
set of functions. Division of work between layers is done in such a way that they are
manageable and provide a logical interface and break point. Each communication
layer provides certain services to layers above it and relies on the next lower layer to
perform more primitive functions. Each layer hides internal details from other layers.
Thus dividing the communication problem into several layers reduces its complexity
and makes the work of developing cornrnunication software a lot easier and error

The differences among different types of computer networks are usually based on
perspective. For example, computer networks are frequently classified by the geographical
area (LAN, MAN, WAN), their topologies (e.g., point to point or broadcast),or the type
of communication path they use and the manner in which data are transmitted across
this path (e.g., circuit-switched and packet-switched).
Computer networks are classified by the geographical area are:
1) Local Area Networks (LANs)
2) Metropolitan Network (MANS)

, 3) Wide Area Networks (WANs)

3.8.1 Local Area Networks (LANs)

LANs (local area networks), as show11in Figure 3 are privately-owned networks that
connect computers and resources together in a building or buildings that are close
together. LAN plays an important part in everyday functioning of schools, businesses,
and government.

Ethernet Bridge

Figure3: Local Area Network in a building

A LAN is a high-speed data network that covers a relatively small geographic area. It
typically connects workstations, personal computers, printers, servers, and other
devices, so that devices can communicate with each other to share resources. LANs
offer computer users many advantages, including shared access to devices and
applications, file exchange between collnected users, and communication between
users via electronic mail and other applications.
A Local Area Network is a system of computers that share resources such as disk
drives, printers, data, CPU power, fadmodem, applications, etc. They usually have
distributed processing, which means that there are many desktop computers
distributed around the network and that there is no central processor machine
Operating System Location: In a building or individual rooms or floors of buildings or nearby buildings.
Fundamentals & Can be campus wide like a college or university.
LAN Characterisation
There are four key areas that characterise a local area network.
These are:
1) Transmission Medium a

2) Access Method
3) Topology
4) SignalingTechniques
LAN ~ e d i a - ~ c c e dMethods
Media contention occurs when two or more network devices have data to send at the
same time. Because multiple devices cannot talk on the network simultaneously, some
type of method must be used to allow one device access to the network media at a
time. This is done in two main ways: carrier senses multiple accesses collision detect
(CSMAICD) and token passing.
In networks using CSMAICD technology such as Ethernet, network devices contend
for the network media. When a device has data to send, it first listens to see if any
other device is currently using the network. If not, it starts sending its data. After
finishing its transmission, it listens again to see if a collision occurred.A collision occurs
when two devices send data simultaneously.When a collision happens, each device
waits a random length of time before resending its data. In most cases, a collision will
not occur again between the two devices. Because of this type of network contention,
the busier a network becomes, the more collisions occur. This is why performance of
Ethernet degrades rapidly as the number of devices on a single network increases.
In token-passing networks such as Token Ring and FDDI, a special network packet
called a token is passed around the network from device to device. When a device has
data to send, it must wait until it has the token and then send its data. When the data
transmission is complete, the token is released so that other devices may use the
network media. The main advantage of token-passing networks is that they are
deterministic. In other words, it is easy to calculate the maximum time that will pass
before a device bas the opportunity to send data. This explains the popularity of token-
passing networks in some real-time environments such as factories, where machinery
must be capable of communicating at determinable intervals.
For CSMAICD networks, switches segment the network into multiple collision
domains. This reduces the number of devices per network segment that must contend
for the media. By creating smaller collision domains, the performance of a network can
be increased significantly without requiring addressing changes.
Normally CSMAICD networks are half-duplex, meaning that while a device sends
information, it cannot receive at the same time. While that device is talking, it is
incapable of also listening for other traffic. This is much like a walkie-talkie. When one
person wants to talk, he presses the transmit button and begins speaking. While he is
talking, no one else on the same frequency can talk. When the sending person is
finished, he releases the transmit button and the frequency is available to others.
When switches are introduced, full-duplex operation is possible. Full-duplex works
much like a telephoneyou can listen as well as talk at the same time. When a
network device is attached directly to the port of a network switch, the two devices
may be capable of operating in full-duplex mode. In full-duplex mode, performance can
be increased, but not quite as much as some like to claiin.. However, full-duplex
operation does increase the throughput of most applications because the network
media is no longer shared. Two devices on a full-duplex connection can send data as Introduction to
soon as it is ready. Networking Concept

Token-passing networks such as Token Ring can also benefit from network switches.
In large networks, the delay between turns to transmit may be significant because the
token is passed around the network.
LAN Transmission Methods
For Transmission, LAN usually broadcast their message to all hosts on the LAN The
address in the packet or frame enables the destination to receive the packet, while the
rest of the hosts ignore the broadcast message.
LAN data transmissions fall into three classifications: unicast, multicast, and
broadcast. In each type of transmission, a single packet is sent to one or more nodes.
In a unicast transmission, a single packet is sent from the source to a destination on a
network. First, the source node addresses the packet by using the address of the
destination node. The package is then sent onto the network, and finally, the network
passes the packet to its destination.
A multicast transmission consists of a single data packet that is copied and sent to a
specific subset of nodes on the network. First, the source node addresses the packet
by using a multicast address. The packet is then sent into the network, which makes
copies of the packet and sends a copy to each node that is part of the multicast
A broadcast transmission consists of a single data packet that is copied and sent to all
nodes on the network. In these types of transmissions, the source node addresses the
packet by using the broadcast address. The packet is then sent on to the network,
which makes copies of the packet and sends a copy to every node on the network
Topology: The most common LAN topologies are bus, ring, and star.
3.8.2 Metropolitan Networks (MANs)
Metropolitan Area Networks (MANs), as shown in Figure 4, are networks that
connect LANs together within a city.


Figure 4: MANS use Local Exchange Carriers

The main criterion for a MAN is that the connection between LANs is through a local
exchange carrier (the local phone company) . The protocols that are used for MANs
are quite different from those used for LANs (except for ATM, which can be used for
both under certain conditions). It has been distinguished as a separate type of
network; because of the specific standard known as Distributed Queue Double Bus
(DQDB) that has been adopted for MAN. The DQDB comprises two unidirectional
buses for connecting computers.

A Metropolitan Area Network is a system of LANs connected throughout a city

(Figure 5) or metropolitan area. MAN can be considered as a bigger version of a
I Operating System
Fundamentals &
LAN, typically covering a city. It can be either public or privately owned. MANS have
the requirement of using telecommunication media such as voice channels or data
channels. Branch offices are connected to head offices through MANs. Examples of
organizations that use MANs are universities and colleges, hotels, and banks.

Figure 5: Location: Separate buildings distributed throughout a city

3.8.3 Wide Area Networks (WANs)

Wide Area Networks (WANs) connect LANs together between cities (Figure 6).

Communication is usually done through public communication systems such as

telephone line, fiber optic cable or wireless technology.

T ,T I Router Router

Figure 6: WANs use Long Distance Carriers

A Wide Area Network $ 1 .i tlctwork system connecting cities, countries, or continents

together Figure 7. WANs Jr c: c o n ~ i e cc d :wether using one of the telecommunications

Figure 7: City to city, across a country or across a continent.
The rnairi difference between a MAN and a WAN is that the WAN uses Long Distance Introduction to
Carriers. Otherwise the same protocols and equipment are used as in MAN. Networking Concept

Main differences between a LAN and a WAN are given in the following Tablel.
Tablel: Difference between LAN and MAN
Wide area Network Local Area Network

Distance up to thousands of Kilometer Within a local site

Typical data rates between 9.6k to High band widtli between 1- 16 M bps
Higher error rates (1 in lo5 )
Lower error rate (1 in 109)
Often use analog circuits from the
telephone systems Use digital signaling over private cables
Generally use bus or ring topology

Generally has point -to-point link with the same which

common topologies mesh and star owns the computers connected to LAN

May be managed by organizations LAN uses simple protocols and does not
independent of users employ any retransmission strategy for
lost frames
WAN uses complex protocols and
extej~siveerror recovery mechanisms Number of host on a LAN is limited
(usually up to 1024)
Number of node coinputers has no
theoretical limit and could be very large.
Tile practical limit comes from address-
ing schemes used to ide~itifjrindividual
system on the network and other
resource constrains.

Data communication system k made up of following components (Figure 8).

Source1 Host1
Sender Receiver


Figure 81 O r t r Communication-1


Source Sender: Sender can be Terniinals, Computers, Mainframes, workstation,

teleohone hand set. video camera. Main function of sender is to send data (message)

The com~nunicationsstream through which the data is being transmitted. Examples I

are: 65
Operating System Cables
Fundamentals &
Networking Microwave Link
Fiber optic Link
Radio Frequencies (RF)
Infrared Wireless
Receiver: The receiver receives the message (data) from sender. Receiver can be
Terminals, Computers, Mainframes, workstation, telephone hand set, printer, television
and so on.
Protocol: .A con~municationprotocol is a set of conventions or rules that must be
adhered to by both communicating parties to ensure that information being exchanged
between two parties is received and interpreted correctly.
Message: Message consists of text, numbers, pictures, sound, or video-or any
combination of these to be transmitted from sender to receiver.


1I I I
Source/ I I Host,
Sender 1 I Receiver


Figure 9 : Data Communication-I1

DCE: The interface between the Source and the Medium, and the Medium and the
Receiver is called the DCE (Data Communication Equipment) (Figure 9) and is a
physical piece ofequipment.
DTE: Data Terminal Equipment is the telecommunications name given to the source
and receiver's equipment. Tt is any device that is a source of or destination for binary
digital data.
The DTE generates the data and passes them, through DCE. The DCE takes the generated
data by DTE and converts them to an appropriate signal. Then this signal is introduced to
telecommunication link. Most commonly used DCE is a modem, discussed in the section.

Data flow (transir7ission mode) is the flow of data between two points.
There are three types of dataflow (Figure 10): simplex, half duplex and full duplex.
Simplex: data flows in only one direction (Figure 11) on the data communication line
(medium). Examples are radio and television broadcasts. They go from the TV station Netw
to your home television.


station 1 One direction


Figure 11: Simplex


Half-Duplex: Data flows in both directions but only one direction at a time (Figure 12)
on the data communication line. Each of the stations can both transmit and receive. For
example; a conversation on walkie-talkie is a half-duplex data flow. Each person takes
turns talking. If both talk at once - nothing occurs!

Figure 12: Half-Duplex

Bi-directional but only one direction at a time!

Full-Duplex: data flows in both directions at thc same time (Figure 13).The system is
configured to flow data in bath directions.

Figure 13: Full Duplex

Bi-directional both directions simultal~eously!
Networking Another example of full duplex is two-way street with traffic flowing in both directions.
at the same time.


A modem (MOdulator/DEModulator) connects a terminal/computer (DTE) to the

Voice Channel (dial-up line).

Voice Channel
(Phclne Line)

Figure 14: Modems

Basic Definition

The modem (DCE - Data Communication Equipment) is connected between the

terminal/computer (DTE - Data Terminal Equipment) and the phone line (voice
channel). Amodem converts the DTE (Data Terminal Equipment) digital signal to an
analog signal (or vice versa) that the voice channel can use.

Amodem is connected to the terminal/computer's RS-232 serial port ( 2 5 pin male D

connector) and the outgoing phone line with an RJI I cable connector (the same as on
a telephone extension cord). Male connectors have pins, female connectors have

Digital Connection

The connection between the modem and terminal/computer is a digital connection. A

basic connection consists of a Transmit Data (TXD) line, a Receive Data (RXD) line
and many hardware handshaking control lines (Figure 15).

T@XD(2) T'xD O
RXD (3).

Contrd Lines Modem

The control lines determine whose turn it is to talk (modem or terminal), ifthe terminal1 Introduction to
Networking Concept
cbmputer is turned on, if the modem is turned on, if there is a connection to another
modem, etc.
Analog Connection
The connection between the modem and the outside world (the phone line) is an analog
connection (Figure 16).The voice channel has a bandwidth of 0-4 kHz but only 300 -
3400 Hz is usable for data communications.


Voice Band

Figure 16: Analog Connection

The modem converts digital information into tones (frequencies) for transmitting
through the phone lines.
ExternalIInternal Modems
There are 2 basic physical types of mode'ms: Internal & External modems. External
modems (Figure 17) sit next to the computer i~ndconnect to the serial port using a
straight-through serial cable.

Serial Cable

Figure 17: Exter~~al


Internal modems (Figure 18) are a plug-in circuit board that sits inside the computer. It
incorporates the serial port on-board. They are less expensive than external modems
because they do not require a case, power supply and serial cable. They appear to the
communication programs as if they were an external modem for all practical purposes.
------- a if~ it
Internal ~ ~ d Ie *n ~~ p as
were an External

Figure 18: Internal Modems

Operating System Modem Types
Fundamentals &
Netwnrkin~ There are many types of modems, the most common of which are:

called a media adapter or transceiver).

(2) Short Haul Modem: A modem used to transmit data over 30 km or less. Modems
we use at home or to connect computers together among different offices in the
same building are short haul modems.

(3) Acoustic Modem: A modem that couples to the telephone handset with what looks
like suction cups that contain a speaker and microphones. Used by travelling sales
people to connect to hotel phones.

(4) Smart Modem: A modem with a CPU (microprocessor) on board that uses the
Hayes AT command set. This allows auto-answer & dial capability rather than
manuallv dialine & answering.

for transmission. (Also called a media adapter or transceiver).

(6) V.32 Modem: A milestone modem that uses a 2400-baud modem with 4 bit
encoding. This results in a 9600 bps (bits per second) transfer rate.

Baud (Figure 19) is the speed at which the analog data is changing on the voice
channel and bps is the speed at which the decoded digital data is being transferred.

Features of Modems

(1) Speed: The speed at which the modem can send data in bps (bits per second).


(2) Auto DialIRe Dial: Smart modems can dial the phone number and auto re dial if a
busy signal is received.

(3) Auto Answer: Most modems have Ring Detect capability and can automatically
answer the telephone when an incoming call comes in.

(4) Self-Testing: Newer modems have self-testing features. They can test the digital
connectio~~ to the terminallcomputer and the analog connection to a remote
modem. Thcv call also check the modem's internal electronics.
(5) Voice Over Data: Voice Over Data modems allow a voice conversation to take
place while data is being transmitted. This requires both the source and
destination modems to have this feature.
Introduction to
Networking Concept I
(6) Synchronousor Asynchronous Transmission: Newer modems allow a choice of
synchronous or asynchronous transmission of data. Normally, modem
transmission is asynchronous (we send individual characters with just start and
stop bits). Synchronous transmission or packet transmission is used in specific

The physical connection determines how many bits (1's or 0's) can be transmitted in
a single instance of time. If only 1 bit of information can be transmitted over the
data transmission medium at a time then it is considered a serial communication


I ~ i arr a rime
1 bit at a time

If more than 1 bit of information is transmitted over the data transmission medium at a
time then it is considered a parallel communication (Figure 21). By grouping, we can
send data n bits at a time instead of one, through n wires.

Data Traosm~ssionMedium - 8 W i n s
0- 0-
Sends ~n ~n Receives
Parallel Data 0- 0- Parallel Data
8bitsatarime 0- 0- 8 bits at a tin
Byte: OlM 1010 ~n
1J l Byte: 0100 1010
Separate wire D- Separate w i r ~
for each bit! 0- for each bit!

Communications Advantages Disadvantages

Parallel Fast Transfer Rates Short distances only More cost

due to more number of lines
Serial Long Distances Slow transfer rates Less cost due
to only one line required for
Operating System
The transmission media provide the physical path for communication among the nodes.
I11 a computer network, where all the nodes are geometrically interconnected, it is
known as its topology.
Transmission media can be broadly categorised in to two types: guided and unguided
(Figure 22).



Figure 22: Type of Transmission Media

Guided transmission uses a cabling system that guides the data signals along a specific
path. The data signals are bound by the cabling system. Guided media is also known as
bound media. "Cabling" is meant in a generic sense, and is not meant to be interpreted
as copper wire cabling only. Guided media are commonly used for point-to-point
connection. The cllaracteristics of the medium mainly decide the nature and quality of
transmission. Guided media are commonly used for LAN application.

Unguided transrr~issionmedia also called wireless communication consists of a means

for the data signals to travel but nothing to guide them along a specific path. The data
signals, not bound to a cabling media transport electromagnetic waves without using a
physical conductor and are therefore often called unbound media. Unguided media are
commonly used for broadcast type communication. Some examples of unguided media
are sea water, free space and air. Unguided media are commonly used for WAN

Transmission Media Guided

There are 4 basic types of guided media:

a) Open Wire

b) Twisted Pair

C) Coaxial Cable

d) Optical Fiber

Open Wire

Open wire 1s (Figure 23) traditionally used to describe the electrical wire strung along
power poles. There is a single wire strung between poles. No shielding or protection
from noise interference IS used. We are going to extend the traditional definition of
open wire to include any data signal path without shieldingor protection from noise
' interference. This can include multi conductor cables or single wires. This medium is
susceptible to a large degree of noise and interference and consequently is not
acceptable for data transmission except for short distalices of less than 20 ft.

Figure 23: Open Wire

Twisted Pair

The wires in twisted pair (Figure 24) cabling are twisted together in pairs. Each pair
consists of a wire used for the +ve data signal and a wire used for the -ve data signal.
Each pair is twisted together to minimize electromagnetic interference between the
pairs.Ar1y noise that appears on 1 wire of the pair will also occur on the other wire.
Because the wires are opposite pojarities, they are 180 degrees out of phase (180
degrees - phasor definition of opposite polarity). When the noise appears on both
wires, it cancels or nulls itself out at the receiving end.

Jacket Twisted Pair Bare wice

Figure 24: Unshielded Twisted Pair

The degree of reduction in noise interference is determined specifically by the number

of turns per foot. Increasing the number of turns per foot reduces the noise
interference. To further improve noise rejection, a foil or wire braid "shield" is woven
around the twisted pairs. This shield (Figure 2.5) can be woven around individual pairs
or around a multi-pair conductor (several pairs).

Jacket Shield Twisted Pair

Figure 25: Shielded Twisted Pair

Operating System Shielded Twisted Pair
Fundamentals &
Networking The twisted-paircan be shielded (Figure 25) with metallic braid, to reduce the
interference Cables with a shield are called shielded twisted pair and are commonly
abbreviated STP. Cables without a shield are called unshielded twisted pair or UTK
Twisting the wires together results in characteristic impedance for the cable. Typical
impedance for UTP is 100 ohm for Ethernet 10BaseT cable.
UTP or unshielded twisted pair cable is used on Ethernet 1OBaseT and can also be
used with Token Ring. It uses the RJ line of connectors (RJ45, RJ11, etc.)
Use Twisted pair can be used for both analog and digital communication. Twisted pair
cables are most effectively used in systems that use a balanced line method oftransmission:
polar line coding (Manchester Encoding) as opposed to unipolar line coding (TTL logic).
Most popular use of twisted pair is in our oldest telephone system. It is also used in LAN
for point-to point short distance communication

Coaxial Cable

Coaxial cable (Figure 26) consists of two conduotors. The inner conductor is held I

inside an insulator with the other conductor woven around it providing a shield. An
insulating protective coating called a jacket covers the outer conductor.

Jacket Shield Insulator Center

The outer shield protects the inner conductor from outside electrical signals. The
distance between the outer conductor (shield) and inner conductor plus the type of
material used for insulating the inner conductor determine the cable properties or
impedance. Typical impedances for coaxial cables are 75 ohms for Cable TV, 50 ohms
for Ethernet Thinnet and Thicknet. The excellent control ofthe impedance
characteristics of the cable allow higher data rates to be transferred than with twisted
pair cable.
Optical fiber
Optical fiber consists of thin glass fibers that can carry information at frequeit-ies in
the visible light spectrum and beyond. The typical optical fiber consists of a very

Typically Cladding has a diameter of 125 microns. Coating the cladding is a protective
coating consisting of plastic, it is called the Jacket.
Optical fibers work on the principle that the core refracts the light and the cladding.
reflects the light. The core refracts the light and guides the light along its path. The

Advantages of Optical Fiber

Noise immunity: RFI and EM1 immune (RFI - Radio Frequency Interference,
EM1 -Electromagnetic Interference) because fiber -optic transmission uses light
rather than electricity, noise is not a factor.

74 Security: cannot tap into cable.

Large Capacity due to BW (bandwidth). Introduction to
Networking Concept
No corrosion.
Longer distances than copper wire.
Smaller and lighter than copper wire.
Faster transmission rate.
Disadvantages of optical fiber
Physical vibration will show up as signal noise!
Limited physical arc of 'cable. Bend it too much and it will break!
Difficult to splice.
The cost of optical fiber is a trade-off between capacity and cost. At higher
transmission capacity, it is cheaper than copper. At lower transmission capacity, it is
more expensive.
Infrared (IR) transmission is another line of sight medium .Infrared technology uses
electromagneticradiation of wave lengths between radio waves and visible light, operation
between 1OOGHZ and 1OOTHZ (terahertz). Tliese frequencies are very high offering
nice data transfer rates. We are used to seeing infrared technology utilised for our television
or VCR remotes. IR is generally restricted to LAN within or between buildings

I) Higher bandwidth means superior throughput to radio

2) Inexpensive to produce

3) No longer limited to tight interroom line-of-sight restrictions

1) Limited in distance

2) Cannot penetrate physical barriers like walls, ceilings, floors, etc.


As companies grow, so do their networks. When a network outgrows its original
design, the network becomes slow and print jobs take longer to be completed. In such
cases it is a better idea to segment the existing LAN so thqt each segment becomes a
separated LAN.
We can connect two or more networks together to create larger networks. A LAN
(local area network) can be connected to another LAN. A LAN (local area network)
can be connected to another WAN (wide area network). The components or devices
that are employed to connect two or more networks together are:
1) Repeaters
2) Hubs
3) Bridges
4) Routers
5) Gateways I
Operating System 3.13.1 Repeaters
Fundamentals &
Networking Repeaters, also called regenerator, are physical hardware devices. They connect two
network segments and broadcast packets between them, thus extending your network
beyond the maximum length of your cable segment. They have the primary function to
regenerate the electrical signal (shown below):
Reshaping the waveform
AmplifLing the waveform
Retiming the signal, to avoid collision on the network
As signal travels along a cable, its strength or amplitude decreases. This is called
attenuation. In other words, the signal attenuates as it travels along a cable. This limits
tlie length of a cable used to connect the computers together.
Since signal is a factor in the maximum length of a segment, repeater can
regenerate (or amplify) the weak sig~ialsso that they can travel additional cable
lengths. A repeater has intellige~ice,so that it takes a weak signal from one cable
segment, regenerates it and passes it on to the next segment. Simply we can say that
it recreates the bit pattern of the original signal . No more than four repeaters are
used to join segments together to keep collision detection working properly. We
should not confi~se repeater with amplifiers. As the amplifier uses analog signal, it
cannot differentiate between original signal and noise, therefore it amplifies both
original signal and noise. The repeater does not amplify the original signal, it
regenerates the original bit pattern.
Purpose of a Repeater
The purpose of a repeater (Figure 27) is to extend the LAN Segment beyond its
physical limits (as defined by the Physical Layer's Standards: e.g. Ethernet is
5OOm for 10Base5). A LAN Segment is a logical path, such as the logical bus
used by all 802.3 Ethernet types. A LAN Segment is given an identification
number, called a Segment Number or Network Number, to differentiate it from
other segments.

100 100
John Ware I
Building I I Building

Figure 27: Repeater

Typically, repeaters are used to connect two physically close buildings together (when
they are too far apart to just extend the segment). They can be used to connect floors
of a building that would normally surpass the maximum allowable segment length.
Note: for large extensions, as in the above example, two Repeaters are required. For
shorter extensions, only one Repeater may be required.

Repeater's OSI Operating Layer

Repeaters operate at the OSI Model Physical Layer (Figure 28).

Introduction to
Networking Concept
Datalink Datalid

Physical Physical

Figure 28: Repeater's Segment-to-Segment Characteristics

A repeater cannot join two cable segments using different access methods. A repeater
is not used to connect a segment using CSMAJCD access method to a segment using
token passing access. Repeaters can join two different physical media, but they must
use the same access method. Thus a repeater can have physical connections to join a
coaxial cables segment to a fiber optic segment.
Repeaters do not "de-segment" a network. All traffic that appears on one side of the
repeater appears on both sides. Repeaters handle only the electrical and physical
characteristics of the signal.
Repeaters work only on the same type of Physical Layer: Ethernet-to-Ethernet, or
Token Ring-tc-Token Ring. They can connect 10BaseS to 10BaseT because they both
use the same 802.3 MAC layer.
You can run into problems with the transfer rate (1 Mbps vs. 10 Mbps) when you
connect 1Base5 to 10BaseT. A repeater cannot connect Token Ring to Ethernet
because the Physical Layer is different for each network topology.
Repeater Addressing: MAC Layer and Network Segment
The MAC Layer Address is used to identify the Network Card to the Network. The
Repeater is transparent to both sides of the segment and both sides can "see" all the
Mac Addresses (regardless of which side they are on). This means that any network
traffic on Floor 1 will also appear on Floor 5, and vice versa (Figure29).

A B C Rep-er I 13 E F

1, ,I rTP7,
I loo
Floor 5 I Floor 1

Figure 29: Repeater Addressing

Nodes A & B could be furiously are exchanging files; this network traffic would also
appear on Floor 1. Repeaters don't provide isolation between segments (there is only
one collision domain).
Because Repeaters provide no isolation between segments, and the repeater is
transparent to both sides of the segment, both sides of the repeater appear as one long
segment. The Network Number, or Segment Number, is the same on both sides of the
3.13.2 Hubs
Hubs can also be called either Multi port Repeaters or Concentrators. They expand
one Ethernet connection into many. They are physical hardware devices. A hub is
Operating System similar to a repeater, except that it broadcasts data received by any port to all other
Fundamentals & ports on the hub.
Some hubs are basic hubs with minimum intelligence (i.e. no microprocessors),
Intelligent Hubs can perform basic diagnostics, and test the nodes to see if they are
operating correctly. Kf they are not, the Smart Hubs (or Intelligent Hubs) will remove
the node from the network. Some Smart Hubs can be polled and managed remotely.
Purpose of Hubs
Hubs are used to provide a Physical Star Topology (Figure 30). The Logical Topology
is dependent on the Medium Access Control Protocol. At the center of the star is the
Hub, with the network nodes located on the tips of the star.

Network Node

Figure 30: Position of Hub

Star Topology
The Hub is installed in a central wiring closet (Figure 3 1) with all the cables extending
out to the network nodes. The advantage of having a central wiring location is that it is
easier to maintain and troubleshoot large networks. All of the network cables come to
the central hub. This way, it is especially easy to detect and fix cable problems. You
can easily move a workstation in-a star topology- by changing the connection to the
hub at the central wiring closet.
Wice #1 Office #2 mice #3 Office #4 Office #5

Mfice #6 Office #7 Office #8 Office #9 Office#lo

Figure 31: Example of Hub

Hub's OSI Operating Layer Introduction to
Networking Concept
Hubs are multi port repeaters, and as such they obey the same rules as repeaters
(See previous section OS1 Operating Layer). 'They operate at the OSI Model Physical
Operating System IfA wanted to communicate with B, a dedicated 10 Mbps connection would be established
Fundamentals & between the two. If C wanted to communicate with D, another dedicated 10 Mbps
connection would be established.

3.13.3 Bridges
Bridges have all the features of the repeater. Besides regenerating the signals, a bridge
can segment (or divide) a network to isolate traffic related problems. A bridge sends
the data frames only to the concerned segment, thus preventing excess traff~c.A
bridge can split an overloaded network into two separate networks, reducing the
amount of traffic on each segment and thus making each network more efficient. Just
like repeaters, the bridges can be used to link different physical media. Bridges can
also be used to connect dissimilar networks like Ethernet system to a Token Ring
system. Thus bridges can be used to join networks using CSMAtCD access and token
passing access.
Bridges are both hardware and software devices. They can be standalone devices -
separate boxes specifically designed for bridging applications- or they can be
dedicated PCs (with 2 NlCs and bridging software). Most server software will
automatically act as a bridge when a second NIC card is installed.
Bridge OSI Operating Layer
Bridges (Figure 34) operate on the OS1 Model Data Link Layer, while repeaters work
at the physical layer. Since bridges work on a higher layer than repeaters, they are
more complex than repeaters and cost more than repeaters. They look at the MAC
addresses for Ethernet and Token Ring, and determine whether or not to forward--or
ignore-a packet.

Network Nawodi Nttwmk

Dadink Datalink Datalink

Physical Physical Physiml Physical

Figure 34: Bridge OSI Operating Layer

Bridges have their own routing tables. Initially the bridge's routing table is empty. As
nodes send packets, the source address is copied to the routing table. With this address
information, the bridge learns where the computers are situated. When any packet is
received by a bridge it reads its source and destination address. If the bridge knows the
location of the destination node it forwards the packet to the segment on which the
destination node is situated. If it does not know the destination, it forwards the packet
to all the segments.
Purposes of a Bridge
The purposes of a Bridge are the following:
Isolates networks by MAC addresses
Manages network traffic by filtering packets
Translates from one protocol to another
Isolates networks by MAC addresses Introduction to '
Networking Concept
For example, you have one segment called Segment 100: it has 50 users (in several
departments) using this network segment. The Engineering Dept. is CAD (Computer
Aided Design) -oriented, while the Accounting Dept. is into heavy number crunching
(vear end reports, month end statements, etc.).

Accounting I ~eneric 1 CAD

100 100
Accounting I "Other" I Engineering
I ~ P L
Dept I I D~P

Figure 35: Bridge Example 1

On this network, any traffic between Clients A, B or C and the Accou~ltingFile Server
(in the Accounting Dept.) will be heard across the Segment 100. Likewise, any traffic
between the Engineering Dept. clients G, H or I (to the CAD File Server) will be
heard throughout the Network Segment. The result is that "Other" Department
accesses to the Generic File Server are incredibly slow: this is because of the
unnecessary traffic that is being generated from other departments (Engineering &
The solution is to use one Bridge (Figure 36) to isolate the Accounting Dept., and
another bridge to isolate the Engineering Department. The Bridges will only allow
packets to pass through that are not on the local segment. The bridge will first check
its "routing" table to see ifthe packet is on the local segment. If it is, it will ignore the
packet, and not forward it to the remote segment. If Client A sent a packet to the
Accounting File Server then Bridge # I will check its routing table (to see if the
Accounting File Server is on the local port). If it is on the local port, then Bridge #1
will not forward the packet to the other segments.

Accounting I Generic I CAD
, File Server I ,, ,File Server1 Fileserver , .. .

ha1 ~anotc
II "Other" iaaa Engineering 100 I

Figure 36: Bridge Example 2

If Client A sent a packet to the Generic File Server, Bridge #1 will again check its
routing table to see if the Generic File Server is on the local port. If it is not, then
Bridge #1 will forward the packet to the remote port.
Note: The terms local and remote ports are arbitrarily chosen to distinguish between
the two network ports available on a bridge. R1 I
Operating System In this manner, the network is segmented, and the local department traffic is isolated
Fundamentals & from the rest of the network. Overall network bandwidth increases because the
Accounting Dept. does not have to fight with the Engineering Dept. (for access to the
segment). Each segment has reduced the amount of traffic on it and the result is faster
access. Each department still has complete access to the other segments, but only
when required.

3.13.4 Routers
A router is a special -purpose computer having a processor (CPU) and memory like
any other computer. But unlike any other computer, it has more than one 110 interface
that allows it to connect to multiple computer networks.
Routers are both hardware and software devices. Just like bridges, Router can connect
network segments and filter and isolate traffic. Unlike a bridge, a router can connect
networks that use different technologies, addressing methods, media types, frame
formats, and speeds. Routers are used in complex network situations because they
provide better traffic management than bridges. A router keeps track of the address of
all the segment of a network and can even determine the best path for sending data.
Routers do not pass broadcast traffic.
Like bridges, the routers also maintain routing tables in their memories to store
information about physical connections on the network. The router examines each
packet of data, checks the routing table , and then forwards the packet if necessary.
Routers are more inelegant than bridges, as routers can share status and routing
information with one another and use this information to bypass slow or malfunctioning
connections. Routers do not maintain any state information about the packets; they
simply move them along the network. Routers are usually employed by wide area
networks using dissimilar addressing schemes and different communication protocols.
Routers do not allow bad data to get passed on to the network. Thus they save
networks from broadcast storms.
There are two types of routers - static routers and dynamic routers.
Static routers require an administrator to manually set up and configure the routing
table and to specify each route.
Dynamic routers maintain a routing table automatically and require minimal set up and
Router OSI Operating Layer
Routers operate on the OSI Model's Network Layer as shown in Figure 37. The
Internet work must use the same Network Layer protocol. Routers allow the
transportation of the Network Layer PDU through the Internetwork, even though the
Physical and Data Link Frame size and addressing scheme may change.


Daralink Daralink

Physical Physical

82 Figure 37: Router Segment-to-Segment Characteristics

Routers that only know Novel1 IPX (Internetwork Packet Exchange) will not forward Introduction to
Unix's IP (Internetwork Packet) PDUs, and vice versa. Routers only see the Network Networking Concept
Layer protocol that they have been configured for. This means that a network-can have
multiple protocols running on it (e.g. SPXAPX, TCPIIP, Appletalk, XNS, etc.).
Router Addressing
Routers know the address of all known networks. They maintain a table of pathways
between networks and can select an optimal route over which to send data. Routers
look only at network address and not at destination node address. Routers talk to other
routers, but not to remote computers.
Routers combine the Network Number and the Node Address to make Source and
Destination addresses (in routing Network Layer PDUs across a network). Routers
have to know the name of the segment that they are on, and the segment name or
number where the PDU is going. They also have to know the Node Address: MAC
Address for Novell, and the IP address for TCP/IP.
3.13.5 Gateways
A Gateway is the Hardware/Software device that is used to interconnect LANs &
Gateways are much more complex and powerful than a router. They are slower than a
router and are expensive. A Gateway incorporates the functions of routers and
bridges, but it can translate instruction set on sending network into corresponding
instruction set of the receiving network. Gateways make communication possible
between different architectures and environments.
Often, the router that is used to connect a LAN to the Internet will be called a
gateway. It will have added capability to direct and filter higher layer protocols (layer 4
and up) to specific devices (such as Web servers, ftp servers and e-mail servers).
A Gateway links two systems that do not use the same communication protocols, data
formatting structures, languages and architecture, which can not be done by a router.
Gateways perform protocol and data conversion.
Gateway's OSI Operating Layer
A Gateway operates at the Transport Layer and above and it typically translates eqch
source layer protocol into the appropriate destination layer protocol. Gateways use all
the seven layers of the OSI model A mainframe gateway may translate all OSI Model
layers. For example, IBM's SNA (System Network Architecture) does not readily
conform to the OSI Model, and requires a gateway to translate between the two
Check Your Progress 1
1) Compare the advantage of fiber over copper wire.

2) Discuss the advanthges and d~sadvantagesof Bus & Mesh Topologies.

3) What are the roles of protocols in a computer network?

Operating System
Fundamentals & 3.14 SUMMARY

1 a A network allows one to share access to information devices.

a Communication protocol is a set of convelltions or rules that must be adhered

to by both communicating parties to ensure that information being exchanged
between the two parties is received and interpreted correctly.

a The major criteria to judge a data communicatio~~

network are: performance
Consistency, Reliability, Recovery, Security.

a The topology is the geometric arrangement (either physically or logically) of

the linking devices (usually called nodes) and the links, connecting the
individual computers or nodes together. Different topologies are mesh, star,
ring or combined topology.

a Communication between two devices can occur in three transmission modes:

simplex, half-duplex or full duplex.

a Computer network is classified into three types: LAN, MAN and WAN.

The network of networks is called the Internet.

a The most familiar type of DCE is the modem that modulates and demodulates

Guided transmission media use a cabling system that guides the data signals
along a specific path.

Unguided transmission media consist of a means for the data signals to travel
but nothing to guide them along a specific path.

Repeater is a device that operates at the physical layer, bridge at the data link
layer, router at the network layer and Gateway at all seven layers of the OSI

Check Your Progress 1

Noise immunity: RFI and EM1 immune (RFI - Radio Frequency Interference,
EM1 -Electromagnetic Interference) Because fiber -optic transmission uses
light rather than electricity, noise is not a factor.

Security: cannot tap into cable.

Large Capacity due to BW (bandwidth).

No corrosion.

Longer distances than copper wire.

Smaller and lighter than copper wire.

Faster transmission rate.

The cost of optical fiber is a trade-off between capacity and cost. At higher Introduction to
transmission capacity, it is cheaper than copper. At lower transmission capacity, it is Networking Concept
more expensive.

2) The Bus Topology

The main advantage of bus topology is that it is quite easy to set up. Any
workstation can be easily moved to another location as bus runs throughout the
office. Another benefit of this layout is that if one computer on the bus fails, it does
not affect the rest of the traffic on the bus.

A network with bus topoiogy cannot become too big as all the traffic is on a single
bus. The entire network can be down only if the bus has a break. The open ends of
the bus must be terminated to prevent signal bounce. If one or both ends of the bus
are not terminated, the whole network can be down.

Disadvantages include difficult reconfiguration and fault isolation

Mesh Topologies

In a mesh topology, every node has a dedicated point-to point link to every other
node. Simply dedicated means that the links carry traffic only between the two
nodes. So mesh topology ddes not have traffic congestion problems. Every node
has n-1 link, for a fully connected mesh topology having n nodes. So total number of
links will be n (n-l).This also means that every node has (n-1) I10 ports

Advantages of Mesh topology

1) Use of dedicated links guarantees that each connection can carry its own data
load. This eliminates the traffic problem.

2) If one link fails, it does not affect the rest of network. This means it is robust.

3) Point to point links make fault identification and fault isolation easy.

4) Privacy or security is high; as any other link cannot gain access to dedicated link
where the message is travailing.

Disadvantages of mesh topology

1) More cabling and I10 ports are required, because every node must be connected
to every other node.

2) Cost is very high, because more number of nodes and cabling required.

3) Installation and reconfiguration is difficult.

4) The complexity of writing communication software can be reduced by

adopting the principle of protocol layering. The idea here is to partition
communication functions into a vertical set of layers. Each layer performs a
related set of functions. Division of work between layers is done in such a
way that they are manageable and provide a logical interface and break
point. Each communication layer provides certain services to layers above it
and relies on the next lower layer to perform more primitive functions. Each
layer hides internal details from other layers. Thus dividing the
communication problem into several layers reduces its complexity and
makes the workof developing communication soit~\area lot casier and
error free.
- - - - - - -


Structure Page Nos.
4.0 Introduction 87
4.1 Objectives 88
4.2 History of Internetworking 88
4.3 Packet Switching 89
4.4 Internetworking Concepts 90
4.5 Internet Addresses 91
4.6 Configuring IP Addresses 92
4.7 TCP/IP 93
4.8 Additional TCP/IP-Related Protocols 94
1 4.9 Application Layer Protocols
4.9.1 File Transfer Protocol
4.9.2 Trivial File Transfer Protocol (TFTP)
4.9.3 TELNET
4.9.4 Remote Login
4.9.5 Electronic Mail (Email)

4.10 World Wide Web

.4.11 Domain Name System
4.13 Summary

4.15 Further Readings

An internetwork is a collection of packet-switching and broadcast networks,
connected by bridges, switches, or routers which are intermediate networking
devices, that functions as a single large network. So a11 users and devices can
communicate, regardless of the network segment to which they are attached.
Figure I illustrates some different kinds of network technologies that can be
interconnected by routers and other networking devices to create an internetwork.

Figure 1: Internetworking
Operating System In this unit we will explain the concepts, architecture and protocols of internetworking.
Fundamentals &
After going through this unit you should be able to:

define packet switching concept;

differentiate between virtual circuit & datagram, and

understand the functioning of a large number of protocols.


Networking allows computers to share information, applications and even hardware
devices. For any two computers to communicate with each other, they must follow
a set of rules called protocol. In early years of networking, every vendor was
concerned only with his own product. Each vendor defined its own standard for
communication between its computers. This resulted in many different types of
standards for network hardware and software that did not share a common protocol.
This meant that different systems could not interact with each other .Two computers
using network products of different vendors could not be connected together.

In the late 1970s, the networking community came together in an effort to replace
these closed systems with open systems. They wanted that all networking products
should be conipatible with other vendor products. The International Standards
Organisation (ISO) developed Open Systems Interconnection (OS1) reference model
for networking the model gives guidelines about how the parts of a network
communication system should work together.

The Open System Interconnection (OS1) reference model describes how

information from a software application in one computer moves through a network
medium to a software application in another computer. The OSI reference model is
a conceptual moclel composed of seven layers, each specifying particular network
functions. The model was developed by the lnternational Standards Organisation
(1SO) in 1984, and it is now considered the primary architectural model for inter
computer communications. The OSI model divides the tasks involved with moving
information between networked computers into seven smaller, more manageable
task groups. A task or group of tasks is then assigned to each of the seven OSI
layers. Each layer is reasonably self-contained so that the tasks assigned to each
layer can be irnplemented independently. This enables the solutions offered by one
layer to be updated without adversely affecting the other layers. The following list
details the seven layers of the Open System Interconnection (OSI) reference

Layer 7-Application
Layer 6-Presentation
Layer 5-Session
Layer 4-Transport
Layer 3-Network
Layer 2-Data link
Layer 1-Physical
Concept, Architecture
and Protocols


Figure 2 : The OSI Reference Model Contains Seven Independent Layers


l ~ a t communication
a takes place between two devices that are directly connected
through some form of transmission medium. It is impractical for two devices to be
connected directly. Instead, a network of switching nodes provides a transfer path
between two devices. Packet switching involves the breaking up of messages into
smaller components called packets. Packets often range in size from about 128
bytes to over 4096 bytes depending on the system involved. Each packet contains
source and destination information, and is treated as an individual message. These
mini-messages are received and routed through optimal routes by various nodes on
a wide area network. Far example a file to be transmitted between two machines
may be broken into many packets that are sent across the network one at a time.
The network H/W delivers the packet to the end where the network software
reassembles them into a single file again. There are two major types of packets to
be switched. They are datagram and virtual circuit.

In the datagram approach, each packet is treated independently and may follow a
different path through the network. Packets may be re-ordered, dropped or
delivered in wrong sequence. The communication protocols will have to provide
error recovery and sequencing of packets at the destination.

In the virtual circuit approach, a tixed logical path through the network from
sender to destination is established before any packets are sent. This path remains
unchanged for the duration of the connection or session. Although no resources
are reserved along the path, packets are buffered at intermediate nodes awaiting

Thus, a virtual circuit only defines a path for packets to follow without actually
reserving dedicated channels along the route as is the case with circuit switching.
Virtual circuit may provide a number of services including sequencing, error control
and flow control.
Operating System In comparing datagram and virtual circuit switching with other switching technologies,
Fundamentals & there are several factors to be considered. First of all, packet switching is faster
because messages are not stored in their entirety for later retrieval. Each packet is
small enough to be stored in a router's machine memory until it can be routed an
instant later. Secondly, packet switching allows the avoidance of route failure due to
excessive traffic loads. This is accomplished by routing packets along routes that are
the most free and clear. Thirdly, packet switching spreads the load of communication
across several paths.

The motivation for adopting packet switching are cost and performance. Because
multiple machines can share network fewer interconnections are required an'd cost is
kept low. Packet switched networks that span large geographical distances are
fundamentally different from those that span short distances. To help characterize the
differences in capacity and intended use, packet switched technologies are often
divided into three broad categories: Wide Area Network (WAN), Metropolitan Area
Network (MAN) and Local Area Network. There are structural protocols for each
category. In the next section we will examine one such protocol.


We have seen how machines connect to individual networks. The question arises,
"How are networks interconnected to form an internetwork?" The answer has two
parts. Physically, two networks can only be connected by a computer that attaches to
both of them. A physical attachment does not provide the interconnection we have in
mind, however, because such a connection does not guarantee that the computer will
cooperate with other machines that wish to communicate. To have a viable internet,
we need computers that are willing to shuffle packets from one network to another.
Computers that interconnect two networks and pass packets from one to the other are
called internet gateways+ or internet routers.
Consider an example consistiiig of two physical networks shown in Figure 3. In the
figure, machine G connects to both network 1 and network 2. For G to act as a
gateway, it must capture packets on network 1 that are bound for machines on
network 2, and packets on network 2 that are destined for machines on network 1 and
transfer them.

Figure 3: Two networks interconnected by G,a gateway (router)

Interconnection through IP Gateways or Routers

When internet connections become more complex, gateways need to know about the
topology of the internet beyond the networks to which they connect. For example,
Figure 4 shows three networks interconnected by two gateways.

Figure 4: Three networks interconnected by two gateways

In this example, gateway G must move from network 1 to network 2 all packets Internetworking:
destined for machines on either network 2 or network 3. As the size of the internet Concept, Architecture
expands, the gateway's task of making decisions about where to send packets and Protocols
becomes more complex.
The idea of a gateway seems simple, but it is important because it provides a way to
interconnect networks, not just machines. In fact, we have already discovered the
principle of interconnectionused throughout an internet:
In a TCP/JP internet, computers called gateways provide all interconnections
among physical networks.

You might suspect that gateways, which must know how to route packets to their
destination, are large machines with enough primary or secondary memory to hold
information about every machine in the internet to which they attach. However,
gateways used with TCP/IP internets are usually minicomputers; they often have little
or no disk storage and limited main memories. The trick to building a small internet
gateway lies in the following concept:

Gateways route packets based on destination network, not on destination host.

If routing is based on networks, the amount of information that a gateway needs to

keep is proportional to the number of networks in the internet, not the number of


In the previous section we defined a TCPIIP internet as a virtual network built by
interconnecting several physical networks through gateways which are usually
controlled by the internet service providers think of internet as a large network like any
other network. The difference of course is that the internet is a virtual structure
imagined by its designers and implemented entirely in TCP/IP s/w. Each machine
(host) on an internet is assigned a unique 32 bit internet address that is used in all
communication with that machine. Conceptually each address is a paid (netid, hosted)
where netid identifies a network and hosted identifies a host on that network.
Because IP addresses comprise both a network as a host on that network they do not
specifiy an individual machine but a connection to a network. For example a getway
connecting networks has distinct IP address, one for each network connection.

Unicasting, Broadcasting, and Multicasting

When an IP datagram is sent to an individual IP address, it is called a unicast IP
datagram. The process of sending the datagram is called unicasting. Unicasting is used
when two IP nodes are communicating with each other.

When an IP datagram is sent to all nodes on a specific network, it is called

There is a third mode of sending an IP datagram called multicasting. In multicasting
the IP datagram is delivered to a group of systems identified by a class D address. The
systems that have the same multicast address are said to belong to a multicast group.
Members of the multicast group, while being assigned a class D address, must also be
assigned an IP address (from the class A, B, or C address group). The multicast group
can receive an IP datagram in two ways:
IP datagrams sent directly to their individual IP address (class A, B, C).

0 IP datagrams sent to their multicast address (class Dl.

Operating System
Hosts on a TCP/IP network need to be configured using proper IP addresses. The actual
configuration procedure depends on the operating system. The configuration procedure
can be classified into the following categories.
Command line based
Menu interface
Graphical User Interface based
Obtained dynamically when host boots from a central server

I Table 1: Configuring IP Address and other Parameters for Hosts

Method Operating System1 Protocol

Command line Unix, VMS, Router, devices, and
Menu interface Router devices, Unix, NetWare
servers, and MS-DOS
Graphical User Interface Microsoft Windows products.
Dynamically assigned DHCP and BOOTP protocols.
Available on almost all major
operating system platforms.
Many systems offer a command that can be executed to modify the IP address. In
these systems, the command line is often placed in the startup script for the operating
system. The menu interface is built using extended line drawing character sets. You are
prompted to enter the IP address and other IP parameters. The Graphical User
Interface is for systems -such as X-windows and Microsoft's Windows operating
systems-that offer a pixel-based graphical view. The dynamically assigned IP address
is used in conjunction with BOOTP or DHP protocol. When starting up, a device
requests its IP address and other parameters from a central server that can deliver this
information using either the BOOTP or the DHCP protocol.
The IP address information for the host is recorded in a number of places. When the 1P
address information is entered, it is cached in memory and is available for use by the
TCPI IP software. Alternatively, this information can be recorded on a system file in
the operating system. IP addresses of ofhersystems can be discovered by consulting a
special file, usually called the "hosts" file, or by using the DNS protocol. The DNS
service is typically used to determine a host's 1P address given its symbolic DNS name.
In some systems, proprietary protocols can be used to discover an IP address on a
network. An example of this is the WINS service used in Microsoft's operating
You must consult your operating system manuals for actual details on configuring IP
addresses. The following sidebar provides examples of configuring IP addresses for
most Unix implementations, and for the Windows NT operating System.
Imagine that you are configuration network interface to IP ~ddress144.19.74.102,
subnet mask, and directed broadcast address
For a Unix Configuration
1) Log on as root user
2) Run the followingcommand:
Ifconfig etl~0 netmask broadcast Internetworking:
Concept, Architecture
Replace ethO with the Unix logical name of the network interface. and Protocols

For Windows NT

1) Log on as Administrator user.

2) Select the following:

Control Panel


Select the TCPIIP protocol

Select Properties

3) You will see a dialog box in which you can enter the IP address and subnet mask.
Windows NT, by default, uses the appropriate directed broadcast address of
based on the subnet mask that you specify.

Perhaps no other protocols designed to work above the Data Link and Physical OSI
layers are as popular as TCPIIP. That's primarily because this global protocol suite
has been used by and continually promulgated by thousands of government and
educational institutions world-wide.

The Transmission Control Protocol (TCP) and the Internet Protocol (IP) are
commonly referred to collectively as TCPIIP. TCP represents a transport layer
protocol that provides end to end reliable transmission. To do so, TCP includes such
functions as flow control, error control, and exchange of status information. In
comparison, IP represents a connectionless-modenetwork layer protocol designed to
route message between networks. In addition to TCP, the Internet suite specifies an
optional connection less -mode layer 4 transport protocol known as the User
Datagram Protocol(UDP).UDP is used for transaction - based applications, such as
transmission of network management information when transmission efficiency is
more important than reliability.

Figure 5 illustrates the layering structure of the TCPIIP protocol suite to include a
few of the application services included in the suite.

Application Layer
Transport Layer
Internet Layer

Figure 5: TCPIIP reference model

I Operating System
Fundamentals &
The advantage of TCPIIP for a network operating system is simple: Interconnectivity i>
possible for any type of operating system and hardware platform that you might want
to add.

TCPIIP is not a single protocol but a set of more than a dozen protocols. Each protocol
within the TCPIIP family is dedicated to a different task. All the protocols that make up
TCPIIP use the primary components of TCPIIP to send packets of data.

Transmission Control PrvLocoland Internet Protocol are two ofthe primary protocols in
the TCPIIP family. The different protocols and services that make up the TCPIIP
family can be grouped according to their purposes. The groups and their protocols are
the following:

1 Transport: These protocols control the movement of data between two macliines.

TCP (Transmission Control Protocol): Aconnection-based service, meaning that the

sending and receiving machines co~nmunicatewith each other through a stream of
messages. TCP has message delivery assurance routines incorporated into it.
CPCheck Your Progress 1

1) What is a packet?

2) Which layer of the OSI model has been divided into two sublayers, and what
are they?


3) Although UDP is connection less, what is the benefit of UDP?


4) Describe how a TCP message gets from one place to another in step sequence?



Illere are several additional protocols designed to assist TCP and IP. Since routing is
so inlpor-tant on a packet-switched network like the Internet, specialized protocols
have been designed to assist in this function. Special protocols for deter~nining
addressing on the Internet have also been devised. Additionally, some additional Internetworking:
protocols may be involved in error-checking and flow control,just to name a few. Concept, Architecture '
and Protocols
Let's explore some of these additional protocols that are included in the TCPIIP suite
of protocols.

FTP File Transfer Protocol allows the transfer of copies of files between one
node and another. FTP is not hardware-dependent so its services can function
just about anywhere. Using this utility to copy data is typical ly referred to as
"FTPing" a file.

NFS Network Filing System was developed by Sun Microsystems Inc. It

provides shared access to files in a very transparent and integrated way. This
protocol is discussed in more detail a little later.

TELNET Remote Terminal Emulation allows users to coninlunicate wit11

diverse hosts. The TELNET application provides terminal-type access to PC\

UDP User Datagram Protocol is a bare-bones rapid transmission prc.tocol

that uses IP packets to deliver data with no reliability features like co~lncctions
and ACKs. The forte of UDP is speed, not reliability. It is used in NFS.

SMTP Simple Mail Transfer Protocol is the middleman that uses UDP to
move data around from one inter~ietworkhost to another. Applications run on
both hosts that make use of SMTP.

ICMP Internet Control Message Protocol offers flu\\ control and error-
detection to the unreliable delivery method of IP. It prcn,idcsa facility for
routers and gateways on the net to communicate with a source if there is a
problem. It also provides a mechanism for determining if a destination cannot
be reached.

RIP Routing Information Protocol provides information for routing devices

about pathways and number of hops to achieve them. RIP was popularized by
its use in a Berkeley UNIX application called "Routed". RIP is ideal for smaller
networks, but considered impractical for larger inter~ietworks.

ARP & RARP Address Resolution Protocol & Reverse Address

Resolution Protocol are special protocols to allow TCPAP to interact in
environments such as Ethernet. ARP maps TCPIIP addresses to Ethernet Data
Link layer addresses. RARP maps the Ethernet Data Link layer address to the
TCPIIP address.

That's an overview of some of the better-known additional protocols.


The first generation of Internet applications from the late 1960s and early 1970s
addressed the need to transfer files between computers, to have remote access to
computing resources, and to support communication between users at different
hosts. The applications, wliich met these needs: FTP, Telnet, HTTP, SNMP and
DNS, were the predominant applications in the first decades of the Internet. The
emergence of the World Wide Web in the early 1990s quickly made web browsing
the most popular Internet application. Recently, applications for streaming audio and
video, telephony over the Internet. and ~eer-to-peerfile sharing have again changed
the landscape of Internet applicatloni
Operating System This section discusses knowledge about how applications interact with the Internet and
Fundamentals & how applications take advantage of the Internet to provide network services to end-

4.9.1 File Transfer Protocol

The File Transfer Protocol (FTP) for copying files between computer systems is
one ofthe oldest application- layer protocols and was created before the TCPIIP
protocol suite. FTP is a client-server protocol where an FTP client accesses an FTP
server. The FTP client authenticates itself with a user name and a password to
establish an FTP session. A successful authentication results in the establishment of an
FTP session, where the FTP client can download ("get") and upload ("put") files and
file lists. When transferring files, FTP respects the ownership and access privileges of

Most hosts have a utility program, generally also called FTP, which provides an
interactive command line interface to run an FTP session. . FTP clients can also be
integrated in other applications, such as web browsers. Anonymous FTP is a special
form of file transfer service that allows public access to files at an FTP server. An
FTP client can establish an anonymous FTP session by supplying the user name
"anonymous" and an arbitrary password (The FTP server usually requests to supply
an email address as password).

FTP employs TCP as its transport protocol, thereby ensuring a reliable transfer of
transmitted data. Two TCP connections are established for each FTP session, called
control connection and data connection The control connection is used for commands
from the client and messages from the server. The data connection is used for the
transport of files. FTP server uses the well-known TCP port 2 1 for the control
connection, and the well-known TCP port 20 for the data connection, and an FTP
client selects available ephemeral port numbers. The control connection is established
at the beginning of the FTP session and stays up for the entire lifetime of the session.
The control connection is used by the FTP client for authentication, for setting various
session parameters, and for commands to download or upload files. The data
connection is opened and closed for each transfer of a file or file list. As soon as a file
or a file list has been transferred, the data connection is closed. If there is another file
transfer, the data connection is re-opened. By default, the data connection is
established upon request by the FTP server. The FTP client starts a TCP server that
waits for a connection on an ephemeral port, and sends the port number of this p c r ~on
the control connection to the FTP server. After the FTP server receives the port, it can
request a data connection to the FTP client. A security concern with FTP is that the
user name and the password submitted by the FTP client on the control collne~tionat
the beginning of an FTP session are not encrypted. Therefore, anyolie with the abil~ty
to capture traffic from an FTP client can obtain the user name and password used by
an FTP client.

The FTP client sends commands to the FTP server, and the FTP server responds
with a three-digit response code and an explaining text message. The commands from
the FTP client as well as the responses from the FTP server are transmitted as ASCII

Characters. 13 The end of a client command and the end of a server response is
represented by an end-of-line sequence, which consists of the ASCII special
characters Carriage Retgrn (ASCII 10) followed by Line Feed (ASCII 13). When the
TCP connection to TCP port 21 of the FTP server is established, the FTP server sends
a message that it is ready to interact on a new FTP session. Then, the user supplies a
user name and a password. If the authentication is succc;ssfi~l,tiie user sends the I!'
address and port number of its ephemeral port for the data con~~ectiorr. The IP ciJdress
and port number is sent in dotted-decimal notation, where the first four numbers
specify the 1P address and the last two numbers specify the port number. By default, Internetworking:
tiles are transmitted as text files using ASCII characters. However, the FTP client can Concept, Architecture
and Protocols
change this default so that files are transmitted bit-by-bit without any interpretation.
When the file transfer has been completed, the FTP server sends a message to the
FTP client. At this 13 ASCII (American Standard Code for Information Interchange) is
an encoding format for textual data, which represents an alphanumeric character or
special character by seven bits. Application-layer protocols transmit each ASCII
character in a byte (octet) with the most significant bit set to zero. TheFTP client can
download or upload another files, or end the FTP sessions by issuing the command

4.9.2 Trivial File Transfer Protocol (TFTP)

The Trivial File Transfer Protocol (TFTP) is a minimal protocol for transferring
files without authentication and no separation of control information and datd as in FTP.
Therefore TFTP must not be used on computer where sensitive /confidential
information is stored. TFTP is frequently used by devices without permanent storage
for copying an initial memory image (bootstrap) from a remote server when the
devices are powered on. Due to the lack of any security features, the use of TFTP is
generally restricted.

TFTP uses the unreliable transport protocol UDP for data transport, whereas FTP uses
TCP. Each TFTP message is carried in a separate UDP datagram. The first two bytes
of a TFTP message specify the type of message, which can be a request to download
a file, request to upload a file, a data message, or an acknowledgement or error
message. A TFTP session is initiated when a TFTP client sends a request to upload or
download a file from an ephemeral UDP port to the (well-known) UDP port 69 of a
TFTP server. When the request is received the TFTP server picks an ephemeral UDP
port of its own and uses this port to communicate with the TFTP client. Thus, both
client and server communicate using ephemeral ports.

Since UDP does not recover lost or corrupted data, TFTP is responsible for
maintaining the integrity of the data exchange. TFTP transfers data in blocks of 5 12
bytes. Each block is assigned a 2-byte long sequence number and is transmitted in a
separate UDP datagram. A block must be acknowledged before the next block can be
sent. When an acknowledgment is not received before a timer expires, the block is

4.9.3 TELNET
Telnet is a remote login protocol for executing commands on a remote host. The Telnet
protocol runs in a client-server mode and uses the TCP protocol for data transmission.
A client initiates a Telnet session by contacting a Telnet server at a remote host.
Recently, the use of Telnet in public networks has been discouraged since Telnet does
not offer good protection against third parties that can observe ("snoopy7)traffic
between a Telnet client and a Telnet server. At the Telnet client, a character that is
typed on the keyboard is not displayed on the monitor, but, instead, is encoded as an
ASCII character and transmitted to a remote Telnet server. At the server, the ASCII
character is interpreted as if a user had typed the character on the keyboard of the
remote machine. If the keystroke results in any output, this output is encoded as
(ASCII) text and sent to the Telnet client, which displays it on its monitor. The output .
can be just the (echo of the) typed character or it can be the output of a command that
was executed at the remote Telnet server.

Telnet uses a single TCP connection for communications. The Telnet server uses
the well known TC:P port 23 and the Telnet client uses an ephemeral TCP port.
After establishin8 the TCP connection, the Telnet client and server negotiate a set
Operatlog System of parameters for the Telllet session, including terminal type, line speed, iftyped
Fundamentals & characters'should be echoed to the client or not, and so on. Unless a Telnet
session is explicitly configured not to do so, Telnet client sends one TCP segment
for each typed character. Telnet provides some independence from the
differences of hardware and software at hosts by mapping input and output to a
virtual device, called Network Virtual Terminal (NVT) or pseudo terminal. The
Telnet client and Telnet server map the input from a keyboard and the output to a
monitor to the ASCII character set. Thus, before a character is sent over the
network it is encoded as ASCII character. Also, when an ASCII character is
received on tlie TCP connection, the receiving host interprets the character and
translates it into its local character format.

4.9.4 Remote Login

IIQloglnis an alternative remote login application program for hosts that run the Unix
operating system. Rlogin takes advantage of the fact that both the client and server run
a similar operating system, and, for this reason, is simpler than Telnet. Rsh is an
application program for the execution of a single command on a remote Unix host.
There is also an application program for file transfers between Unix hosts, called rcp.
However, this group of applications has poor security features, and is, therefore, often

The Secure Shell suite of protocols provides application layer services for remote
login and file transfer services, similar to FTP, Telnet, rlogin, rsh, and rcp, but ensures
secure encrypted communications between untrusted hosts. All components of Secure
Sliell provide authentication, confidentiality, and integrity of data, using a variety of
encryption and authentication algorithms, and protect against common attacks on the
security or integrity of co~nmunicationsbetween hosts.

4.9.5 Electronic Mail(Emai1)

Electronic Mail (email) is the primary Internet service for exchanging messages
between users at different hosts(computer) on the Internet. The exchange of email
messages is asynchronous, meaning that the transmission and retrieval of an email
message can occur at different times.

A user on a host prepares an email on a mail preparation program, called a user agent.
Examples of user agents on Unix operating systems are mail, xmail, elm, or pine 14.
Email messages are written in plain text and users can add non-text files to an email
message. The user agent passes the email to a mail server, where the message is
queued for transmission., the user agent and the mail server are on the same'host, but
it is also possible that they are on different hosts. The mail server uses the application-
layer protocol SMTP (Simple Mail Transfer Protocol) to transmit the email message to
the mail server of the receiver of the email. The sending mail server uses DNS, the
domain name service, to locate the correct remote mail server. In addition to
translating host names into IP addresses, DNS also provides the IP addresses of mail
servers. For the email ,the mail server at Host A queries DNS for the IP address of the
mail server that is responsible for tlie domain of the email receiver. Once the IP
address of the remote mail server is obtained, the sending mail server starts an SMTP
client and initiates a TCP connection to the SMTP server of the remote mail server at
the.wel1-known TCP port 25. As soon as the TCP connection is established, the SMTP
client and server exchange SMTP commands and transfer the email message. These
are user agents for hosts with a UNJX operating system. Commands and the email
message are transmitted as plain text using ASCII characters. If an email message
contains parts that are not text files, these parts are converted to ASCII characters
using the end-of-line sequence to indicate the end of a command. The SMTP client Internetworking:
issues commands to the server, and the server responds to each command with a Concept, Architecture
and Protocols
three-digit response code and explaining text. Aftzr the TCP connection is established,
the remote mail server sends a brief message.

411 email message may traverse multiple SMTP servers before reaching its destination.
For example, on most networks a single host is dedicated to handle all outgoingemail
messages for all hosts of the network. In this case, all hosts forward their outgoing
email message to the dedicated mail server, which relays the elnails to the proper
destinations. Also, in many networks, the receiving mail server does not have access to
the receiver's mailbox, and relays incoming messages to the mail server on a host
where the receiver's mailbox resides. When a mail server relays an email message, it
adds lines to the header of an email message. These lines can be used by the receiver
of an email message to trace the path of an incoming email. A mail server adds
incoming emails to the mailbox of a user, and assumes that the user has aLcess to the
mailbox. Often, however, a user is not permanently connected to its mail server. In
such situations, the user can employ mail access protocols to retrieve mail messages
from their mailboxes at a remote host. Currently, two popular mail access protocols are
in wide use: Post Office Protocol Version 3 (POP3) and Internet Mail Access Protocol
([MAP). Mail access protocols are generally integrated as a component of the user

Exchange of POP3 messages between a POP3 cli'ent and a POP3 server. An

exchange of POP3 commands between a POP3 client and a POP3 scrver. All
co~nmandsand messages are in plain ASCII text, and lines are separated by an end-
ofline sequence (CR and LF). The POP3 server acknowledges each command from
the client.

For outgoing messages, the user agent at Host X still uses SMTP. , The SMTP client
of the user agent at Host X connects to the SMTP server of Host A. Here, Host A
acts as a relay and forwards the message to the mail server of the email receiver.
Alternatively, the SMTP client at Host X can directly connect to the mail server of the

Browser-based Emails

Browser based emails allow user to access emails through web browser. The user
agent (the web browser) is used HTTP (not POPIIMAP) for the interaction between
the browser and email server. When a user wants to send or view the received mail,
the browser sends all such commands in the form of HTTP

Example of browser based emails are rediffinail, Gmail, etc.

Multipurpose Internet Mail extensions (MIME)

Traditional email systems are text based. Multipurpose Internet Mail extensions
(MIME) system extends the basic elnail system by permitting users to send binary file,
e.g., multimedia file, any other arbitrary format


The World Wide Web (WWW or Web) emerged in the early 1990s as a new
application for access to content stored on Internet hosts. Within a few years, the Web
beca~nethe most popular Internet application, and traffic on the Internet was
do~ninatedby Web applications. The Web is a distributed hypertext system, which is
implemented as a client-server application.
Operating System A Web client program, called a Web browser, retrieves and displays documents from a
Fundamentals & Web server. The documents, often referred to as web pages, are formatted using the
Hypertext Markup Language (HTML). HTML documents are text files that contain
HTML tags, which describe how text should be displayed in the user interface of a Web
browser. A hyperlink is special type oftag. It is a reference to another document, which
may be located at a different Web server. When displayed in a browser, hyperlinks can
be activated with a mouse click.

When activated, the browser retrieves the document that is referenced in tlie
hyperlink. A Web browser makes it convenient to access a variety of documents at
different web servers, which refer to each other by hyperlinks, thus, providing users
with a feeling of navigating a global database of documents. On the Web, tlie location
of a document is expressed in terms of a Uniform Resource Locator (URL). A URL
specifies a unique location for a document on the web. It can reference an HTML
document, but also any other file that can be accessed with a Web browser. An
example of a URL is, which specifies that an
HTML document with name index.htnz1 can be accessed via the protocol HTTP
from a host with the name

There is no notion of sessions, as, for example, in Telnet and FTP.

In older versions of HTTP, which are still in use today, an HTTP client initiates one
TCP connection for each request to the HTTP server. When a single client issues
multiple requests to the HTTP server, the number of TCP connections between the
HTTP client and HTTP server can grow large. To reduce the number of TCP
connections, HTTP/ 1.1, the current version of HTTP, permits multiple HTTP
requests and responses on the same TCP connection, leaves the TCP connection
open after a request has been served. The HTTP client does not need to wait until
a request is completed before issuing new requests. As i n many other application
layer protocols of the Internet, HTTP messages are tranmitted as ASCII text,
using the end-of-line character sequence to indicate the end of a message. The
most common HTTP messages sent by a client are requests for HTML or other
documents. The server responds to such a request either with a message that
contains the requested document or, if the request cannot be satisfied, with an error
code. Let us now discuss a request and a response between an HTTP client and an
HTTP. Suppose a user has typed the URL is in a
web browser.
When the URL is typed, the web browser starts an HTTP client, which establishes a
TCP connection to port 80 of the HTTP server of host


The Internet Protocol address is a 32- bit integer. If somebody wants to send a
message it is necessary to include the destination address, but people prefer to assign
machines pronounceable, easily remembered names (host names). For this reason the
Domain Name System is used. These logical names also allow independence from
knowing the physical location of a host. A host may be moved to a different network,
while the users continue to use the same logical name. The idea behind domain names
is simple: Rather than forcing people to memorize IP numbers, why not give them
cryptic names to remember instead?
Domain Name System maps a name to an IP address and conversely an address to a
name. Initially when the size of the Internet was small all machines used to maintain a
host.txt file, which was passed on, incase of Updates. This host.txt file was centrally
managed but looking at the present Internet scenario this does not seem to be a
feasible option due to the following reasons:
Size ofthe file will be very large, scalability also becomes an issue Internetworking:
Concept, Architecture
This is centrally managed but since the Internet has distributed management, the
management of name space should also be of distributed nature.
There can be inconsistent results for queries.
Because of the centralized management as the frequency of lookups increases
the time for reply can be very large.
The Domain Name System (DNS) is a distributed database used by TCPIIP
applications to map between hostnames and IP addresses, and to provide electronic
mail routing information. Each site (university department. campus, company, or
department within a company, for example) maintains its own database of information
and runs a server program that other systems across the Internet can query. The DNS
provides the protocol, which allows clients and servers to co~nmunicatewith each
The system accesses the DNS through a resolver. The resolver gets the hostname and
returns the IP address or gets an IP address (Figure 6) and looks up a hostname. As
we can see in Figure 6, the resolver returns the 1P address before asking the TCP to
open a connection or sending a datagram using UDP.

hostname 1
IP a d d r e s s

send IP da agram

to the host

Figure 6: DNS working scheme

DNS Design Goals

The primary goal is a consistent name space, which w ~ ibel used for referring to
resources. Names should not be required to contain network identifiers, addresses,
routes, or similar information as part of the name. Name space should be maintained in
a distributed manner, with local caching to improve performance. Mechanisms for
creating and deleting names; these should also be distributed.

The costs of implementing such a facility dictate that it is generally useful, and not
restricted to a single application. We should be able to use names to retrieve host
addresses, mailbox data, and other as yet undetermined information. All data
associated with a name is tagged with a type, and queries can be limited to a single

The name space should be useful in dissimilar networks and applications.

In short design goal of DNS:

1) Distributed ownership: Since the Internet has distributed v3,vnership;the

ownership of name space should also be of distributed nature.
Operating System 2) Have no obvious size limits for names, name components,data associated with a
Fundamentals & name, etc.
3) DNS protocol should be independent of the network topology.

4) OSIArchitecture independent

Design Principles
Hierarchy: The name space as well as management space should be hierarchical.
The name space can be represented as a tree with the root label as a null string. The
domain name system uses a hierarchical naming scheme known as domain names,
which is similar to the Unix file system tree. The root ofthe DNS tree is a special node
with a null label. The name of each node (except root) has to be up to 63 characters.
The domain name of any node in the tree is the list of labels, starting at that node,
working up to the root, usinga period ("dot") to separate the labels (individual sections
of a name might represent sites or a group, but the domain system simply calls each
section a label). Thus, the domain name "" contains three labels: "ignou",
"ac", and "in". Any suffix of a label in a domain name is also called a domain. In the
above example the lowest level domain is "" (the domain name for the
IGNOU in India), the second level domain is "ac.inY'(the domain name for Academic
organizations of India), and the top-level domain (for this name) is "in" (the domain
name for India). The node in is the second level node (after root) (Figure 7).

Figure 7: Hierarchical organisation of the DNS

Caching: A fundamental property of the DNS is caching. That is, when a name server
receives information about a mapping, it caches that information. Thus a later query for
the same mapping can use the cached result. The DNS uses the caching for optimizing
search cost. Caching is required as otherwise there will be:
long time for lookup
congestion at the root server
Every server has a cache for recently used names as well as a record of where the
mapping information for that name was obtained. When a client asks the server to
resolve certain name the server does as follows:

1) Check if it has authority for the name. If yes, the server doesn't need caching

2) If not, the server checks its cache whether the name has been resolved recently.
If yes, the server reports the caching information to its clients.
Wc can examine the cache when the server cashed the information once, but didn't Internetworking:
ch:rnge it. Since information about a particular name can change, the server may Concept, Architecture
and Protocols
have incorrect information in its caching table. The Tiine to Live (TTL) value is used
to decide when to age information. Whenever an authority responds to a request, it
includes a TTL value in the response, which specifies how long it guarantees the
binding to remain.
DNS Architecture
NAME SERVERS are server programs, which hold information about the domain
tree's structure and set information. A name server may cache structure or set
information about any part of the domain tree, but in general a particular name server
has complete information about a subset of the domain space, and pointers to other
name servers that can be used to lead to information from any part of the domain
REVOLVERS are programs that extract information from name servers in response
to client requests. Revolvers must be able to access at least one name server and use
that name server's information to answer a query directly.
Data in the DNS co~lsistsof Resource Records. There exists a data type for each
record. It is of the form (A, MX) where A is the 32-bit IP address, MX is a 16-bit
value along with a host name which acts as the mail exchange for the domain. DNS
can be used for both forward lookup (host name to 1P address) and reverse lookup
(IP address to host name). Name space has an entire subtree for reverse
n1apping.e.g. 1NADDR.ARPA for reverse lookup
DNS Zones
The zone (Figure 8) is a subtree of the DNS that is administered separately.
Whenever a new system is installed in a zone, the DNS administrator for the zone
allocates a name and an IP address for the new system and enters these into the
name server's database. W~thina zone DNS service for subsidiary zones may be

Zones are contiguous regions of the name space, where each can be forked into sub
zones. Each of these sub zones can have its independent management.
For example, the IGNOU zone has 2-sub zones cse and lib, which have their own


Figure 8: DNS Zones

A name server can support multiple zones; several sub zones can use the same name
server. Name servers have pointers among each other.
Operating System Remarks on DNS
Fundamentals &
Networking DNS uses datagram based access, although a DNS query requires reliability, TCP
is not used, as it is a query response mechanism.

I Root server is replicated for improved reliability.

Address resolution is done recursively. Any DNS server will pass requests it
cannot handle to a higher-level server and so on until either the request can be
handled or until the root of the DNS name space is reached.
DNS for System break-in
DNS is highly vulnerable to attacks and spoofing. An intruder canintercept virtually all
requests to translate names to IP addresses, and supply the address of a subverted
machine instead; this would allow the intruder to spy on all traffic, and build a nice
collection of passwords if desired.
IP spoofing attacks can be prevented to an extent. Ssh provides an improved type of
authentication. The server has a list of host keys stored in letc/ssh~known~host, and
additionally each user has host keys in $HOME/.ssh/known~hosts.Ssh uses the name
servers to obtain the canonical name of the client host, looks for its public key in its
known host files, and requires the client to prove that it knows the private host key.
This prevents IP and routing spoofing attacks.
rlogin and rsh permit ordinary users to extend trust to remote host/user combinations.
In that case, individual users, rather than an entire system, may be targeted by source
routing attacks. The information required for this attack are the target hostname,
trusted hostname and the user name, which are obtained by the "finger" command.
Attack is done as below:
In spoofing a host or application to mimic the actions of another. The attacker pretends
to be an innocent host by following IP addresses in network packets. rlogin service can
use this method to mimic a TCP connection from another host by guessing TCP
sequence numbers.
These attacks can be prevented by:
Prevent datagram routing with invalid source addresses.
lntroduce unpredictability into connection control mechanisms, such as TCP
sequence numbers and the allocation of dynamic port addresses.
Letting rshlrlogin to do forward loop along with the reverse lookup.
Allowing to do forward lookup creates a problem called " poisoning the cache " where
the attacker sends an unsolicited record along with the PTR record( PTR-a pointer to
another part of the domain name space ).
This attack-can be subverted by rejecting with the record, which arrives along with the
PTR record.


Simple Network Management Protocol (SNMP)
SNMP (Figure 9) is the simple network management protocol. It is used by network
management frameworks to manage and monitor network devices, such as hubs and
routers. Some computer systems also respond to SNMP queries
SNMP is not actually a protocol: it's a client server application that runs on the UDP
(User Datagram Protocol) service of the TCPIIP protocol suite to manage the
network. Network management means to ensure that network is up and running, Internetworking:
taking corrective measures and performing maintenance activities. It was developed Concept, Architecture
and Protocol-
to be an efficierlt means of sending network management information over UDP, using
Ports 161(SNMP) and 162 (SNMP TRAP).

SNMP Manager SNMP Aoent

Network management system contains two primary elements: a manager and agents.
The Manager is the console through which the network administrator performs
network management functions. Agents are the entities that interface to the actual
device being managed. Bridges, Hubs, Roilters or network servers are examples of
managed devices that contain managed objects. These managed objects might be
hardware, configuration parameters, performance statistics, and so on, that directly
relate to the current operation of the device in qilestion. These objects are arranged in
what is known as a virtual inforliiation database, called a managenlent information
base, also called MIB. SNMP allow u u

purpose of accessing these objects.

The model of network management architecture looks like fFipirre 10) this: I


A typical agent usually:

Implements full SNMP protocol.
Stores and retrieves management data as defined by the Management
Information Base.
Can asynchronously signal an event to the manager.
Can be a vroxy for some non-SNMP manageable network node.
Operating System A typical manager usually:
Fundamentals &
Networking Implemented as a Network Management Station (the NMS)
Implements full SNMP Protocol

Query agents
Get responses from agents
Set variables in agents
Acknowledge asynchronous events from agents
SNMP uses the User Datagram Protocol (UDP) as the transport protocol for
passing data between managers and agents. UDP was chosen over the Transmission
Control Protocol (TCP) because it is connectionless; that is, no end-to-end
connection is made between the agent and the NMS when datagranzs (packets) are
sent back and forth. This aspect of UDP makes it unreliable, since there is no
acknowledgment of lost datagrams at the protocol level. It's up to the SNMP
application to determine ifdatagrams are lost and retransmit them if it so desires. This
is typically accomplished with a simple timeout. The NMS sends a UDP request to an
agent and waits for a response. The length of time the NMS waits depends on how it's
configured. If the timeout is reached and the NMS has not heard back from the agent,
it assumes the packet was lost and retransmits the request. The number of times the
NMS retransmits packets is also configurable.
At least as far as regular information requests are concerned, the unreliable nature of
UDP isn't a real problem. At worst, the management station issues a request and
never receives a response. For traps, the situation is somewhat different. If an agent
sends a trap and the trap never arrives, the NMS has no way of knowing that it was
ever sent. The agent doesn't even know that it needs to resend the trap, because the
NMS is not required to send a response back to the agent acknowledging receipt of
the trap.
The upside to the unreliable nature of UDP is that it requires low overhead, so the
impact on your network's performance is reduced. SNMP has been implemented over
TCP, but this is more for special-case situations in which someone is developing an
agent for a proprietary piece of equipment. In a heavily congested and managed
network, SNMP over TCP is a bad idea. It's also worth realizing that TCP isn't magic,
and that SNMP is designed for working with networks that are in trouble-if your
network never failed, you wouldn't need to monitor it. When a network is failing, a
protocol that tries to get the data through but gives up if it can't is almost certainly a
better design choice than a protocol that will flood the network with retransmissions in
its attempt to achieve reliability.
SNMP uses the UDP port 161 for sending and receiving requests, and port 162 for
receiving traps from managed devices. Every device that implements SNMP must use
these port numbers as the defaults, but some vendors allow you to change the default
ports in the agent's configuration. If these defaults are changed, the NMS must be
made aware of the changes so it can query the device on the correct ports.
Figure 11 shows the TCPIIP protocol suite, which is the basis for all TCPIIP
communication. Today, any device that wishes to communicate on the Internet (e.g.,
Windows NT systems, Unix servers, Cisco routers, etc.) must use this protocol suite.
This model is often referred to as a protocol stack, since each layer uses the
information from the layer directly below it and provides a service to the layer directly
Concept, Architecture
and Protocols I

Figure 11: TCPIIP communication model and SNMP

When either an NMS or an agent wishes to perform an SNMP function (e.g., a

request or trap), the following events occur in the protocol stack:
First, the actual SNMP application (NMS or agent) decides what it is going to do. For
example, it can send an SNMP request to an agent, send a response to an SNMP request
(this would be sent from the agent), or send a trap to an NMS. The application layer
provides services to an end user, such as operator requesting status information for a port
on an Ethernet switch.
The next layer, UDP, allows two hosts to communicate with one another. The UDP
header contains, among other things, the destination port of the device to which it is
sending the request or trap. The destination port will either be 161 (query) or 162 (trap).
The IP layer tries to deliver the SNMP packet to its intended destination, as'specified by
its IP address.
Medium Access Control (MAC)
The final event that must occur for an SNMP packet to reach its destination is for it to be
handed off to the physical network, where it can be routed to its final destination. The
MAC layer is comprised of the actual hardware and device drivers that put your data
onto a physical piece ofwire, such as an Ethernet card. The MAC laye? also is responsible
for receiving packets from the physical network and sending them back up the protocol
stack so they can be processed by the application layer (SNMP, in this case).
' @= Check Your Progress 2

1) What are the various categories of TCPIIP Well-known Services?

Operating System 2) What is standard HTTP port?
Fundamentals &
Networking ..............................................................................................................................

3) Can a server will work as an FTP server and a webserver?

4) Multiple choice

i) TCPIIP is tlie main protocol used by computers on the Internet



ii) If I wanted to login to a host computer via the Internet, I would use
a) telnet
b) traceroute

c) snmp

iii) To determine if another computer was reachable (alive), the utility I could use is

b) nslookup
c) telnet

iv) My computer is very slow. 1 wish to take advantage of a much faster computer
on the network and have my program run there. Which of the following would I

b) snmp

C) rsh

5) 1 need to print a docume~iton a printer attached to a UNIX server. Which

command would I use?

b) ping
c) rsh
I wish to gain some statistics fro111a network server about the number of data Internetworking:
packets being sent and received. Which ofthe following should I use? Concept, Architecture
and Protocols
a) snmp 1;
bj telnet

c) rsh

d) ftp

This unit introduced the building blocks on which internetworks are built. Internetworks
are complex systems that, when viewed as a whole, are too much to understand. Only
by breaking the network down into the collceptual pieces can it be easily understood.
As you read and experience internetworks, try to think of them in terms of OSI layers
and conceptual pieces.

Understanding the interaction between various layers and protocols makes designing,
configuring, and diagnosing internetworks possible. Without understanding of the
building blocks, you cannot uilderstand the interaction between them.

Assigning Internet address to the nodes on the network is a very common task you will
,,erform when building a TCP/IP network. Two types of TP addresses exist: those for
I P version 4 and those for TP version 6. IP addresses must be unique on a network. in
special cases, it is possible to introduce non-unique addresses, called private addresses.

IP addresses posses a certain structure; they are divided into a network number (netid)
and a host number (hostid) portion. This chapter examines the strengths and
weaknesses of this scheme. Not all IP addresses can be assigned as a unique
identification for network connections. Only class A, B, and C addresses are
assignable to individual network connections. Class D is used for IP multicasting. In
addition, there are several special addresses used for broadcasting, loop back
addresses, and special circumstances. Besides IP & TCP, we looked at several other

Check Your Progress 1

1) A packet is a unit of data that is sent from an originating host to a

destination host on a network.

2) Datalink; logical Link Control (LLC) and Media Access Control(MAC)

3) UDP can transfer data faster than TCP

4) (1) First, TCP receives a request from a higher-application that a connection to

a remote machine is needed.

(2) TCP sends a request message to the destination machine. The request
message contains a unique number called the socket number that identifies
the sending machine's IP address and a port number.

(3) The message is passed down to IP

(4) IP assembles a datagram and send it to the destination
Operating System (5) The destination's IP, when received the request, sends back its socket
Fundamentals & number. This process called "exchange of socket number".
(6) TCP sends back up message to the application.

(7) The application then sends data to TCP as a stream of data.

(8) TCP assembles the data in to packets, so called "TCP segments"

(9) TCP then adds a header (Protocol Data Unit) to the data.
(10) TCP send the packaged segment to IP.
(1 1) IP encapsulates it and sends it over the network, so called "datagram".If
there is several segments, a sequence number will created and added to the

(12) If a segment is missing, TCP sends message back to the sending machine
with the faulty sequence number.

(13) After properly received, TCP generated either a pos;tive acknowledgment

(ACK), or a request to resend a segment.

Check Your Progress 2

1) The port numbers are divided into three ranges: the Well Known Ports, the Registered
Ports, and the Dynamic and/or Private Ports.

The well known ports are those from 0 through 1023.

The Registered Ports are those from 1024 through 491 5 1

The Dynamic and/or Private Ports are those from 49152 through 65535

2) standard port number :80

3) Yes , a server can be running several services and listening at different ports for

4) 1 (a)

2 (a)

3 (a)

4 (c)

5 (d)

6 (a)


"Internetworking with TCP/IR Douglas Comer, Volume I, Fourth Edition",
Prentice Hall, 2000.
Computer Networking, Kurose and Ross, Second Edition, Addison-Wesley, 2003
(optional, in RBR).
"Computer Networks: A Systems Approach ", Peterson & D ~ V I C Morgan
Kaufmann, Second Edition, 2000 W.
"TC'P/IP Illustrated', Voluine 1, The Protocols, Richard Stevens, Addison- Internetworking:
Wesley, 1994. Concept, Architecture
and Protocols
"lnternetworking with TCP/IP7, Douglas Comer, Volume 3, BSD Socket
Version, Prentice Hall, 1993.
"Computer Networks", Tanenbaum, Third Edition, Prentice-Hall 1996.
0 Data Networks, Dimitri Bertsekas and Robert Gallager, Second Edition,
Prentice-Hal1 1992.
0 "OSI A Model for Computer Communication Standards", Uyless Black,
Prentice Hall, 1991.
"Data a n d Computer Communications", U'ill iam Stallings, Fourth Edition,
MacMillan, 1994.
1.2 Features of Linux
1.3 Drawbacks of Linux . 6

1.4 Components of Linux 7

1.4.1 Memory Management Subsystem
1.4.2 Linux Process and Thread Management
1.4.3 File Management Subsystem
1.4.4 Device Drivers

' 1.5 Su~n~nary 13

1.6 Solutions/Answers 14
1.7 Further Reading 14

Today's trends are towards developmelit of free and platform independent software
Java popularised this concept in the field of programming language and now it is being
, done by Lini~xin the operating system.
Linux started out as a Unix variant to run on an IBM PC platform but with one major
difference- its source code was frkely available under the auspices of Free Software
Foundation (FSF). Due to this, it quickly positioned itself as an alternative to other -
Unix workstations such as those offered by Sun Microsystem, Compaq and Sillicoli
Graphics. Due to high quality designing of its kernel qualitiq such as stability,
modularity and easy configurability - it is now dominating the corporate world
significantly. For example, major banks, investment houses, retail establishn~ents,
I educational institutions, etc., use it.

After going through this unit you will be able to :

list the features of Linux;
list the drawbacks of Linux;
understand the process of thread management, and
understand the niemory management features.


Linux has several strong features. In this section we will discuss and explain them.
Linux Operating Linux is inexpensive
The first benefit of Linux is cost. All versions of Linux may be freely downloaded from
the web. If you don't want to download, prepackaged versions of Linux may be purchased
online. In addition, the sofhvare may be legally shared with your friends. In addition,
when the time comes to upgrade the operating system, the Linux upgrade would be free.

In addition to being inexpensive, Linux can run on the old system. Its products can run
on Intel 386 microprocessors, which were popular in the late 1980s. The server has
never slowed down despite increased use.

Linux is Fast

Linux runs respectably well on old computers, and it is even faster on newer, more
powerful computers. This is because Linux programs are very efficient and lean. They
use as few resources as possible, and unlike Windows, Linux programs use little, if any,
graphics. Graphics can slow a system's response time, making it slower than it truly is.
Linux may not be pretty, but it is fast.

Linux is Stable

The Linux code is well written. This both increases the speed at which Linux runs and
improves the stability of the operating system. Linux is next to impossible to crash. If
an application crashes, you can simply remove the program from memory to restart
your computer. In older versions of Windows, a crashing program had the potential to
take down the entire computer. This is one of the reasons why Linux is used on many
web servers where stability is crucial. With Linux, web-hosting providers can
guarantee 99.9 percent uptime.

Open-Source Software

Finally, Linux has open-source sofhvare. This means that users can read the source
code and modify it as needed. This probably means little to the average user of the
final version of a Linux kernel. However, during development, "beta" releases of the
kernel are available to developers who will download the code and test it thoroughly.
When possible, they will find any problems and correct the code. This process helps to
ensure that the final release of the kernel is as well written as possible.


Even though Unix and Linux operating systems are widely used on corporate servers,
web sites, and large-scale networking environments, we still won't find many people
using it on their desktop computers or workstations at home. There are several reasons
for this.


Because code is distributed with the Linux software, programmers are free to explore
how the system works - for good or bad. Many security loopholes have been reported
in the literature. Although most system vulnerabilities are detected before the product
is released, clever programmers can still discover new ones.

Lack of Support

No system is 100 percent secure. Even Microsoft products have security vulnerabilities.
However, Microsoft products do have extensive documentation and support. Microsoft
releases service pack and updates frequently to fix discovered vulnerabilities.
Support and documentation for Linux can be spotty at best. A customer who downloads Introdaction ta Uola
Linux from a server may receive only an electronic manual and access to online help Operating SysLslR
Limited Software Selection Choice
People purchase computers to run software. Users of Windows computers have many
software titles to choose from. Linux users have sofhvare in every category but are
often limited in their choices. For example, consider Internet browsers. The two most
popular browsers are Netscape Navigator and Microsoft Internet Explorer. Both are
available for Linux, but only Netscape has created a Linux version of its latest
browser, version 6.32. internet Explorer's most recent Linux version is 5, despite the
fact that Windows XP ships with Internet Explorer version 6.
You are also limited in your choice of word processors. The most popular Word
processor is Microsoft Word. Chances are that every computer in your school uses
Word. But Word is not available for Linux. Your best choice is Staroffice, a suite of
applications that contains a word processor. However, StarOflice, although a very nice
product, is not Word. A proficient Word user would have to learn some new skills to
use Staroffice.
Limited Hardware Support
Just as not all popular software run on Linux, not all hardware products work with
Linux. Red Hat and the other Linux vendors work very hard to support the more
common devices. They provide drivers for hardware devices. A driver is a small
program that allows the operating system to communicate with the peripheral devices.
Having the correct driver is crucial. K you have a new or unusual device, you may be
out of luck. For instance, many branded companies have not written a Linux
compatible driver. r

Linux, like as predecessor Unix, assumes that you know what you are doing, and it
assumes that you know the consequences of every command you type. In contrast,
Windows XP asks you to verify everything, and then shows you a pretty animation to
confirm the action.
For a beginning user, Linux can be frightening to use; entering the wrong command
can have serious consequences. It dosen't help that Linux is also case sensitive, s6
you must enter the commands in lowercase, and be careful to use the c w e c t case for
each subcommand you use with a command. Upper - and lowercases are often
different actions.


[n this section we will take up the various component of Linux Operating System.
I 1.4.1 Memory Maitagemen*Subsystem
I Linux is made up of a number of functionally separate pieces that, together, comprise the
operating system. One obvious part of Linux is the kernel itself; but even that would be
useless without libraries or shells. In this section we will discusss the various components
of Linux kernel.
Ii One of the basic objectives of any operating system is to make one feel that there is a
large amount of memory although it is having a small physical memory. This
apparently large memory is known as virtual memory. The system divides the
memory into easily handled pages (logical unit) and swaps these pages onto a hard
disk as the system runs.
Linux Operating The memory management subsystem is one of the most important parts of the
System operating system. Since the early days of computing, there has been a need for more
memory than exists physically in a system. Strategies have been developed to
overcome this limitation and the most successful of these is virtual memory. Virtual
memory makes the system appear to have more memory than it actually has by
sharing it between competing processes as they need it.
Virtual memory does more than just make your computer's memo? go further. The
memory management subsystem includes:
Large Address Spaces: The operating system makes the system appear as if it has
a larger amount of memory than it actually has. The virtual memory can be many
times larger than the physical memory in the system.
Protection: Each process in the system has its own virtual address space. These
virtual address spaces are completely separate from each other and so a process
running one application cannot affect another. Also, the hardware virtual memory
mechanisms allow areas of memory to be,protected against writing. This protects
code and data from being overwritten by rogue applications.
Memory Mapping: Memory mapping is used to map image and data files into a
processes address space. In memory mapping, the contents of a file are linked
directly into the virtual address space of a process.
Fair Physical Memory Allocation: The memory management subsystem allows
each running process in the system a fair share of the physical memory of the system.
Shared Virtual Memory: Although virtual memory allows processes to have
separate (virtual) addresses spaces, there are times when you need processes to share
memory. For example, there could be several processes in the system running
concurrently and simultaneously depending upon the number of processors residing in
the system but might be using the common file, e.g., C-amplifier.
Therefore, it is better to have only one copy in physical memory and all of the
processes running sharing it. Dynamic libraries are another common example of
executing code shared between several processes.
Another example of shared memory is that it can also be used as an Inter Process
Communication (IPC) mechanism, with two or more processes exchanging
information via memory common to all of them. Linux supports the UnixTMSystem V
shared memory IPC.

An Abstract Model of Virtual Memory

Before considering the methods that Linux uses to supp5rt virtual memory it is usem to
consider an abstract model which is applicableto a large number of systems.
As the processor executes a program it reads an instruction,from memory and
decodes it. In decoding the instruction it may need to fetch or store the contents of a
location in memory. The processor then executes the instruction and moves onto the
next instruction in the program. In this way the processor is always accessing
memory either to fetch instructions or to fetch and stored data.
In a virtual memory system all of these addresses are virtual addresses and not
physical addresses. These virtual addresses are converted into physical addresses by
the processor through a mapping scheme using a set of tables maintained by the
operating system.
To make this translation easier, virtual and physical memory are divided into handy
sized chunks called pages. These pages are all of the same size. They need not be,
but if they were not the system would be very hard to administer. The size of a page Introduction to Linux
varies from one system to another. Each of these pages is given a unique number; the Operating System
frame number (FN). In this paged model, a virtual address comprises two parts; virtual
page frame number (VPFN) and offset within the frame. Each time the processor
ellcounters a virtual address it must extract the virtual page frame number and the
offset. The processor must translate the virtual page fi-ame number into a physical
one (address of RAM) and then access the location at the correct offset into that
physical page. To do this the processor uses page tables. The size of a page table
- varies from one process to another and the number of page tables depends upon the
number of processes residing in a system.

Figure 1 shows the virtual addresses spaces of two processes, process P1 and
process P2, each with its own page tables. These page tables map each processes
virtual pages into physical pages in memory. This shows that process P,'s virtual page
frame number 0 is mapped into memory in physical page frame number 1 and that
process P2's virtual page frame number I is mapped into physical page frame number
4. Entry in the theoretical page table contains the following information:

Process P1 Process P2

VPFN7 Process P 1 Process P2 VPFN7

Page Tables
- -
Page Tables
4- VPFN6
-- 4-




Virtual Memory Physical Memory Virtual Memory

Figure 1: Abstract model of Virtual to Physical address mapping

The processor uses the virtual page frame number as an index into the processes page
table to retrieve its page table entry. If the page table entry at that offset is valid, the
processor takes the physical page frame number from this entry. If the entry is invalid,
the process has accessed a non-existent area of its virtual memory. In this case, the
processor cannot resolve the address and must pass control to the operating system so
that it can fix things up.
In case the required page frame is not found, the processor generates a page fault and
then the required page is brought from the hard disk.
Mapping 8t'virtual address to physical address can be done in any order. For example,
in process P, virtual page frame number 0 is mapped to physical page frame number 1
whereas virtual page frame number 7 is mapped to physical page frame number 0
even though it is higher in virtual memory than virtual page frame number 0. This
demonstrates an interesting byproduct of virtual memory; the pages of virtual memory
do not have to be present in physical memory in any particular order.
Linux shares many of the characteristics of the memory management schemes of other
Unix implementations but has its own unique features. Overall, the Linux memory
management scheme is quite complex. Here, we give a brief overview.
Linux Virtual Memory
Linux makes use of a three-level page table structure, consisting of the following types
of tables (each individual table is the size of one page):
Page Directory: An active proQss has a single page directory that is the size of
one page. Each entry in the page directory points to one page of the page middle
directory. The page directory must be in main memory for an active process.
Page Middle Directory: The page middle directory may span multiple pages.
Each entry in the page middle directory points to'one page in the page table.
Page Table: The page table may also span multiple pages. Each page table entry
refers to one virtual page of the process.
To use this three-level page table structure, a virtual address in Linux is viewed as
consisting of four fields. The leftmost (most significant) field is used as an index into
the page directory. The next field serves as an index into the page middle directory.
The third field serves as an index into the page table. The fourth field gives the offset
within the selected page of memory.
Page Allocation
To enhance the efficiency of reading in and writing out pages to and from main
memory, Linux defines a mechanism for dealing with contiguous blocks of pages
mapped into contiguous blocks of page frames. For this purpose, the buddy system is
uscd. The kernel maintains a list of contiguous page frame groups of fixed size; a group
may consist of 1,2,4, 16, or 32 page frames. As pages are allocated and deallocated in
main memory, the available groups ate split and merged using the buddy algorithm.
Page Replacement Algorithm
The Linux page replacement algorithm is based on the clock algorithm in which a use
bit and a modify bit are associated with each page in main memory. In the Linux
scheme, the use bit is replaced with an 8-bit age variable. Each time that a page is
accessed, the age variable is incremented. In the background, L i w x periodically
sweeps through the global page pool and decrements the age variable for each page as
it rotates through all the pages in main memory. A page with an age of 0 is an "old"
page that has not been referenced in some time and is the best candidate for
replacement. The larger the value of age, the more frequently a page has been used in
recent times and the less eligible it is for replacement. Thus, the Linux algorithm is a
form of least frequently used policy.

1.4.2 Linux Process and Thread Managemebt

Processes carry out tasks within the operating system. A program is a set of machine
code instructions and data stored in an executable image on disk and is, as such, a
passive entity; a process can be thought of as a computer program in running state. It
is a dynamic entity, constantly changing as the machine code instructions are executed
by the processor. As well as the program's instructions and data, the process also
includes the program counter and all of the CPU's registers as well as the process
stacks containing temporary data such as routine parameters, return addresses and
saved variables. Linux is a multiprocessing operating system which can support many
processes running in parallel. Processes are separate tasks each with their own rights
and responsibilities and also running in their own address spaces. If one process
crashes it will not cause another process in the system to crash. Each individual
process runs in its own virtual address space and is not capable of interacting with Introduction to Linux
another process except through secure mechanisms to be managed by kernel. Operating System

The most precious resource in the system is the CPU, usually there is only one except
in a multi-processors based system. Linux is a ~nultiprocessingoperating system, its
objective is to have a process running on each CPU in the system at all times, to
maximize CPU utilization. If there are more processes than CPUs (and there usually
are), the rest of the processes must wait before a CPU becomes free until they can
be run. In a multiprocessing system many processes are kept in memory at the same
time. Whenever a process has to wait, the operating system takes the CPU away
from that process and gives it to another, more deserving process. It is the scheduler
which chooses which is the most appropriate process to run next and Linux uses a
number of scheduling strategies to ensure fairness.
Linux supports a number of different executable file formats, ELF (Executably and
linkable fonnat) is one, Java is another and these must be managed transparently.

Data structure for Linux Processes

So that Linux can manage the processes in the system, each process is represented by
a task - struct data structure (task and process are terms that Linux uses
Interchangeably). The task vector is an array of pointers to every task-strucit data
structure in the system. This means that the maximum nuniber of processes in the
system is limited by the size of the task vector; by default it has 5 12 entries. As
processes are created. a new task-struct is allocated from system memory and added
into the task vector. To make it easy to find, the current, running process is pointed to
by the current pointer.
As well as the normal type of process, Linux supports real time processes. These
processes have to react very quickly to external events (hence the term "real time")
and they are treated differently from normal user processes by the scheduler.
Although the task-struct data structure is quite large and complex, its fields can be
divided into a number of functional areas:

State: As a process executes its changes state according to its circumstances. Linux
processes have the following states:
Running: The process is either running (it is the current process in the system) or it is
ready to run ( it is waiting to be assigned to one of the system's CPUs).
Waitiag: The process is waiting for an event or for a resource. Linux differentiates
between two types of waiting process; interruptible and uninterruptible. Interruptible
waiting processes can be interrupted by signals whereas uninterruptible waiting
processes are waiting directly on hardware conditions and cannot be interrupted under
any circumstances.
Stopped: The process has been stopped, usually by receiving a signal. A process
that is being debugged can be in a stopped state.
Zombie: This is a halted process which, for some reason, still has a task-struct data
structure in tlie task vector. It is what it sounds like, a dead process.

Scheduling Information: The scheduler needs this i,nformation in order to fairly

decide which process in the system most deserves to run,
Identifiers: Every process in the system has a process identifier. The process
identifier is not an index into the task vector, it is simply a number. Each process also
has User and group identifiers, these are used to control this processes access to the
files and devices in the system.
Linux Operating Inter-Process Communication (IPC): Linux supports the classic UnixTMIPC
mechanisms of signals, pipes and semaphores and also the System V IPC mechanisms
of shared memory, semaphores and message queues to allow processes to
communicate with each other and with the kernel to coordinate their activities.

Links: In a Linux system no process is independent of any other process. Every

process in the system, except the initial process has a parent process. In Unix
operating system the initial process is known as init. New processes are not created,
they are copied, or rather cloned from previous processes. Every task-struct
representing a process keeps pointers to its parent process and to its siblings (those
processes with the same parent process) as well as to its own child processes.

Times and Timers: The kernel keeps track of a processes creation time as well as
the CPU time that it consumes during its lifetime. Each clock tick, the kernel updates
the amount of time in jiffies that the current prdcess has spent in system and in user
mode. Linux also supports process specific interval timers, processes can use system
calls to set up timers to send signals to themselves when the timers expire. These
timers can be single-shot or periodic timers.

File System: Processes can open and close files as they includes pointers to any files
opened by this process.

Virtual memory: Most processes have some virtual memory (kernel threads and
daemons do not) and the Linux kernel must track how that virtual memory is mapped
onto the system's physical memory.

Processor Specific Context: A process could be thought of as the sum total of the
system's current state. Whenever a process is running it is using the processor's
registers, stacks and so on. This is the processes context and, when a process is
suspended, all of that CPU specific context must be saved in the task-struct for the
process. When a process is restarted by the scheduler its context is restored from

Linux Threads
A new process is created in Linux by copying the attributes of the current process. A
new process call be cloned so that it shares resources, such as files, signal handlers,
and virtual memory. When the tm processes share the same virtual memory, they
function as threads within a single process. However, no separate type of data
structure is defined for a thread. Thus, Linux makes no distinction between a thread
and a process.

1.4.3 File Management Subsystem

In Linux, as it is for Unix, the separate filesystems that the system may use are not
accessed by device identifiers (such as a drive number or a drive name) but instead
they are combined into a single hierarchical tree structure that represents the filesystem
as a single entity. Linux adds each new filesystem into this single filesystem tree as
they are mounted onto a mount directory, for example 1 mntlcdrom. One of the most
important features of Linux is its support for many different filesystems. This makes it
very flexible and well able to coexist with other operating systems. The most popular
filesystem for Linux is the EXT2 filesystem and this is the filesystem supported by most
ofthe Linux distributions.

A filesystem gives the user a sensible view of files and directories held on the hard
disks of the system regardless of the filesystem type or the characteristics of the
underlying physical device. Linux transparently supports many different filesystems
(for example MS-DOS and EXT2) and presents all of the mounted files and
lilesystems as one integrated virtual filesystem. SO,in general, users and processes do Introduction to Linux
Operating System
not need to know what sort of filesystem that any file is part of, they just use them.
The block device drivers hide the differences between the physical block device types
(for example, IDE and SCSI) and, so far as each filesystem is concerned, the physical
devices are just linear collections of blocks of data. The block sizes may vary
between devices, for example 5 12 bytes is common for floppy devices whereas 1024
bytes is common for IDE devices and, again, this is hidden from the users of the
system. An EXT2 filesystem looks the same no matter what device holds it.

1.4.4 Device Drivers

Device drivers make up the major part of the Linux kernel. Like other parts of the
operating system, they operate in a highly privileged environment and can cause disaster
if they get things wrong. Device drivers co~ltrolthe interaction between the operating
system and the peripheral devices that they are controlling. For example, the filesystem
makes use of a general block device interface when writing blocks to a disk. The driver
takes care of the details and makes device specific things happcn. Device drivers are
specific to thc controller chip that they are driving.

Check Your Progress 1

1) What are the features of Memory Management subsystem?

2) What are the different states of a Linux operating system?

3) What is the purpose of a file system?

L~IILIXis an IJnix like operating system, with the major difference that its source code
is &eely available. In this unit we have described the strong features of the operating
system and also highlighted its drawbacks. Linux like any other operating system is .
made up of a number of functio~~ally separate prCcis. The kernel is the most important
component of the system. It deals Memory Manager, File Manager, Process
Manager and I/O Manager. Device Drivers make up the major part of the Linux
kernel. They control the interaction between the Operating system and peripheral
devices. One of the main objective of Memory Management is to make available to
the process a large anlount of Memory although it is having a small physical memory
through virtual memory concept. Although virtual memory allows processes to have
separate address space it also provides shared space among Inany processes. The
unit also describes the process and Thread Management.
1) 'The following are the important features:
Protection of a process
Address mapping from virtual to physical
Swapping of a process between Hard disk & Physical memory.
Providing a shared space among many processes.

2) Linux processes have the following states:


3) The file system provides a user a complete view of files & directories held on the
hard disk of the system regardless of the file system type or characteristics of
underlying physical device. Linux system supports many different file systems and
presents all of the mounted files & filesystems as one integrated virt~~al


Operating Systems, 4th Edition, William Stallings, PHI.
Structure Page Nos.

2.0 Introduction 15


2.2 Entering the Machine 16

2.2.1 User Names and Groups
2.2.2 Logging In
2.2.3 Correcting Typing Mistakes
2.2.4 Format of Linux Commands
2.2.5 Changing Your Password
2.2.6 Characters with Special Meaning
2.2.7 Linux Documentation

2.3 Tlie File Systeni

2.3.1 Current Directory
2.3.2 Looking at the Directory Contents
2.3.3 Absolute and Relative Pathr~a~nes
2.3.4 Some Lir~uxDirectories and Files

2.5 Solutions/ Answers

2.6 Further Readings

This unit introduces you to Red Hat Linux 9 (hereinafter referred to as Linux) and tells
you how to start working on your Linux computer. A few elementary commands are
all YOLI need to get the feel of what working in a Linux environment is like. Tlie
attempt is to let you see enough Linux features to allow you to walk up to a computer
running Linux, login and start working on it. However, in this blockwe will not touch
upon tlie design of Linux. This unit is oriented towards acquainting you with the
richness of the system arid making you co~nfortablewith tlie Linux environment.
Apart from the academic, theoretical and sociological aspects of the develop~nentof
Linux, it is i~ridoubtedlya rich, open and otherwise convenient operating system that
gives you a bewildering array of tools to be productive. Unlike the earlier versions of .
UNIX, Linux is not open to the charge of being arcane arid difficult to use. It is
growing in popirlarity all over the world and is all set to enter tlie mainstream of
corporate computing. If you are accustonied to an operating system like Microsoft
Windows, then you might find Linux a bit different in terms of look and feel and as far
as tlie com~nandsgo. However, these days the actual operating systeni yo11use is less
at the forefront than it used to be, say, a decade ago, unless you are a software
developer. The focus has now shifted more and more to tlie user and the facilities that
Linux Operating System
After goingthrough this unit j.0~1
will be able:

'1 to start and carry on a login session under Linus;

to cllange your account password:
to understand basic Linux concepts like the liierarcliical directory structure:

I to understand the various types of files u~idcrLinux. and

to close a login session.


We will now start learning how to use a Linux computer. This unit will talk about tlie
basic steps involved in logging on to a system si~nningL,ini~sand also what you can do
once you have gained ingress. But remenlber that you cannot learn Linux by reading
this unit or even this block. That might at best allow you solne familiarity with tlic
terminology used and might tell yo11something about its organisation. You might even
come to know something about its features and the tools available i~nderit. But \.OLI
will not be able to work expertly on a Linux computer or feel comfortable in a Linus
environment, much less be productive in it. Yo11will not be able to appreciate tlie
power and beauty of Linux, nor marvel at the collaborative approach that produced it. ,

The only way to learn Linux is by working on a real Linus machine. 'This unit. this
block and otlier supplementary reading material, together with the Linux documentation
and tlie niany excellent books on the subject, will be a valuable aid in your voyage of'
discovery. So you must gain access to a working Linux machine and t ~ out y whatever
you feel like. Do not be afraid of exploring or making mistakes.
Whenever you learn about a comniand or any otlier feature, do not hesitate to try out
all its variations. Do not confine yoi~rselfto only what is mentioned here. This block is
of necessity brutally brief and can only serve as an incomplete introduction. Use any
otlier material to which you have access and experiment to your heart's content. You
will learn as much from your mistakes and from seeing unexpected outcomes as from
things you do by tlie book.

2.2.1 User Names and Groups

Every Linux user is given a name when she is allowed access to a Lini~ssystem. 7'liis
is also called an account, as in commercial arrangements an account is kept of tlie
usage of the machine by each user. The user name need not have any relation to tlie
actual name of tlie user, though it quite often is some abbreviation of the name. For
example, a person called Ram Kumar might be given a name h n a r r on a Li~iux
system. Here tlie account name is formed by taking tlie surnalie (abbreviated if it is
too long) and the first letter of the first name. It is quite possible for a person to have
more than one account on a single machine (in a different name), especially if tlie
person uses tlie machine in Inore than one capacity.

Another way of making account names is based on tlie role being played by the
person. For example, there can be several people working on some programming
projects. Ram Kumar could be working on two projects with different teams. In such
a case he might have an account name like crypt02 for his cryptography project, while
for his natural language processing project his account might be nlp04. Such an
arrangement llelps to keep people in teams part of the same group. One of the
motivations for Linux was to allow easy sharing of information, consistent with the
needs of security and privacy. So Linux allows account names to be grouped under a
common group name. All users belonging to the same group can share group Linux Commands,
privileges. If Ram Kumar leaves the organization and Zafar Khan takes his place, he and Utilities

niight be assigned to continue work on crypt02 while somebody else might be assigned
to 11lp04.
Some user names are reserved by Linux for its use, for example, bin and uucp. So
you cannot use those names for yourself. There is also a special kind of user on every
Linux system who has all possible access rights on the system. This user is called the
superuser. the system administrator or simply root because that is the user name '

conventionally allotted to her. For administrative convenience large systems can have
more than one superuser account. The superuser is the one who can create new user
accounts, shutdown the system and perform other maintenance tasks.
Yo11would by now be wondering why everybody cannot access the machine as root.
The reason is that when you are granted access to a machine you are given a
password as well as an account or user name. You are free to choose your password
though there are usually certain constraints imposed in the interests of security. So
you cannot enter the system as root unless you know the root password. On any well
maintained installation the root password is guarded very carefully, as public
knowledge of this would jeopardize the security of the installation.
While root can access all user files and override any system protection meant for mere
mortals, nobody can figure out what your password is. However, root can change or
remove your password. A user can also change her password though there are
some constraints on this too. There can be a minimum period before which
yo11cannot change your password. After a certain maximum period you might be
forced to change your password. There can also be constraints on what your
password can be. There can be rules that force you to have a minimum password
Icngth. inclade special characters, disallow your previous five passwords and so on.
All ;he above constraints are meant to make your password difficult to guess. This is
needed to make it hard for anyone else to masquerade as you and gain unauthorized
access to the machine. Computer security is a matter of great concern to all of us as
we become more and more dependent on them for performing our day-to-day tasks.
Remember that on the machine your identity is determined by your user name and the
machine cannot ~~sually distinguish between physical individuals. However, for high
secilrity applications such as military work, access to a machine might be through the
use of biometric methods like retinal scans or fingerprints. For most daily applications,
however, passwords are still the only means of authentication.

@- Check Your Progress 1

1) Can more than one person use the same user account on a Linux system?




2) Call there be no re than one account with the same name on a Linux system?


Linux Operating System Can more than one account have the same password?




2.2.2 Logging In

There are different ways of connecting to a Linux machine. You could go to the
console of a Linux machine, such as a personal computer (PC), start it up and log in.
You could be working on a Microsoft Windows machine or even another Linux
machine and could connect over the network (whether local or a wide area network)
to a Linux machine. Having once gained access you have all the facilities allowed to
you by the administrator. There are only a few situations where physical access to the
machine makes a difference. In this block we will not dwell on those matters.
When you see the console of your Linux machine or connect to it over the network,
you see a message like:
IGNOU Linux machine
Kernel 2.4.20-8 on an i686

The actual message on these lines could be different or absent depending on the
installation. It could be longer, shorter or even be absent. This does not affect
anything else that you do in any way.
You should now type in your user name and press the RETURN or ENTER key. In
most cases you have to press the RETURN key, sometimes labelled as ENTER, to
register what you have typed. You will also find that as you type on the console you
will be able to see whatever you have typed. This is because Linux usually echoes
whatever you type on the terminal. So your screen should now look like this:
IGNOU Linux machine
Kernel 2.4.20-8 on an i686
login: kumarr
You must type in your user name, also called the login name, exactly as allocated by
your system administrator. This is because Linux is case sensitive, that is, it
distinguishes between lower and upper case letters. In this respect it differs from
operating systems like VMS or Microsoft Windows. So be careful of small and capital .
letters when working on Linux.
When 1,inux asks you for your password, key it in carefully. Notice that your Linux COI
password is not echoed as you type. In fact, the cursor does not move at all. This is and

to prevent solnebody from reading your password over your shoulder, as that would
enable that person to masquerade as you by logging into the computer in your name
and using it.
Linux now checks whether you are a valid user and whether you entered the correct
password. If there is any mistake you get a message saying:
Login incorrect
This means you can try to login again. There can be other reasons why you might not
be able to login even though you are a valid user and did not make any typing mistake.
The messages you get in those situations will however be different.

Why be so pessimistic? Let us assume you have managed to login successfully. The
system may then display some messages and finally give you a sign that it is now
ready to obey your commands. The messages you see depend on how the system has
been configured or set up by the system administrator and by you. So you might not
even see any messages. However, usually there is a message indicating when you
logged in last. This is useful because if the date and time differ from what you
remember about your last login, it could mean that somebody else is using your
Let 11snow look at some of the other common types of messages you see on most
systems as you login. These usually give some information about the system like the
space available on the machine, news about the system and whether you have any
mail. The news is called the message of the day and appears whenever you login.
The message:
You havc mail.

Means someone has sent you mail using the user-to-user communication facilities
available in Linux.
After the login messages you see a prompt, which is the sign that Linux is ready ror
your commands. The prompt can be changed to whatever you like but the default
prompt also depends on what shell you have been assigned. The usual default in Linux
is the Bourne again shell, called bash, which is normally set to have the following

This is the prompt we will use throughout the block unless some other prompt is
explicitly called for. When you see the prompt on your terminal it usually means that
Linux has finished executing the last command you gave it and is ready for your next
command. Here kumarr is your login name, Linux is the name of the machine and the
home refers to the directory in which you are located after you login. This is usually
your Ilome directory.
There can be limits on the number of attempts, say five, that you can make at logging
in. The action taken depends on the installation but can be alerting the system
administrator or deactivating the terminal, perhaps for a short time only. So you should
be careful not to make too many typing mistakes. In particular be careful not to forget
or mistype your passworband avoid passwords with certaih characters like #.
Now you are still at your console that is black and white. If you want to use the
graphical features of Linux you need to get the X Window system up. For this you
need to issue the command:
[kumarr@linux kumarr]$ startx
whereupon the X Window system will start up and you will see a coloured screen with
a bar containing several icons at the bottom. The background and the colour of the
screen as well as the icons and facilities available in the tray depend on the
configuration of Linux that has been performed during installation or later. You will
usually want to work in the X Window system rather than directly on the console as
you can then use the mouse and other graphical facilities available in Linux. At this
point you are presented with your desktop.
Once here you can open up a terminal window by right clicking the mouse and
selecting the appropriate option. You can have as many windows as you like and you
can be doing different tasks in different windows. It is not that only terminal windows
can be opened up. You can click on the icons on the desktop or in the tray and run any
applications, such as a browser, office productivity tools and so on.
You can have several desktops. In your tray you will see four rectangles that represent
four available desktops to you. All the windows and applications that you are running
are associated with the desktop in which you open them. If you want a clean slate
where you are doing some other related tasks, you can click on another rectangle and
go to that desktop. This is very convenient if you want to do groups of tasks and do not
want to clutter up one desktop with too many unrelated windows.

W Check Your Progress 2

I) What happens if you type in your login name all in upper case?


2) Try logging in by using a friend's account (do not ask him for the password). Are
you able to get the prompt?

3) Try logging in using an account which does not exist on your system (confirm this
from your system administrator). Is there any difference in the computer's

I response from that in the last exercise? Why do you think this is so?

4) Try using your mouse just after logging in at the console when you are in text
mode. What happens? Are you able to perform any operation with the mouse?
2.2.3 Correcting q p i n g Mistakes Linux Commands
and Utilities
Many of us are not professional typists and we make a lot of mistakes while typing.
In ally case all of us are human beings and are prone to error. Whether you are a one
or two finger expert or know touch typewriting, you are going to mistype your
cornmalids some time or the other. What do you do when you want to find out in a
session whether you have any Sundays left in the month? Normally you would use
tlie cal command thus:

Suppose now that by mistake you type:

- kumarr]$ csl
After you press tlie RETURN key Linux will say:
-bash: csl: command not found
if you are lucky and a command csl does not exist. If it does it will be executed and
you could well be in deep trouble depending on what csl does.
You would therefore do better to cancel your command or correct your mistake.
These actions can be accomplished by using the kill and erase characters respectively.
The kill character cancels the entire line you typed while the erase character erases or
rubs oitt tlie last cliaracter.
Usually the erase character will be tlie character "H. This means that you have to
type H while holding down the CONTROL key, often abbreviated to Ctrl. This key is
nornially located on both sides of the keyboard near the Shift keys. In this block we
will use the convention of writing "H to mean Ctrl-H and you must be careful not to
confuse this with the two separate characters A (circumflex) and H. The backspace
key generates the sequence "H on the keyboard and you can use it to delete the
cliaracter preceding the cursor.
But Linux offers you other facilities to make typing easier. What if you want to have
typed 8 characters and want to change the Sth? Just use the left arrow key to go to
I , the charactel:~ouwant to change, press the Delete key and type in the correct
character. ~ 0 1 1can use the right arrow key to go to the right in a command. If you
want to repeat a command you issued 3 commands earlier, you can'use the up arrow
key. Pressing it once brings up the last command you issued, so press it thrice to get
the co~iimalidyou issued 3 commands earlier. Then use the RETURN key as usual to
~nvoketlie command, that is, to ask the computer to execute it. You can likewise use
tlie down arrow key to go forward through your command history.
What is more, once you have reached one of your old commands you can edit it by
using tlie left and right arrow keys together with the backspace or delete keys. This is
if you want to rerun a command with some other options. For example,
[kurnarr@,linuxkumarr]$ cal2004
will give you the calendar for the year 2004. If after issuing a few more commands
you want to see the calendar for the year 2003, you do not need to type in the full
co~n~nand again. Just use the up arrow keys to locate the command and to change thc
4 in 2004 to 3. Then hit the RETURN key. What a boon for typing cliallenged people
Ii ke this author!
You can use tlie command:
Linux Operating System to see the previous commands that you entered. To run a command entered a long
time ago, instead of using the up arrow key, you can say !<no>where no stands for
the command number. To run a command n commandaspreviously, say
[kumarr@,linux kumarr]$ !-n

Check Your Progress 3

1) What are the characters you need to use to correct typing mistakes while
logging in? How do you correct typing mistakes while entering the password?

2) How many previous commands can you invoke by using the arrow keys?

3) How will you enter a '\' in the command that you invoke?

2.2.4 Format of Linux Commands

We will now be at the general format of Linux commands and take the opportunity to
study some simple commands. Let us go back to the bash shell and the cal command
that we mentioned earlier.
[kumarr@,linuxkumarr]$ cal
This gives the calendar for the current month and year (of course this will depend on
what the system date has been set to - that is what the computer believes the current
month and year to be), and you can use it to, say, find out how many sundays are left in
the month. Another simple command is
[kumarr@,linuxkumarr]$ date
Wed Oct 13 09:20:59 IST 2004
which displays the current system date and time. You will realize that the computer has
no way of knowing what the current date and time really are, so what it can tell you is
whatever it thinks is the current time and date. This can be set by the system
administratorto be almost anything, but in most installations, care is taken to see that
tlie date is set correctly. This is because today computers are in general networked
with other computers and many system utilities depend on the correct date and time.
In Linux when we say date, we mean both the date and time, which is why the output
shown above includes the time as well.
Notice that the time zone is part of the output. This is significant when you are on a
network spanning time zones.
Another simple one word command is: ~ i h Commands
and Utilities
linux kumarr]$ who
kumarr ttyl Oct 13 08:41
kumarr pts10 Oct 13 08:54 (:0.0)
khanz tty2 Oct 13 07:39
This tells you the names of the users currently logged in to the system, their terminal
numbers and the date they logged in. You will find that you will always be listed as
one of the users, since you usually run the commands only when you are logged in to
the machine. There is another form of the who command that you can now try out.
[kumarr@linux kumarr]$ who am i
kun~arr pts10 Oct 13 08:55 (:0.0)
This time we have given the arguments am i to the actual command who. The result
is similar to that obtained earlier, but now you are the only user listed. This command
has the effect of telling you the login name of the user currently logged in at that
terminal, the number of the terminal and the date the user logged in. Other users of
the system at that time are not listed. r

Arg~~ments to the command are separated from the command by one or more spaces.
It might seem silly to ask the computer who you are, but if the previous user has not
terminated his session, you can find who it was by this command. But you would do
well never to leave your terminal unattended while you are logged in, as it would be a
security lapse. Actually Linux also provides the command:
[kumarr@linux kumarr]$ who are you
ku~narr pts10 Oct1308:56(:0.0)
which is synonymous with who am i, but s o ~ ~ nmuch
d s more intelligent.
You have now seen the general format of Linux commands, which comprises the
basic command followed by zero or Inore arguments. The command and the various
arguments are separated by one or more spaces and the whole sequence is terminated
by the newline character, which is produced when the ENTER k+y is pressed.
You can enter more than one command on the same line by separating the commands
from one another with semicolons like this:
[kumarr@,linux kumarr]$ date; who
Thu Oct 14 00:08:28 1ST2004
kumarr ttyl Oct1323:51
kumarr pts10 Oct 13 23:59 (:0.0)
The co~nmandsare executed one after the other in the order they were specified on
the command line. After the last command is over you get the prompt again.
Arguments to commands should not contain spaces otherwise the different words of
the argument would be interpreted as different arguments by the computer. If for
some reason the argument needs to contain a space, you must enclose the argument in
double quotes (") or in single quotes ( ' ).
Most arguments to commands are filenames (discussed later in this unit), options or
expressions. All of these could occur in the same command. The exact order in
which these arguments are listed can depend on the command and should be
Linux Operating System ascertained by examining the documentation for that command. Usually options
immediately follow the command with the exptessions and filenames coming next.
You will see detai!s of such cases later when we study more complex commands than
the ones we have looked at so far.
If an argument itself contains quotes of one kind you can enclose it in quotes of the
other kind. Thus:
- kumarr]$ grep -11 "Ram Kumar's Salary" employee payroll
looks for the expression Ram Kumar's Salary in the files employee and payroll and
prints the line numbers of the lines in which the expression is found.
Someti~nesthe bash shell places restrictions on theuse of certain characters because
it interprets them in some special way. To use these characters in arguments, you
have to use quotes. The details of bash, the shell, are discussed in Unit 4.

Check Your Progress 4

1) How can you get the,calendar for some other month in some other year?

2) Get the calendar for the year 1752 and look at it. Is anything the matter?

3) Find out how to set the system date. Why do you think only the super user is
allowed to do this?

4) Study the who command and use it to find the date the machine was started up,
and also how many users are currently using your system.

5) Open up terminal windows and applications on all four desktops and use the who
command. What do you see? Are you considered to be the same user on all
2.2.5 Changing Your Password Linux Commands
and Utilities
You saw earlier that your password was the only way of preventing somebody from
using your account on the system. Without it anybody who knew your login name
could walk up to the machine and start using your account. This would be really
serious in the case of the superuser or root.
When you are first given your account you are told what your password is. This is
usually some default convention used by the system administrator, tho~~glinot a good
practice. It should be a different password generated for each new user, otherwise
you are inviting a security breach. You are then invited to change your password
when you first log in. This can be done with the command:
[kumarr@,linuxkumarr]$ passwd
Changing password for user kumarr.
Changing password for kumarr
UNIX password:
passwd: Authentication token manipulation error
Notice that unlike the commands you saw so far, the passwd command is interactive.
It asks you to enter some information rather than doing all tlie work by itself. The first
thing it asks for is your current (or old) password. This is to make sure that somebody
else cannot change your password while you have left your terminal unattended. If
the wrong password is entered here, you get a message as shown above and you get
back the prompt. You can then of course try again:
[kumarr@linux kumarr]$ passwd
password for user kumarr.
Changing password for kumarr
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
If you now enter the old password correctly you are asked to type in your new
password. After that you are asked to enter it again. If you type two different things
here, the system tells you that they do not match and asks you to try again. If you
keep getting mismatches, the command terminates with the message passwd:
Authentication information cannot be recovered
The number of retries allowed is conligurable by the system administrator and is
usually kept at 3. This is because if you are unable to change your password you are
~~nlikelyto be able to enter it correctly later to login. Also notice that none of the
passwords is echoed. Your system will probably have restrictions on what passwords
you can choose. The password should not be too shcrt or too long to remember. You
should change it periodically so that if someone has been using your account by laying
Iiands on your password, they cannot co~itinueto do so indefinitely.
If you are wondering how the passwords are stored on the machine such that even the
superuser cannot find out what your password is, the answer is that Linux encrypts
your password before storing it. This means that what is stored on the computer bears
no resemblance at all to what you typed in as your password. When you try to login
tlie next tirne, Linux again encrypts the password you type in and compares it with
what has been stored. If the two are the same, you are allowed to login, otherwise
Linux Operating System your attempt is blocked. No ordinary user can even read the encrypted password -
only the superuser can do so. So no one can find out what your actual password is -at
least, not easily.
In Linirx, you cannot change somebody else's password, even if you know what it is,
from within your account. Ifyou try to do so, you are told:
passwd: Only root can specify a user name.
How then can root change a user's password without already knowing it? Ah! When
the user executing the passwd command is root or the superuser, Linux does not ask it
to supply the old password. That is why root can set your password to anything
without knowing what it is currently.
Since your password is the only way of protecting your account, you must take care to
choose passwords well, that is, choose one which cannot be easily guessed. As a
general rule, do not write down your password anywhere and let it be locked up in your
head. Your Linux installation will probably enforce some rules on what you can set the
password to be, or even the intervals at which you can change it.
Here is a short excerpt from the Linux manual entry for the passwd command about
choosing paswords.
Don't write down your password - memorise it. In particular, don't write it down and
leave it anywhere, and don't place it inan unencrypted file! Use unrelated passwords
for systems controlled by different organisations. Don't give or share your password,
in particular to someo'ne claiming to be from computer support or a vendor. Don't let
anyone watch you enter your password. Don't enter your password to a computer you
don't trust. Use the password for a limited time and change it periodically.
Your password should be hard to guess, and so you should not use information about
yourself that is easily available. This includes your name, that of your family, or
anything to do with your vehicle, credit card and so on. Also avoid dictionary words. It
would be reasonably safe to use a combination of upper and lower case letters and
special characters, with a length of at least 8 characters.

ciF Check Your Progress 5

) Can you run the passwd command again and set your password to what it already

2) Can a friend (not the superuser) help if you have forgotten your password?

3) Find out any restrictions in force at your instqllation on what you can set the
password to be.
4) What does Linux have to say about choosing passwords? Find out from the Linux Commands
documentation. and Utilities

2.2.6 Characters with Special Meaning
Solme characters are interpreted in a special way by the shell. These meanings will be
discussed in detail in the next unit of this block, but that apart, there are certain
characters yo11will find to be useful.
For example, suppose you start a command that takes a long time to execute, and you
change your mind and do not want to wait for the to finish. You can
abandon or break a command in between by pressing the BREAK character, which is
set to "C. Again, consider a command which produces a lot of screen output. This .
could happen ifyou were typing out a long file, for example. The output will probably
be dumped on your terminal far too fast for you to read. To stop output on the screen
temporarily, hit "S. You can press any other key to restart the output.
A special character that you can use to erase a command line that you have typed is
"U. This is useful when you just want to start over rather than correcting some small
Another special character can be used to terminate your login session. While you can
.do so using the exit command, you could also try the special character "D. This
indicates to the shell that there will notbe any more input from you. So Linux logs you
out and again displays the login message on the console for another user, or you again,
to start another login session. If yo11are in the X-Window mode and are in a graphical
terminal window, the window is closed if you logout.
Check Your Progress 6
1) The cornmands you have learnt so far produce only a small amount of screen
ontput. How will you produce output which does not fit into one screen, using
only the commands you have learnt so far?
2) How mucli control does the "S command allow you over the output? Can you
read a long file in sequence easily by this method?
2.2.7 Linux Documentation
Linux comes with copious documentation that is mostly available on line. You should,
as a user, learn how to use the Linux manuals ar~dother resources. While we will not
be able to discuss this topic in detail here, you will have to acquire this skill if you want
to obtain a good understanding of Linux. This is because in this block we do not have
.the space to consider any but the most basic commands, and even those only briefly.
We will not even be able to consider. all the options available with ~ n a l ~ofthe
colnmands that we do discuss. The only way for you to master them will be by
Linux Operating System Usually the documentation will have been installed on your machine when Linux was
set up. In that case you can look up the manual entry for a command by using the man
command. For example, to learn more about the who command than what we have
talked of, saying:
[HYPERLINK "mailto:kumarr@,1inux~'kumarr~,linuxkumarr]$ man who
You can similarly learn more about the date, cal or any other command. So to learn
more about the man command itself, say:
[kumarr@,linuxkumarr]$ man man
For many commands you can use the i n f o command to get more complete
information. There are several other resources available, for example you can look at
the URL:

that has a host of documentation on Red Hat Linux. You can use a search engine to
look for Linux documentation on the Internet, to find user groups and so on. These
days it is less common to use printed manuals, primarily because they tend to get
outdated so quickly! Besides user level documentation, there are many resources that
you can find for system administrators and programmers, as you get to a more
advanced level in Linux with practice and experience. So use this block as a quick
introduction to get your feet wet and then move onto the more detailed documentation

@= Check Your Progress 7

I) Look up the manual entries for all the commands we have studied so far. What
do you feel about the number of options availablewith each command?


In this section we will explore the file and directory structures of Linux. Just as a
paper file is something into which you can put papers and bunch a group of papers
together, a Linux file is something into which you can put data. Afile has a name, and
this name is the property of the file rather than the data present in it at any given time.
It is possible to change the data in a file. This act does not affect the name of the file.
Thus ~ i n u xcomma~~ds can be made to operate on the data in a file as a group.
A file usually exists on the hard disk(s) of the computer. This will be the case when
you are logged in to the machine and are engaged in a session. The actual areas of the
hard disk used by a file can change as the file is increased and decreased in size. As
you will see later, the size of a file in Linux has a precise technical meaning, and the
size of a file does not necessarily tell you the actual amount of data in it.
Linux has three kinds of files - ordinary, directory and special. You have already got
an idea of what ordinary files are. Special files will be discussed in Unit 5 of this block.
Directory files contain information about other files, including directories or special
files. A directory groups its contents together hierarchically under itself, and a directory
within a directory is called a subdirectory of the directory at the higher level, also called
the parent directory. Thus a Linux file system is like an inverted tree of directories,
starting at a root and going down to an arbitrary depth of hierarchically arranged levels.
We will now look at some ofthe files in Linux, learn how to navigate the file structure
and how to make use of it.

2.3.1 Current Directory

I '
Every user who is given an account on a Linux system is also given a directory where
he reaches on logging in. This directory is also called the home directory. The
current, working or current working directory is the directory in which you are
currently located. On logging in, your current directory is normally your home
directory. You can find out what your current directory is at any time by using the
linux kumarr]$ pwd

This means that your current directory is called kumarr and is located under the
directwy horn! , which is in turn located under the root directory. Of course the actual
home directory you are allotted will depend on the installation. By the way pwd is one
of the few Linux commands that do not take any arguments or options.
The output that pwd displays is called the full pathname of your current working
directory. This is also known as the complete or absolute pathname, that is, the
pathname starting from root. You can refer to your directory by just saying kumarr
But this is not unambiguous as there can be another directory called kumarr under
some other directory as well. But no two directories or files on the same Linux
machine call have tlie same complete or full pathname. The various components of
the path are separated from one another by slashes ('/').
We have not yet talked of what a valid filename can be. Actually in Linux there are
no restrictions and a filename can have any characters and any length. The same
rules apply to directories as well. In practice it is best to avoid certain characters in
filenames because they have special meaning to the shell.

cjp= Check Your Progress 8


1) What would happen if your home directory did not exist and you tried to login?

2) How would you put a space into a filename?

2.3.2 Look-ing=t the Directory Contents
We hill now see how to look at the contents of a directory. The command is:
[HYPERLINK "mailto:kumarr@,linux"kumarr~linux kumarr]$ 1s
This gives you a listing of all files in the current directory. If you have just been
allotted your account and are logging in for the first time, you will be in your home
Linux Operating System directory and that directory will be empty, that is, there will be no files in it.
Over the years the 1s command has accumulated a lot of options and it takes some
time and experimentation to understand them all. 'The first option we look at is:
[kumarr@linux kumarr]$ 1s -a
Here a means all. This is your first taste of Linux options, so look at the command
carefully. The command Is is followed by at least one space after which the hyphen or
minus sign introduces the option letter. The -a option tells Linux to list all files including
those that are "hidden": Hidden files are those that start with the '.' character. Unless
the -a option is used, Is never lists such files in its output. The output of Is is always
sorted in some order, the default order being alphabetical. This sort order can be
altered by other options to Is which we will take LIPlater. This is why the file (actually
a directory) '.' is listed before '..' in the output.
.emacs .gtkrc- 1.2-gnome2 .netscape6
.. .esd-a~~t
h .ICEauthority .openoffice
abc -files ignou 4
abc\d .fonts.cache-1 .kde
abc d e f .gconf .mailcap .rhn-ap plet.conf
.bash-history .gconfd .mcop .sversionrc
.bash-logout .gnome .metacity .user60.rdb
.bashgrofi le .gnome2 .mime.types .Xauthority
.bashrc .gnorne2_private .mozilla
.chromium .gnome-desktop .nautilus
.chromium-score .gtkrc .netscape
You will usually find that directories are listed in a different colour such as blue. This
helps you locate them quickly. The '.' refers to the current directory and '..' to its
parent. These are pronounced dot and dot dot respectively. I n l h i s case '.' refers to /
homekumarr and '..' to /home. The directory '1' or root is its own parent. This output
is of course not very interesting because your home is devoid of files created by you
and you do not yet know how to create any. The only files you see are hidden files
made by the software itself.
To get around this, let us look at some other directory. You can get the listing of any
directory by supplying its name as an argument to Is. Thus to look at the directory
listing of the root directory, use the command:
[kumarr@linux kumarr]$ Is /
bin dev home lib misc opt root tftpboot ugr
boot etc initrd lost+found mnt proc sbin tmp var
Here the output is sorted column wise. We must caution you that it is quite likely that
you will see a different listing than the one shown here. It is self evident that the listing
will depend completely on the machine you are working on. However there are some
files that will surely exist on the root directory of a working installation. The above
directories are such files. To sort the output according to rows, from left to right, say:
[kumarr@,linux kumarr]$ Is -x 1
As yo11have seen the Is command lists several columns in its output. This is easy to
change. If you want 1 column in the output, say:
[kumarrc~linuxkumarr]$ Is - 1 Linux Commands I
and Utilities



Another variation of the command is the -C option that might produce the same output
as tlie command without an option. If that happens it means that the actual command
has been configured to use the -C option by default.

Besides using the colour of the file to identify directories, you can use the -p option or
the -F option to append a '1' to every file that is a directory. The -F option also
appends a '*' to every file that is an executable file, that is, a command. Check this
out and understand how the -F and -p options differ.

If you repeat this command on tlie bin directory, you will see something different.

[kumarr@linux kumarr]$ Is -Cp /bin

arch df hostname nice su

ash dmesg igawk nisdomainname@ sync

ash.static dnsdomainname@ ipcalc pgawk tar

aumix-minimal doexec kbd-mode ping tcsh

You see some files in a different colour. These are executable files, or commands that
yo11can run. You can use the -F option to verify that they are so because each of
them will have a * appended to the name in the listing.

Wben you have a very large directory, you might want to use an option of Is that gives
a very compact listing.

arch, ash, ashstatic, aumix-minimal, awk, basename, bash, bash2, bsh, cat,

cligrp, chmod, cliown, cp, cpio, csli, cut, date, dd, df, dmesg, dnsdomainname

The colours of the entries are as usual but each entry is separated from the other by a

'1-he above examples show you that the root directory consists of both directories and
ordinary files. In Linux everything is considered to be a file. The directories here, or
anywhere else, can themselves contain other directories to any depth. To see the
contents of /home, you can say:
Linux Bpcrnting System You might surmise that you are seeing the home directories of users who have
accounts on the machine. You also see your own home directory here. You can tell
that they are directories by the colour as well as the / that is appended to the name.
But there is one thing that you need to note. When yqu had logged in and checked
your current directory, the result had been:
[kumarr@linux kumarr]$ pwd
which is different from what you see here. Why is this so? We have seen in the last
section that the pwd command tells us the full, absolute pathname of the current
working directory. When we look at the contents of /home, kumarr is merely one of
the directories under it and is shown as such. To get the complete pathname we must
specify the preceding portion which is /home. Thus the full or complete pathname is /
If you look at the directory listing of /usr, you will find a bin directory under it too. By
now yo11will have understood that this bin directory is different from the one you saw
under the root directory. The first has the full pathname /usr/bin, while the second has
the full pathname /bin. You should now look at the oontents of the other directories and
try specifying their complete pathnames. You can also try looking at their contents by
specifying relative pathnames. We will look at complete and relative pathnames again
in the next section. You would do well to understand pathnames, relative and absolute,
thoroughly as that will be useful in navigating around the directory tree.
But let us now get back to our friend the 1s command. One of the most useful and
often used options is -1, which gives the so called long listing of the directories asked
[kumarr@linuxkumarr]$ Is -I
total 24
rw-r- 1 kumarr kumarr 4 Oct 15 01:18 abc
- w - 1 kumarr kumarr 5 Oct 15 01:17 abc\d
-w-r- 1 kumarr kumarr 5 Oct 15 01:17 abc d e f
drwxr-xr-x 2 kumarr kumarr 4096 Aug 2 1 20:33 -files
drwxrwxr-x 3 kumarr kumarr 4096 Oct 9 18:Ol ignou
w - r w 1 kumarr kumarr 27 Oct 1 1 225 1 xx
Now this is a complicated looking output, so let us try and understand the meaning of
this listing. The first column of the output tells you whether the file is a directory or
not. A '-'means that it is an ordinary file while a directory has a 'd' in that position.
So you now know another way of telling whether a file is a directory, apart fmm the -p
or -F options and the colour of the listing that you have already looked at. The other 9
columns in the first field tell you about the permissions on that file. We will look at
these in detail in a later section.
The next field in the output is a number indicating the number of links to the file. For a
file this shows the number of names it has. In Linux the same physical data may have
several names, although it must have at least one. Each name is a link to the file.
Usually ordinary files have only one link, but ifthere are more it does not mean that
there are that many copies of the data in the file. There is only one physical copy of
the data that call be referenced using any of its names. In the case of directories the
number of links tells you the number of subdirectoriesthat it has.
The third field of the output shows the owner of the file. Root and bin are names L,inux Commands
and Utilities
reserved by Linux for its use as we have seen earlier. In some cases you might see a
number like 207 instead of the user name.
The next field is the group name and in certain situations can be a number in the
display. The user is a part of the group shown here.
The fifth field is the size of the file in bytes. You already know that the size of a file in
x a precise meaning which is unrelated to the amount of data in it. However,
L i n ~ ~has
do not be alarmed because in most cases the intuitive meaning of size does hold good
and the figures you see ~~sually do represent the number of bytes of data in the file in
question. For large files the size is difficult to comprehend when represented in bytes.
For such cases, you can use the -h option that gives the size with a K, M or G
following the number for kilo, mega and giga bytes respectively. These are true kB,
MB or GB as the multiplier used is 1024. Often we colloquially use K to mean 1000
times. If you want the size represented with a multiplier of 1000, use the -si option.
The size is then shown as kB, MB or GB after the number to help you distinguish
which multiplier has been used.
The next item of information is the date the file was last modified, and in the end the
nanie of the file is shown.
With the long listing of Is, you can find out many useful things about the file. Try
looking at the directory long listing ofthe various system and other directories on your
machine. In the course of this exploration, when you look at directories like /bin, Isbin
and /usr/bin, you will see some familiar names such as who, pwd or Is. Thus Is is itself
to be found in the /bin directory. The three directories we just mentioned are the ones
where most of the binaries or executables of the system commands are to be found.
There are some to be found under /etc. as well.
We will now look briefly at three other options to the Is command. When a directory
is given as an argument to Is you get to see the contents of the directory. But suppose
you want to check the permissions on a directory, say /home/kumarr. If you try:
[kumarr@linux kumarr]$ Ls -I /home/kumarr
you will see nothing of what you need because Is tries to list the contents of the
directory and at present there is no file in your home directory. In the examples
above, we had created some files in the home directory of kumarr so as to be able to
show you some output, and these files were then deleted. So to see the permissions
you cbuld say:
[kumarr@,linux kumarr]$ Is -I home
whereupon kumarr would be one of the entries. But this is awkward as you will have
to wade through potentially several entries before you can locate the one you are
interested in. The answer to this is:
[kumarr@linux kumarr]$ Ls -Id /home/kumarr
drwx- 19 kumarr kumarr 4096 Oct 16 16:48 /home/kumarr
which lists /home/kumarr as a directory and shows all the information about it.
By now you would have also realised that subdirectories are normally shown as single
entries and any files inside them are not shown. To look at the contents of a directory
and recursively of all subdirectories within it, use -R.
[kumarr@,linuxkumarr]$ Is -IR/usr
will show the contents of /usr and also recursively of every subdirectory inside it,
down to ordinary files. Thus using:
Linux Operating System

you can see each and every file and directory on your system, though not hidden files.

Another option you might need sometimes is the -r option, for reverse. This reverses
the sort order of files displayed by Is. You can try this with any option, such as:

So far you have only given directories as arguments to Is, but you can use ordinary
files as well. It then lists only that file if it exists. Moreover you can give any number
of files or directories as arguments to Is and it will list whichever ones exist. You can
also use wild cards here. The '?' character matches any single character, while the
'*' matches any number of characters except a leading '.'.
If you feel out of breath after looking at these options, there are many more we have
not looked at! You are encouraged to look up the documentation for 1s and experiment
with them. Many Linux commands have zillions of options - getting used to them all
requires time and effort. But you will find that you soon get to know the options you
use often. It is probably best, when learning a new command, to concentrate on a few
useful looking options only. As you use them frequently, you will get to know them
well. Then you can spend some time deepening your knowledge of the command by
trying out the other options.

Most beginners get overwhelmed by the large number of options and do not know
where to start or when to stop. You will have to work out a method that suits you.
Maybe you are the type who likes to learn everything about a command at one go.
But many people, includingthe author, find that building on a solid foundation of
already known options is easiest.

@- Check Your Progress 9

1) Read up on and try out the other options to Is. What is the output of Is -lm? Of
Is -ml? Which option takes precedence? What is the result of Is -d?


2) If your system has the -x or -C option set by default, how can you get the
standard Is listing?




3) How can you control whether you see different file types in different colours?



4) Find out how to sort the output on time rather than alphabetically. Linux Commands




5) Since you can have filenames that are of arbitrary length, would you prefer to
store information in the filename or in the file?




2.3.3 Absolute and Relative Pathnames

You saw in the last section how pathnames could be relative or absolute. Since the Linux
file system is logically structured like an inverted tree, it is important to understand how to
specify pathnames. Both methods can be used and in Linux it does not matter which
approach you use in identifying the file you mean, as long as you are careful about
specifying it correctly. However there are situations where one or the other approach is
more convenient. So you should take the trouble to assimilate the concept and learn how
to navigate around the system with felicity. Let us look at atypical directory hierarchy on
a Linux machine.

At the top is the root directory, under which are directories such as bin, boot, dev,
home, lib, opt, home, etc, usr and so on. Under /dev you would have some 18
directories besides the ordinary files. Similarly /etc might have 63 odd directories
under it and /home would have the home directories of different users. /usr could
have about 13 directories that include bin,,etc. and others.

The exact layout ofthe directory hierarchy on your machine is likely to be different.
We will soon be looking at some ofthe important directories and files on aLinux
system. For the moment, though, you would do well to just concentrate on learning
how to move around. You already understand what is meant by the current directory.
This is the directory in which you are located at any given time. If you issue the
colnlnand Is, it is the files in the current directory that are brought up for you to see. If
you login as kumarr, you will probably end up in /home/kumarr when you get your
prompt irnless things have been arranged otherwise.

Now suppose /home/kumarr has a directory called nlp that has a file called augcfg.C.
Suppose you want to see the size of this file alone. For this you need to use tlie Is
command and provide the filename as an argument to it. In Linux you can provide a
pathname (relative or absolute) as an argument to a command wherever you could
otherwise provide a bare filename. So you now have three ways of accomplishing
what you want (we will assume that you have the required permissions- this will, in
fact, be the usual situation) to do.

Let us first use an absolute pathname. So you have to specify the filename starting
From root or '1'. Thus your command needs to be:

[kumarr@linuxkumarr]$ 1s -I /home/kumarr/nlp/augcfg.C
Linux Operating System You have already used this method in the last section. The second way is to use a
relative pathname, where you specify the pathname relative to where we are currently.
Here you only need to recall that '..' stands for the parent directory of the current
directory. So if you are at Ihomelkhanz, you can say:

linux kumarr]$ Is -I ../kumarr/nlp/augcfg.C

The '..' takes you one level up, that is, to /home. From there you continue naming the
file as before. Of course, you could have used the following rather convoluted way:

This is inefficient because you implicitly to root before naming the file. The first '..'
takes you to /home and the second one level higher, to / or root itself. Then you begin
your descent until you reach the file you desire. Here it would have been better to use
an absolute pathname instead of this,.for then you would not have had to use two steps
to reach root.

Usually a filename is specified by the method that results in the shortest possible
specification of the name, though of course that is not at all necessary. This depends
on whether the filename is closer to you or to the root directory. If you are located in 1
homelkhanz and want to specify a file in the directory /home/kumarr, it is easier to say
../kumarr rather than /home/kumarr.

There is a third way of looking at the size of augcfg.C. For this you will have to learn
a new command, cd, which lets you change the current directory. This command can
be given an argument which is your intended destination and it then changes your
directory to what you asked, provided you have the appropriate permissions. And how
do you specify your desired destination directory? By specifying, the pathname, of
course. The pathname can be specifed, as you would have undoubtedly guessed now,
either as a relative or absolute pathname. So you can say fiom /home/khanz

[kumarr~linuxkumarr]$ cd /home/kumarr/nlp


[kumarralinux kumarr]$ cd ../kumarr/nlp

and then look at the size by:

[kumarr@linux kumarr]$ Is -1 augcfg.C

This really amounts to specifying the filename relative to/homelkumarrlnlp, the current
directory. In general when you specify a bare filename you are specifying the
filename relative to the current working directory. So the command above is really a
shorter way of saying:

Lkumarr@linux kumarr]$ Is ./augcfg.C

One form of the cd command can be very convenient if you have wandered far off
your home directory and want to return there, especially if your home directory
happens to far away from the root directory. This is:

[kumarr@,linuxkumarr]$ cd

without any arguments. It always brings you back to your home directory irrespective
of where you are, even if you were already there to start with.
Check Your Progress 10 Linux Commands
and Utilities
Go to the root directory and then try to go to its parent with 'cd ..'. What
happens? What do you conclude?
What happens if you try to cd to a non-existent directory?
Can there be a file under a directory with the same name? Why?

2.3.4 Some Linux Directories and Files


It will be interesting and useful to now get acquainted with the Linux system directory
structure. We will look at the layout and contents of the Linux system directories and
understand how the various system files are grouped under directories. We will also
learn about the functions of some of the system files. The typical Linux directory structure
is as described in the earlier section.
We again emphasize that only some of the system directories are shown here. Your
machine cou Id have a somewhat different organization. How will you find out the
directory tree for your Linux system? You can do this by exploring the files on your
As you have already seen, the 1 bin directory contains some of the Linux system
commands and utilities. These include some of the commands that you have learnt so
far, such as Is and pwd. You can look at the long listing of this directory and note the
information provided. Look at the sizes to get an idea of the size of executables on
your machine. These will depend, among other things, on the architecture of your
The Idev directory contains device special files concerned with hardware devices like
printers, mice, audio devices, storage devices such as floppy drives and CD-ROM
drives and so on. You will learn more about these files and the Idev directory later in
this block.
The Ietc directory, as the name suggests, has several miscellaneous files and
directories. It contains many files and commands that are reserved for the use of the
system administrator. Many of the system defaults are set up using these files.

Ordinary users cannot execute these commands or use these files. For example, look
at /etc/issue or Ietclmotd. The first contains the text that is displayed at your login
prompt before you have logged in, while the second file (for message of the day)
contains the text that you see just after you login. These files can be blank, and
sometimes are. The file Ietclgroup has the names and group numbers of all the groups
in the installation. The /etc/passwd file contains the login name of each user, his user
identification number, his home directory, his default shell and sometimes some
Linux Operating System commentary. In Linux the encrypted password of each user is stored in a separate file
called /etc/shadow that cannot be read by ordinary users. So you cannot see even
another user's encrypted password.
The /lib directory contains system libraries that are used with compilers and shared
libraries that are needed at run time for executing commands and running executables.
The Isbin directory contains some standalone commands and utilities used during
installation. These are of interest to system administrators and those who need to
install and maintain the system.
The Itmp directory contains temporary work files that might be created by utilities and
commands when they run. It provides work space to such commands. This directory
is cleared out periodically on many installations. In any case you should assume that
any file in the Itmp directory can be erased without warning. Sdyou should not store
any useful files here and put them under your home directory only.

The directory Iusrlbin contains useful and important commands and utilities for users.
There is no sharp distinction between the commands in /bin and here, though. Our old
friend, the cal command, is to be found here. /usr/include contains header files that are
useful in writing C or C++ programs.

An interesting directory is /usr/games that traditionally contained text games in older

Unix installations. Today it could contain some more sophisticated games, such as
chromium or maelstrom. a

The directory /usr/local/bin is often used as a repository of commands used locally and
frequently developed by local talent. Such commands are often those that are found
useful and convenient in that installation.

The Imnt directory is used to mount different devices such as cdroms to make them
part of the directory tree.

While looking at these directories, you might have noticed that files under /usrlinclude
often end in ".h" and that there are many files ending in ".soy' in /lib. Although Linux
places no restrictions on the characters possible in filenames, there are some
conventions followed in some cases. Such files are often referred to as '.h' files, '.soy
files and so on, or sometimes simply as h or so files. The Linux commands or utilities
might enforce restrictions on the names of these files although Linux itself does not do
so. Thus C program files end in ".cn, C U program files end in ".C", assembler source
files elid in ".s", and so on.

There is a useful command, file, to dctcrmine the type of a file. This takes any number
of files as arguments and tries to detern~inethe type of each. Although it is not
foolproof and is open to deceit, rt usually does a good job.

@- Check Your Progress 11

1) Look up the Linux documentation for the various utilities above and find out
which of them enforce file naming conventions.

................................................................................................................................ I


2) Run the file command on various kinds of files from the various directories you Linux Commands
and Utilities
have seen and see if their types are reported correctly.

In this unit we have started at the beginning and looked at many basic Linux
commands. However, there are many useful commands that we have not been able to
examine. You will need to refer to the documentation and learn these. By now you
would know enough about Linux to conduct a session with ease. In the units to follow
we will examine some more commands and lookat some utilities in slight detail.

Check Your Progress 1

on more than one person using the same account. So long as they all know the
password of the account they can always use it.
2) No. There can be only one account under one name.
3) Yes, there is no restriction in linux on this. Any number of accounts can have the
same password.
Check Your Progress 2
1) You will not be able to login, unless your login name is in fact all in upper case, as
linux is case sensitive. So the exact case of the login name matters and you will
need to type it i n exactly as it is.
2) You will not be able to get'the prompt unless you are able to guess his password.
Thus, your own password should be such that it is not easy to guess.
3) There is no difference in the system's response, which is "Login hcorrect". This
is so that an intruder (who might not know for sure whether a particular account
exists) does notget any information about the existence of an account unless he
is first able to login.

block cursor and that some rows of the screen get highlighted as you move the
mouse about. But you will not be able to perform any useful operations.
Check Your Progress 3
1) You can use the backspace key to delete the character before the cursor position,
or use Ctrl-U to erase all the characters that you have entered. You might not be

correct typing mistakes while entering 1

see anything - neither the cursor nor ti-- --- . .
I ,inux Operating System 3) You can do this by entering two consecutive '\' characters, such as in abc\\def,
which will issue the command abc\def. The first \ escapes the second, which
thereupon loses its special meaning.
Check Your Progress 4
1) Say
$ cal mm yyyy
where mm represents the two digits of the month and yyyy the four digits of the year.
2) Look at the calendar for September.
3) Use the man command. It is an important system level operation that affects all
users and so no ordinary user can be allowed to change the date.
4) The command
$who -b
tells you when the system was booted. To see how many users are logged in. say
$ who q

5) There will be a different entry for each terminal window. But the username will
of course be the same.
Check your Progress 5
1) As an ordinary user linux will complain that the password is not changed.
2) An ordinary user cannot help you if you have forgotten your password because
slhe cannot look at or change your password unless slhe knows it already.
3) Try yourself
4) Try yourself
Check Your Progress 6
1) There are of course several ways. One is to give the same co~nnlandrepeatedly
such as
$ Is;ls;ls;ls,ls
or use
$ IS-R/
that gives a complete listing of every (non-hidden) file on tlie machine assuming
have the requisite permissions.
2) Using AS ~nanuallyto control screen output is not at all a convenient or even
feasible way. Tlie machine's response is too fast for you to control. So you wril1
not be able to read a long file in seqilellce easily by this method.
Check Your Progress 7
I) Linux commands tend to have a large riu~iiberof options. Though there are
exceptions such as the c a l command, most commands have so Inany options
that you cannot possibly remember all of them. You can cope with this by
remembering some of the most frequently used and useful options first. Later as
you need to perform some other tasks, you can look up and renlember more
Check Your Progress 8
1) L i ~ ~ would
u x co~nplainthat your home directory did not exist and would log yoti i n
to the root djrectory by default.You will likely have pefmbionproblems if your
directory exist and might not be
files. to do muchjywayDfd~b, b r
2) There would be [nore than one way. You can enclose the entire filename in Linux Commands
single or double quotes, or you could escape the spaces with a \ immediately and Utilities
Structure Page Nos.
3.0 Introduction 42
3.1 objectives' 42
3.2 Some Useful Commands 43
3.3 Permission Modes and Standard Files 45
3.4 Pipes, Filters and Redirection 50
3.5 Shell Scripts 53
3.6 Graphical User Interface 60
3.7 Editor 61
3.8 Summary 65
3.9 Solutions1Answers 65
3.10 Further Readings 65

In this unit, you will start to delve deeper into Linux and learn some more useful
commands. You will also see how to combine commands together to perform useful
tasks for which there might not be any single command available. You will learn to
write simple programs in the bash shell that will let you write your own Linux
commands. You will also see how to use the graphical user interface of Linux to
perform many tasks without issuing any commands on the command line. Finally, you
will look at the editor, vi, available in Linux for you toedit text files.

Because of the large amount of material to be covered, we will have to be brief.

However, we shall try to illustrate important concepts with realistic examples. Yo11will
then need to practice whatever you learn on a Linux computer so that you ~~nderstand
the variations and nuances of the commands.

After studying this unit, you should be able to:

use some simple and important Linux commands;

understand the concept of standard input, standard output and standard error;

be able to use filters and pipes to connect commands together;

write simple shell scripts to produce your own commands;

use the graphical user interface to perform tasks without needing the command
line, and
use the programmer's editor iv,
2) There would be Inore than one way. You can enclose the entire filename in Linux Commands
single or double quotes, or you could escape the spaces with a \ immediately and Utilities
preceding the space character.
Check Your Progress 9
1) Try Yourself,
2) Use Is -1

3) While you could certainly store information in the filename itself, that would not
offer the same convenience as storing the informati011in the file. This is because
you could not edit the filename conveniently, or find patterns in it or use ally file
Structure Page Nos.
3.0 Introduction
3.1 objectives'
3.2 Some Useful Commands
3.3 Permission Modes and Standard Files 45
3.4 Pipes, Filters and Redirection 50
3.5 Shell Scripts 53
3.6 Graphical User Interface 60
3.7 Editor 61
3.8 Summary 65
3.9 SolutionslAnswers 65
3.10 Further Readings 65


tasks for which there might not be any single command available. You will learn to

perform liiany tasks without issuing any commands on the command line. Finally, you
will look at the editor, vi, available in Linux for you to edit text files.

Because of the large amount of material to be covered, we will have to be brief.

After studying this unit, you should be able to:

use some simple and important Linux commands;

understand the concept of standard input, standard output and standard error;

be able to use filters and pipes to connect commands together;

write simple shell scripts to produce your own commands;

use the graphical user interface to perform tasks without needing the command
line, and

42 use the programmer's editor ivy

In the last unit, you have seen how to use some basic Linux commands like Is, cd and
pwd. We will now look at some more useful commands that are commonly required.
Linux has a large number of commands some of which are useful for system
administrators, some for software developers and so on. Here we will consider onlv

description you should refer to the documentation for the command.

File Manipulation Commands


You have so far learnt how to see directory listings that tell you the contents of a


prints out the contents of first-f i1e on the screen.

Remember that Linux is not concerned with what kind of file fi rs t-f i 1e is. If it is
an executable file or a file produced by using some editor that does formatting, then the
output will most likely not be intelligible to a human reader. In any case, the file will
probably be printed out so fast that you will not be able to see anything but the last
screenful. So it is actually useful only if you want to see what is there in a small text
file. There are other forms of the command that you will study a bit later in this unit.

For now, try the following command

[kumarr@,linux kumarr] cat first-f ile second-f i1e

You will find that the contents of both the files are printed on the screen one after the
other without any kind of gap in between. Actually cat stands for concatcaate, that
is, join the files together. You can give any number of arguments to the cat command
and it will print them out on the screen in the sequence you have specified. You will
see later how to use this facility to advantage.

tail I

Sometimes you might only be interested in something at the end of a text file. You
could use cat and see what lies at the end, but if the file is a big one, you could be
waiting for quite a while before the gobbledygook on the screen stops and you can
make sense of what you see. For such a situation, you can use the tai 1 command.
It shows what is in the last part of a file.

This prints out the last 10 lines of first-file. What if you need to see something that is
in the 14thline from the end? You can say

You can use any other number instead of 14 that you need. So to see just the last
three lines. sav
Linux Operating System Like c a t , you can give multiple file names as arguments; the last part of each is
printed out with a header showing the name of the file that follows. Some other useful

I being the number of bytes you wanito see.

This command lets you compare two files and determine whether their contents are
the same or different. If they are the same, thtl command says nothing. Otherwise it
prints out the first byte for both files whefe there is a difference between the two.
There is also the -1 option to print out all diffetenced.

Remember that if one file is a part of the other, they are still considered to be different
This command compares two Ales h e by line and reports the differences between
them. Unlike the mechanical comparison of the cmp command, di f f makes a much
more intelligent com~arison.It indicates the differences between the files in three


n e r e is also the -b option to diff that ignores white space, and the -B option that
ignores blank lined.

This command counts the number of characters, words and lines in a text file. You

characters. the -w o~tionto re~ortonlv words and the -1 o~tibnto r e ~ o konly lines.

You can also combine options together, such as -c 1 to report characters as well as
This is a useful command that lets you print out the contents of a file in sorted fashion.
You can choose the delimiter that separates fields and the default is the space
character. It produces output on the screen by default but you can place the output
into a file using the -f option.
[kumarr@linux kumarr] sort unsort ed-f i le

I There are several options to sort on fields, to use numeric order, to choose the collating
sequence and so on.
There are many other usefhl commands that manipulate text files. The tr command
can be used to translate or change characters in a file. The spl it command breaks
up large text files into a number of files with a fixed number of lines each. The cut
command can be used to produce vertical sections of a text file. To get formatted
output on the screen, rather than the plain dump of the file that c a t gives, you can
use the pr command.
rg Check Your Progress 1 Linux Utilities
and Editor

I Try using tlie cat colnmarid on a directory. What do you see?



2) \'hat happens if you try to cat a non-existent file?

3) The c m p command normally reports files as different if they differ in any way.
Supposeyou have two files that differ at the beginning but their last portions are the
same. How can you ascertain using cmp that two files are the same after a certain



4) Are you able to use wc on a binary file? Are the results meaningful?



We will now see what file per~nissionsare and how to change the permission modes of
files and directories. So far we have had occasion to look at various conimaiids, many of
which have to do with files of various types. The permissions of files can make a great
deal of difference to tlie way tlie commands behave. What are these?
You have already seen in Unit 2 that the long form of the Is command, the one witli the -1
option, tells you about the per~nissionsofthe file.
[kuniarrO,linux kuinarr] 1s - 1
total 32
-rw-rw-r- 1 kumarr users 4 Oct 15 01:18 abc
-rw-TW-r- 1 kumarr users 4 Oct 16 17:31 abcd
-rw-qw-r- 1 kumarr users 5 Oct 15 01:17 ahc\d
1 kumarr
- users
2 kurr~arr users
5Oct 15 01:17abc d e f
4096 Aug 21.20:33 -file$
drwxrwxr-x 3 kumarr users 4096 Oct 9 18:Ol ignou
-rw-rw-r- 1 kumarr users 27 Oct 11 22:51 xx
-rw-rw-r- 1 ,kumarr users 75 Nov 2 22:13~~-xx.c
The first column of the first field has a "d" in it if the file is a directory. So ignou and
-files are both directories. For ordinary files, tlie first column of the first field is a
Linux Operating System hyphen. The next 9 columns specify the file permissions. The user community in
Linux is divided into tliree categories - owner, group and others. The owner is the
person who first creates the file. Several users at an installation can be made part of a
user group. Such a facility is useful in keeping working on the same project or
department categoriesed together. All group members form the second category of
users. Finally, the rest of tlie community is lumped under others, which are users who
are neither the owner nor part of the same group. In the example shown above, the
owner of the files and directories is kuniarr and he belongs to tlie group users. Other
users might also belong to the same group, though it is quite possible for kumarr to be
the only one who is part of the group.
Having studied this characterisatio~iof Linux users, you can now begin to understand
the permission modes. Every file lias three possible modes of access - read, write
and execute, represented in the directory listing by r, w and x respectively. A file to
which you have read access can be read by you, which means you can look at its
contents by using any method like the c a t command. If you have write access to a
file, you can alter its contents. Execute permission is relevant in the case of
executable files like those that we have seen inlbin, or for shell scripts. that we will
study later in this unit. You can run or execute a file only if you have execute
permission on it. Execute permission does not mean anything in tlie case of text files,
nor actually for any file that is not executable, except for directories wliere this
permission lias another meaning.
Now you know enough to understand the permission information. 'The nine colun~ns
are divided illto three parts - owner, group and others - of three columns each. The
permissions are specified in the order read, write and execute. If a permission is
available, the corresponding letter is shown, while tlie absence of a permission is
indicated by a hyphen. So rwx means the category concerned can read tlie file, call
write to it or alter its contents and can execute tlie program which the file contains.
Similarly tlie permission r-x means that the file can be read or executed but not
altered or written to, because write permission is absent. r- means tlie file can only
be read, and -x means it can only be executed. -- liieans that there are no
permissions available and the file cannot be accessed at all. However, you can still
see an ordinary file like this listed in a directory listing taken in tlie usual way. So you
see that the permission columns in the listing show11above meall that for directories
the owner has read, write and execute permission, whereas other members of liis
group have read and execute permission but no write permission. Similarly others, that
is, users who are not part of the owner's group, also have read and execute but no
write permission. Thus ifyou want to have all the permissions on a file, while denying
group members write permission and allowing others only execute permission, tlie
permission modes should be rwxr-xr-x.
With this knowledge, you should again look at tlie Linux system files and study the
owners and permission bits for each. You will find that all useu have executed
permission on the files containing system commands. This is obviously necessary
otherwise you could not use those commands. If possible, ask your system
administrator to remove your execute permission on the Is command for a short while
and then try to see your directory listing. If you are at a large installation where this
kind ofthing might not be possible, you can eitlier wait until you kriow more about
Linux to be able to see tlie effects of the absence of permissions, or ask somebody to
make a copy of a system command in your directory, reliiove execute permissions on
it and try to run it from your directory. Here you must take care not to run the system
version of that cemmand.
So far we have talked only about ordinary files and what file per~nissionsmean in their
case. But directories are also files, as you have seen earlier. Do the permissions all
have the same meaning wliere directories are concerned? If so, what is it like to
execute a directory? Let us delve a bit into this and find out some answers.
First of all you must understand that directories are special kinds of files, which co~itai~i Linux Utilities
information about other files, tlie permission bits have somewhat different ~iieanings
than what a hasty guess would suggest. Before we even look at what read permissio~i
for a 'directory means, try running the cat command on a directory ar~dsee what output
you get. Linux will report an error and tell you that you were trying to cat a directory.
[kumarr@,linuxkumarr] c a t ignou
c a t : ignou: Is a d i r e c t o r y
Actually a directory contains information on the files it contains, such as their names.
Knowing this, it should be easy to deduce what read permission for a directory could
mean. If you can read a directory you can see what files are in it, which means you
call do an Is on the directory. In the absence of read permission you will not be able to
look at tlie directory listing for that directory.
What about write permission? If you have write permission on a file you can cha~ige
its contents. In the same way, having write permission on a directory allows you to
change its contents. What does that mean? Creating, renaming or removing files
would mean altering the contents of that directory. So it follows that having write
per~nissio~ion a directory enables you to create, rename or delete files in that directory.
Beginners often find it a bit difficult tograsp this point though it is not really hard to
understand. You should remember that having write permission on an ordinary file
allows you to change the contents of the file but does not allow you to delete or rename
the file. That is possible only if you have write permission on the directory containing
tlie file. Later we will see how this could lead to a security lapse in some situations.
I>astly.coming to execute permission you would agree that there is no way you could
execute a directory corresponding to the normal sense that the operation refers to for
an ordinary file. For a directory this permission bit determines whether you can cd to
the directory or can copy files from that directory (this only if you have read permission
on the directory as well). This permission is often called search permission. To be able
to cd to any directory you must have search permission on every component of the
absolute pathname of the directory. If search permission is absent on any'component,
all files and directories on that component and below it become inaccessible.

will be sufficient to know that some other permission modes exist sathat you do not get
taken aback if you find characters other than r, w or x in the permission modes of a

Changing Permission Modes

We will now see how to change the permission modes of files and directories, The
action of a command can differ greatly depending on permissions. For example, the
c a t command will usually type a file on the terminal but will refuse to do so if the user
does not have permission to read the file.
How do we change the permission modes of a file? The command to do so is chmod.
It can be used only by the user who created the file or by the superuser. The owner is
the user who created the file first, by any means such as by using a text editor or by
copying an existing file.
Note that having all permissions on a file does not amount to owning it. If you can read
somebody else's file, it does not meall that you can prevent others from doing the same,
but you can establish such protection for a file of your own. Also do not get confused
between the original file and a copy you might have created, having oidy read access to
the source file. You can change your copy in any fashion you wish, but you will not be
able to alter the original.
L I I I U ~Operating System There are two forms in which you can use the chmod command. Let us look at the
absolute method first, as it is slightly easier to understand and use. In this the
permission mode desired for the files is given to tlie conlmand in an octal notation that
we will explain shortly. The mode of tlie file then gets changed to what was asked
irrespective of the perniissions before the command was run. The form of the
command is thus
[kuniarr@linux kumarr] chmode mode file
where filename is a list of one or more files whose pe1.111issionmodes are to be set
to mode. If the permission bits are mode to start w~tlithere is no effect on the file or
files after running the chmod conimand.
You know that file permissions are specified by 9 columns, for example rwxr-xr-x
or rw-r-r-. In the absolute method the presence of a per~nissionis indicated by a I
and its absence by a 0. The resulting 9 bit binary number is then converted to octal.
This octal number is what has to be specified as tlie mode for the chmod command.
You know that a binary number can be easily converted to octal by making groups of
3 bits starting from the right. Now convert each group into octal as if it were a single
number. The resulting string of octal digits is the number in octal. Thus
can be written in binary as 111101101 after replacing each per~nissionby a 1 and
each hyphen by a 0. This binary number can be written as 111 101 101 after
grouping tlie bits in threes. The octal form of the number is thus 75 1. So to convert a
file to this mode say
[kumarr@linux kumarr] chmod 7 55 progf 1 le
This will give progf ile the permissions rwxr-xr-x.Likewise rw-r-r- in
octal is 644. So you can provide these permissions to your file motd by saying
[kumarr@linux kumarr] chmod 6 4 4 motd
Instead of one file you call set the permissions on several files at the same time (all to
tlie same value) by listing the files after the mode. So
[kumarr@linux kumarr] chmod 6 00 mot d pas swd
will make their permissions rw--. Thus you can read these files or change them
whereas nobody else (except root) can even read them. So
[kumarr@linux kumarr] chmod 0 pas swd
will mean nobody has any permissions on-the file passwd and even you will not be
able to read a file of your own with such a set of permissions. However, you call
change the permissions any time since you own your file. Also, the super user can
change the permissions of any file.
Let us now look at the symbolic ~netliodof telling chmod the mode. Here the
permission types are, as always, r, w and x. I n addit~on,there is a set of characters
wliicli specify the target of the actions. Tlie target can be u (users), g (group). o
(others) or a (all of these). Tlie actions are + to add a permission, = to set it
absolutely and - to remove a permission. So you can say (there must be no spaces in
the mode argument)
[kumarr@linux kumarr] chmod a+x progf ile
to allow eve~ybodyto run progfile, irrespective of the earlier execute permissions on it.
However, this is different from saying
because this would remove read or write permission for everybody, whereas in the
earlier case, those permissions would have been left untouched. If tlie owner had read,
write and execute permission, lie would retain it. If the group earlier liad read and
execute permission it would continue to liave that privilege. If others had no
permission, they would acquire execute permission. One can remove read arid write
permissions for others by saying
[kuinarr@,linux kumarr] chmod o-rw progf i l e
Oiie can specify absolute permissioiis by saying
[kuinarr@linux kumarr] chmod u=rwx,g=rx,o=x progf i l e

You might find tlie liunierical way easier to use. However, if you do not want to alter
some permission bits, there is no straightforward alternative to using the symbolic
mode. For example, if you want to deny others any per~nissionon a file but do not
want to alter your owl1 or your group's permissions, you can say
[ku~narr@linuxkumarr] chmod o-rwx progf i l e
But to achieve tlie same result i~siiigthe absolute rnetliod you would have to first
determine the existingpermissions. Suppose tlie value is 644. You will now have to
[kumarr@linux kumarr] chrnod 640 progf i l e
lfthe initial permissions were 666, you need to say
[kumarr@,linux ktimarr] chmod 6 60 progf i l e

permissions intact.

c p Check Your Progress 2

1) Try executing a directory on which you do not have search permission, and
another on which you do have it. What happens?

1) Can you look at tlie listing of a directory if you do not liave search permission on
it? Whyr?


3) Can you remove files form a directory if you lack per~nissionon them?


..................................................................................................................... Al
Linux Operating System
By now you have seen quite a few Linux commands, and you must have observad that
many commands produce or can produce output on the terminal screen. Likewise
many commands can take input from the keyboard. Actually, these commands have
been written to accept input from a standard input file and to produce output in a
standard output file. Usually these files are set to the keyboard and the terminal screen
respectively. Let us look at this in somewhat more detail by studying some examples.
Standard Output

rkumarr@linux kumarr] ca 1
which prints the calendar for the current month and year on the screen. In practice
there are very few commands designed to produce output on the screen specifically.
The programs are written to produce output on what is called the standard output, and
Linux sets the standard output to be the screen by default. That is how the output
happens to appear on the terminal.
The shell, which interprets all your commands and passes them onto the Linux kernel
for execution, has a facility to alter the standard output. In other words, you can define
a file, rather than the screen, to be your standard output. (Actually the terminal screen
is also a file as far as Linux is concerned.) To do this you need to say

There can be zero or more spaces before and after the sign. This sign indicates that
the standard output of the command preceding it should go to the file specified to its
right rather than to the terminal screen. This is called redirecting the standard output.
In the current case the calendar for the current month will be placed in the file calfile.
You can verify this by

although you could have redirected this output as well.

[kumarr@linux kumarr] cat calf i le > cat f i le
Is that not a way of copying calfile to catfile? Note that the file to which output gets
redirected gets overwritten if it already exists. You can verify this easily by
rkumarr(ii)llnuxkumarr] 1s -1 > calfile
and now examining the contents of cal f i 1e.
There is another operator, which appends output to the file specified rather than
overwriting it. This is achieved by

Now calfile will contain the calendars for the current month as well as for June 1994.
Compare this with
[kumarr@,linuxkumarr] cal 06 1 9 9 4 > calfile
which leaves only the calendar for June 1994 in calf i le.
Thus the >> sign is safer to use because it never destroys any data, but this operation
will keep adding to the file, and it can sometimes be difficult to make out what part of
the output was produced by your last command and which portion is the outcome of
previous redirections or was simply the original content of the file.
Standard Input Linux Utilities

Just as many commands produce output on the screen, some commands take input
from the keyboard although most take input from files. Look at an aspect of the cat
command you have not studied so far.
[kumarr@linux kumarr] cat
The result of this command is deafening silence. The uninitiated might wait several
minutes before aborting the command, thinking there is something wrong because the
system does not appear to be doing anything at all. The truth is that cat can take its
input both from the standard input as well as from a file. However, the output is
always produced on the standard output. If any filenames are specified they are used
as the input but if none is mentioned the input is taken from the standard input. There
are also some commands that take input only from the standard input.
In the present case no filename has been specified and cat is waiting for input from
the standard input, the keyboard here. So if you type something cat writes it out to the
standard output and the effect is that of echoing your input.
A foolish consistency is the hobgoblin of little minds -Emerson
A foolish consistency is the hobgoblin of little minds -Emerson
If you want to put an end to your misery you can terminate your input file by saying "d,
thereby causing cat to finish and present you with your prompt.
To redirect standard input, say
[kumarrO,linux kumarr] cat < cat fi1esrc
whereupon cat will print the contents on the screen. This is just the same as
[kumarr@linux kumarr] cat cat f i1esrc
because cat can take its input from a file as well. So to copy this file to
catf iletarget, you can say
[kurnarr@linux kumarr] cat c cat filesrc > catfiletarget
[kumarr@,linuxkumarr] cat catfilesrc > catfiletarget
Thus you can redirect both standard inpu, and standard output in the same command.
Some commands do not take input from the standard input. In such cases redirection
of the input is not possible, as with the 1s or who commands.
Remember that redirection is a facility provided by the shell, not by the command.
The command being run does not know or care what its standard input and output are
connected to, and it continues to use them. So the command has to be designed to
take input from the standard input if redirection of input is to be possible. Thus you
cannot say
[kumarr@,linux kumarr] cp c cpsrcf i1e

because cp does not take its input from the standard input. Similarly, output redirection
is not possible unless the command is designed to write to its standard output.
Standard Error
So far we have seen the effect of redirecting the output of some commands that
completed successfully. Let us look at this a bit more closely. For example, if there is
no command like gah, say
Linux Operatiag System

If you do so you will find that you get a protest message from Linux on the terminal
but that gahfile is empty. Similarly

produces a message on the terminal but nothing in Isfile. Why does the redirection
fail? After all the command did produce output.
The reason is that there is a third standard file in Linux, called the standard error.
Linux utilities and programs are usually designed to provide error messages in case
there is something wrong and the program is not able to proceed as expected. Such
messages are often referred to as diagnostic output because they can help the user
diagnose the reason for failure. This kind of output is usually written to the standard
error file. Usually the standard error is also connected to the terminal by default, but
like the standard input or output, the standard error can also be redirected. To do this
in the bash shell, say
[kumarrO,linux kumarr] gah 2 > gahf ile
This will place the standard error in gahfile. How does one place both the standard
output and standard error in the same file? For this, say

To redirect the standard error and standard output to different files, say
[kumarr@,linux kumarr] 1s - 1 gahf ile y y > 1sfile
A filter is a command which can take its input from the standard input and can
produce output on the standard output. Having the capability to read from or write to
files is not a disqualification. So Is is not a filter because it does not read from the
standard input but cat is one because it can do so (although it can read from a file as
well) and also writes to the standard output.
You can think of a filter as a "device" placed between the standard input and the
standard output which filters the standard input before placing it on the standard
output. In the case of cat there is no filtering action at all, but a command like grep
does perform some weeding action on its output.
The standard output of a command can serve as the standard input of another.
Several commands can be chained together like this. Such an arrangement is called a
pipeline. Pipelines are one of the big strengths of Linux, because they often enable us
to group several existing commands quickly to perform a task for which there is no
command directly available.
A major design goal of Linux was to have an operating system which allowed easy
sharing of data and programs, and allowed people to build on the work of others
instead of having to do things from scratch. The facility of pipelining helps meet this
goal because you can piece together commands written by different people to achieve
your objective rather than wasting your time on doing things which have already been
done. Let us take a simple example.

Suppose you want to find out how many ~f the files in a directory are directories
rather than ordinary files. It would have been wonderful if there had been an option to
Is which did this job, but since that is not the case we will have to try something else.
One-way is to look at the directory listing with Is -p and count lines, which end in I.
Such a visual method is tedious and prone to error, especially if there are many files in
the directory. So let us try to make Linux do this for us. How about the following?
[kumarr@linux kumarr] I s -1 -p > tmp Linux Utilities
and Editor
[kumarr@linux kumarr] grep -c ' / $ ' tmp

We first get the listing in a temporary file tmp and then count the number of
occurrences o f / atthe end of a line in tmp using the grep command. The result will
be available on the standard output. While this method will work it has a few
disadvantages. One is that it is slow because an intermediate file has to be created.
Secondly we cannot start the g r e p command before the Is finishes. Also if we run
many commands like this we will be left with temporary files, which we will have to

[kumarr@,linux kumarr] Is - 1 -p I g r e p -c ' / $ '

The ' 1 ' symbol is the pipe character. It means that the standard outpu of Is -p is passed
to grep. The act of connecting the standard output of a command to the standard input
of another is also referred to as piping the output of the first command to the second.
Here no temporary files need to be created or cleaned up by the user as Linux itself
takes care of the details. Also the speed improves because the subsequent commands
can start as soon as some data is available to them.

A co~nniandlike Is which does not take its input from the standard input can only be the
first command in a pipeline. Similarly a command which does not write to the standard

otherwise the results will be gibberish. Thus do not pass data files other than text files
to grep because grep works only with text files, with lines delimited by the newline

Check Your Progress 3

Which of the commands you have learnt so far are filters?

2) How will you count the number of all files in a directory? I

3) Look up the fee command. How do you think it can be useful? I

The shell in Linux is a wonderful entity that serves us in various ways. It is started up I
without having to type the full pathname to them, even when they do not exist i n the
current directory. The shell expands wildcard characters, thus saving you laborious
Linux Operating System You can use the shell as a programming 1al:guage. It has all the usual language
constructs like sequencing, looping, decisions, variables, functions and parameters.
Here we will take a very brief look at bash, tlie shell commonly used in Linux. A shell
itself is a program and there can be many different shells available. Linux also has a
sliell called tcsli that has a C like syntax and is an enhanced version of the Unix C
shell. Bash is the Bourne again shell and is compatible with tlie Unix Bourne shell. To
discuss the capabilities and features of bash to some extent would require an entire
block in itself. What we will try to do here is introduce some basic features and refer
you to the docu~nentatio~i or to other books on the subject for more detail. To become
cornfortable with sliell programming, you will need to practlce a lot, just as you would
need to do for any other programming language.
After writing some shell programs you will realise that some Linux commands like sed
that earlier seemed to you to be of limited utility are act~lallyvery useful. Shell
programs are often called shell scripts.
A Linux machine can be thought of as being composed of several layers. At the
lowest layer is tlie hardware wliicli does all the physical tasks and without which there
would be no computer and no Linux. Above that is the Linux kernel, wliicli is the core
of tlie operating system and does ~nelnorymanagement, device handling arid all the
otlier mundane tasks needed to make the hardware easily usable by us. The Linux
commands and utilities come next. At tlie top is tlie shell wliich can be considered to
be the outermost layer and which enables us to run tlie utilities and otlier Linux
commands. You can also construct higher application layers of your own wliich run
above the sliell. However, despite the layering tliat we liave talked of, the sliell is itself
a program like any other.
Wild Cards
Wild cards cliaracters are cliaracters which can stand for cliaracters otlier than
themselves, somewhat like a joker in a pack of cards (though, unlike wild card
characters, a joker has no intrinsic meaning by itself). A judicious use of wild card
characters can make many co~nlnandseasy to issue by saving a lot of typing and
preliminary research. Suppose you have been writing a series of programs for
enciphering text. You liave been calling them cpliO1 .C, cpli02.C, cpli03.C and so on.
You suddenly realize that you liave been doing this in the directory -khanidcrypt, while
actually these programs are for a particular project and you would like them in the
directory -klianidcrypt/knapsack. All you have to do to rectify the situation is to lnove
your programs to the correct directory after creating it. So you can start off

[k~lmarr@linuxkumarr] mkdir knapsack

[kuniarr@,linux kumarr] mv cphOl . C knapsack
[kumarr@,linux kumarr] mv cph02 . C knapsack

Soon YOLIget sick of typing almost tlie same thing again and again, even if you just use
the up arrow key and keep changing tlie required characters in tlie filename.
Moreover, when do you stop? If you have used a naming convention whereby tlie
filenames have numbers from 0 1 onwards, you could stop as soon as the mv command
reports tliat the file does not exist. But this metliod is hardly a rigorous one. What if
there are gaps in tlie sequence, and cph08.C does not exist but you liave otlier
programs going up to clip39.C? So you would have to keep lookitig at the directory
listing first, and also from time to time in tlie process, just to be sure. With many such
files, tlie method is tedious and prone to error.
There is mucl? less effort if you use wildcards. After making the subdirectory, just say Linux Utilities

The ? is a wildcard character that can stand for any single character including itself.
So cph?? .C expands to cph followed by any two characters and then by .C. Also
remember that ? stands for exactly one character. Therefore a filename like cphl .c
will not be matched by the command given above. To match that filename, you would
need to say cph? .C. So the command given will leave any files from cphl .C to
cph9 .C in the original directory.
What do we do if our naming convention for files starts the filenames with cph but
allows any characters after that, with of course .C at the end? Does it mean we have
to give several mv commands with one, two, three, and many more ? characters? That
would be quite tedious again. Also, after how many ? characters could we stop,
knowing that there is no specific limit on the number of characters in a fileriame? The
answer to that is another wildcard character, the *. It can expand to any number of
any other characters. So all you have to do is to issue the command
[kumarrOlinux kumarr] m v cph* .C knapsack
However, the * does not expand filenames starting with a leading . character. Also, in
bash, a filename like yy* .c is not expanded unless there is at least one filename
around to which it expands. So if you do not have a filename starting with yy and you
issue a command like
[kumarr@,linuxkumarr] v i yy * . c
what the vi editor will create is a file called yy * .c. Tf a file like yyl .c already
exists, then you can create yy * .c by escaping the * with a backslash, so that it is
taken I iterally.
[kumarr@,linuxkl-marr] v i yy \ * .c
You can create a file called yy? .c in the same way, though it might be a good idea to
avoid such characters in filenames to prevent confusion.
Simple Shell Programs
Let us now look at a simple shell program. Suppose you are kumarr and are working
on your cryptography project in a directory -/prj /crypt/pkc/ src,where your
source files are located. But sometimes you are looking at documentation in another
location, or are also working on some other project. To look at the files ie this directory
you have to issue a longish command, which can be cumbersome if you have to do it
often. What you can do instead is to create your own shell program, say in a file called
wd. This you can do using any editor. The file wd should,contain
1s -/prj/crypt/pkc/src
Now you need to make wd executable by setting its permissions to 755. Otherwise
you would need to invoke it by saying

But if you just said wd, it would not work because when bash is given some command
to execute, it looks for the commands in different directories in a fixed sequence.
Typically this sequence is /usr/local/bin, followed by /bin and lusrlbin, but this can be
controlled in a way we will describe shortly. Since wd is not in any of those directories,
Linux complains. So you can say - /wd to take care of this problem.

What we have now done is created a command of our own that anybody can use.
Currenly it allows others to look at our directory, something we might not really care
to do, but it nevertheless illustrates the point. And we have created the command by

Linux Utilities
and Editor
Linux Operating System taking an already available command and using it in a different way. This is at the
core of the Linux philosophy of building on the work of others.
Many installations have locally useful commands available in /usr/locaVbin. You
could also be contributingto this repository of useful commands by and by, and you
should first explore to see whether the task you want to do is not already
accomplished by using these commands. However, before you can release shell
scripts for general use, you will need to make them robust, which is something we
have not looked at in the current case. If you have some commands that you feel
you need but are not fit for general release, you can place them in your own bin
directory like -/bin.
Suppose the system default form of the 1s command at your installation is not what
you find useful; you would like it to be 1s - 1. One way is to create a new
command like Is that contains the line /bin/1s - 1. Note that if you put only 1s
- 1 in your private command, it might keep calling itself indefinitely and so will not
work. Also your program will not be able to use arguments because we have not
given that ability.
Variables can be defined and used in bash like in any other programming language.
For example, to set the value of a variable vehicle to "bus", you can say
[kumarr@,li.lux kumarr] export vehicle=bus
To see the value of a variable you can say
[kumarr@,linuxkumarr] echo $vehi c
If the variable has not been defined, nothing is printed. You can also print several
variables together or print literals using the echo command.

bus and car

To set the value of a variable to the output of a command, give the command in
[kumarr@linux kumarr] export mydi r = pwd '
[kumarr~linuxkumarr]echo Smydir
To let your command take arguments, you can refer to them as $1, $2, $3 and so on
up to $9. $0 stands for the command itself and $10 would be interpreted as $1
followed by 0. If you want to use all arguments then say $*. Similarly, $# stands for
the number of arguments. So if you write a command ech that echoes only the first
and fifth arguments, it would have

/bin/echo $1 $5
Now you would find the other arguments would be ignored. The shell has several
inbuilt variables of its own that you can look at by using the env command, to show
the environment. You would be able to recognize several of them such as HISTSIZE
for the number of commands that are kept in the history buffer, LOGNAME for your
login name, SHELL for the shell you are using, HOME for your home directory and
SO on.

Linux Operating System

f to see if it is an Ordinarv
.- ,.-+
. --
Programming Constructs . Linux Utilities

The shell scripts we have seen so far have been nothing but a sequence of commands
that we could have anyway issued at the prompt itself. Shell programming would not
have been of much use in that case. What makes it powerful are the programming
constructs available such as loops and decisions. Let us first look at a program
mkupper that converts the contents of its arguments to upper case.
[kumarr@linux kumarr] cat mkupper
for i in $1 $2 $3
tr '[a-21' ' [ A - Z l ' < $i r $i.up
This converts the contents of up to three files to upper case and places them in a file of
the same name with a .up suffix.
Besides the for loop, you can use the while or until loops with their usual meanings.
For example, the script above could be written
[kumarr@linux kumarr] cat mkupper
while test $ # -gt 0
tr '[a-21' '[A-Z]' < $1 1 $l.up
Here suppose there are 25 arguments to the mkupper command. The condition in the
while loop tests whether there is an argument available. If so, the contents of the file
are converted to upper case. After each argument has been dealt with, it is discarded
and the next argument becomes the first argument. This is done by the shift
command in the mkupper file. Finally when there are no arguments left, the test fails
and the loop terminates. You can achieve a similar effect using the unt i 1 loop, given
if test $ # -eq 0 ,

then echo 'No files to translate'

until test $ # -eq 0
tr ' [a-z]' ' [A-Z]' c $1 > $l.up

The test operation can be used to check various conditions, such as if a variable equals
a number. You can also use the other relational operators with the keywords let
gt 1t gc and ne. Other tests that can be performed are -w or -r for
checking if the filename is writeable or readable, -d to check if it is a directory and -
Linux Operating System f to see if it is an ordinary file. In the script above we print an error message and exit
if there are no arguments to the file. We could also have chosen to exit silently in suoh
a case, as we did with the while loop example. Or we could wait for input from the
standard input. The example also shows how to make a decision using an i f
statement. The statement is terminated with the f i keyword. The else part is
optional. We can also use the exit keyword to break out of the shell script. Several
else parts can be present in an if statement, they are then introduced with e1if. Let
us take an example script called countargs that counts the number of atguments and
prints the result.
if test $ # -eq 0
then echo "No arguments"
elif test $ # -eq 1
then echo "Only one argument"
elif test $ # -eq 2
then echo "Two arguments"
echo "Many arguments"
Within a loop you can use the break and continue statements to exit the loop or
to go back to the beginning of the loop respectively. Comments are introduced by the
# character. Anything after this on a line is treated as a comment. In a shell script,
like in any program, it is important and recommended practice to provide comments
that explain the working of the program.
You can also use the case statement in place of multiple if . . .eli f statements
when it is the same condition that has to be checked each time. For example, let us
write a shell script that checks the first argument to decide the operation to be
performed and then performs the operation on the second argument. The case is
terminated with an esac statement.
if test $ # -ne 2
then echo "Usage: $0 operation files"
case $1 in
upper) tr ' [a-zl' ' [A-Z]' < $2 > $2.up;;
lower) tr ' [A-Z]' ' [a-z]' < $2 > $2.1~;;
*) echo "Invalid operation specified";;
You must bear In mind that the options in the case statement have to be specified in
the right order. If we give the *) option first, then it would match every case and the
script would do nothing.
You can also pass input from the user to a shell script. For this use the read
command. Take the following simple script that prints out the directory listing as
desired by the user. It has a friendlier interface than the Linux command 1s.
echo "1 for long listing" Linux Utilities

echo "2 for stream list"

echo "3 for single column list"
read x
case $x in
1) Is -1 $ * ; ;
2) 1s -m $*;;
3) 1s -1 $*;;
*) echo "Invalid choice"
In the read statement you can assign values to several variables. The first value goes
to the first variable, the second to the second variable and so on. If there are more
values provided by the user than there are variables, the extra values go to the last
variable. If there are few values, the remaining variables do not get any values.
Values are delimited by spaces and a newline character causes the assignment to
happen. So if you say
[kurnarr@linux kumarr] read x y z

[kumarr@,linuzc kumarr] echo $y

You simple arithmetic in the shell with th'e expr command. The operators and
operands have to be delimited by spaces. When you use the * for multiplication, you
have to escape it with a \, lest the * be expanded to all available filenames.
[kumarr@linux kumarr] expr 2 + 3
- kumarr] expr 18 / 3
rkumarr@linux kumarr] expr 4 \ * 5
[kumarr@linux kumarr] expr 7 - 5
To help debug shell scripts you can use the -v or -xoptions that give verbose output.
The -x option precedes each command with a + sign. Thus
[kum;irr@linux kumarr] bash goodls -v
will print each command as it is executed.
Linux Operating System cp Check Your Progress 4
1) Try the command?
Write files does it neglect to furnish you with? How can you get all filenames?


2) Write a shell script that prints out the contents of some fixed file in upper case.
3) Write a shell scriptthat prints out a list of every unique word contained in the file in
alphabetical order?


Unlike the early versions of Unix, Linux has a good graphical user interface (GUI).
This makes it different from the cryptic command line interface that proved daunting to
most lay users who ventured to try Unix. Most of the common operations can be
performed graphically and it is not necessary to use the command line. However, the
power that the command line gives is still available to power users.
When you login you are presented with a text based screen, but thereafter you can
have the system set up so that you reach the graphical user interface mode. This cati
be done by issuing the command
[kumarr@linuxkumarr] s t a r t x
whereupon the X-window system is started up and you reach GUI mode. You have a
default of 4 desktops that are available to you. Each of these can be arranged
differently as you wish. To start up a terminal session,just right click the mouse on the
desktop and select the "New Terminal" option. You will get a terminal window where
you can use the mouse as well for editing, such as copy and paste. These options are
available by right clicking the mouse or by choosing the Edit option on the menu bar in
the terminal window.
The bottom tray contains some useful icons that will depend on what software
packages have been installed. The leftmost icon is the red hat, the logo of the version
of Linux that we are studying here. It has a small arrow to its right, clicking which
brings up a list of options such as Accessories, Games, Graphics, Internet, Office and
so on. Many of these options have further suboptions that you can select with your
The tray typically would contain icons for invoking the browser, email, the Open Ofice
Writer, Presentation software and the spreadsheet, a printer manager and the icons for
the desktops. To invoke any application, simply click its icon once in the bottom tray.
This saves you having to know the name of the program for each application. When
you move your mouse over any icon, a small explanation of the icon appears in a
yellow box. It tells you the name of the program and what it does. This mouseover
makes it easy for you to identifLthe correct icon for the program you want to run so
that you do not have to rely on your memory to locate it.
If you right click on any of these icons, you get a menu where you have options to look
at its properties or obtain help on the application. You can also remove the icon from
the tray, but then ifyou want to run the application you will have to locate it in the
directory structure. You can also move the icon around in the tray.
At the very left you have an icon in the shape of a red hat with an arrow pointing Linux Utilities
upwards. Clicking on this brings you to the main menu that has several options and and Editor
suboptions. For instance, you can go to your home folder using one of the options.
You can also copy and move files using mouse commands, or simply drag and drop
files from one folder to another if you want to move them.
While in the folder window, you can right click the mouse and create a new folder.
You can also rename folders or files or delete them.

Linux is rich in text manipulation and document preparation facilities. Here we take a
brief look at v i , a line editor that is useful for creating and modifLing text files. For
example, if you want to be writing shell scripts or other programs, you will need an
editor so that the program file can be created.
Text editors are different from the commands you have studied so far because you will
be able to change existing files directly by using them. You need not be writing out the
file to be changed to another file. Moreover, editors are interactive in that you need to
be telling them what to do, command by command. This is unlike the commands you
have seen so far, where you give the command once and it then does its job and
terminates. Editors can be line editors or screen editors. Line editors work on a line at
a time. Two line editors available in Linux are ed and ex. In contrast, screen editors
present you with a screen of text and you can move around there, making changes as
you want. So screen editors are more powerful and easier to use. A screen editor
available in Linux is vi. Again because of lack of space we will only be able to look
at a few basic features of v i . It is a programmer's editor that is not too easy to learn,
Unlike some other editors, v i does not automatically create a backup copy of the file
being edited. Although editing does occur on a copy of the file, this copy is in the tmp
directory that gets deleted when you save the file. The actual editing is done in a
buffer in memory and the changes are written to the file only when you tell it to do so.
You can therefore easily abandon a session that has gone badly wrong. But the same
feature can be a problem in case of a system crash, though v i will try to recover as
much as possible of the file that was then being edited.
- It is diff~cultto describe an interactive command on paper and so v i is best understood
by trying out the commands on a terminal. To start up v i and edit a file called
linuxdoc, you say
[kumarr@linux kumarr] v i 1inuxdoc
At this the screen gets cleared, the file gets read into the edit buffer, the first portion of
the window to the buffer appears on the screen and the cursor is at the first character
of the line that you were editing when you last saved the file. This presupposes that
v i knows how to deal with your terminal type, a task that would have been ensured by
your system administrator when she set up your machine. You can resize your
window at any time you wish without affecting your file. The bottom line of the screen
shows the name of the file and its size in characters and lines. You can also see the
current cursor position at the right of this status line. At times when you give
commands to v i , the status bar disappears and instead you see the command that you
are issuing. We will shortly look at some of these commands.
The text that you enter in v i is organised in lines. The editor is not a word processor
and works only in non-document mode. So you need to explicitly tell v i when a line
has ended. Otherwise it will continue to add text to the line until it reaches its limit for
the length of a line. How do such long lines look on the screen? They are wrapped
Linux Operating System onto the next physical line on the screen if the width of the screen has been reached.
If you increase the width of the window you can see the line getting redrawn.
Similarly ifyou reduce the width of the window you will be able to see the line being
rearranged on the screen. While by mere visual inspection you cannot make out
whether multiple lines are actually the same line or are separate, you can easily find
out, say by resizing the screen or going to the end of the line by the $ command.
You can start up vi with more than one filename, and you can even give wildcards.
[kumarr@l inux kumarr] vi 1inuxdoc xx xx c .
[kumar@linux kumarr] vi * .c
In such a case the files are presented to you one by one. After you are done with the
first file, you are presented with the next one unless you choose to exit the whole
operation, in which case the rest of the files are not presented to you. In this respect
vi differes from other word processors where you can only bring up one file at a time.
In fact you can start up vi without any filename at all. If you do that you will be
presented with a blank screen and can then start entering commands. You can give
the file a name when you save it.
Another option with which you can start up vi is the -x option that allows you to
encrypt the file. You have to supply a key (you need to retype it to confirm) and when
you save the file it is encrypted with that key. To now read the file you must supply
the same key, without which it will not be intelligible. While not a foolproof method, it
will certainly safeguard you against the casual busybody. One more option to vi is to
open it in readonly mode with -R.You can navigate and examine the file as you wish
but cannot make accidental changes as you have to use the force options to
commands that alter the file. This mode can also be called up by using the command
view instead of vi.
The -r mode of vi tries its best to recover from system crashes. If you want to start
editing from a line other than the first, you can use the +n option where n is the line
number you want to be at. To go to the last line of the file, just omit the number and
simply say +.
From the number of different ways in which you can start it up, you would have had
some idea of the kinds of commands available and the bewildering array of options
that must be supported by vi. Now that you know how to enter vi, let us also learn
how to come out of it. You can save the file with :w and force a save, say when you
are in readonly mode, by :w ! . Similarly :qwill quit the file without saving changes
and :q! Will quit without trying to save any changes. To save and quit you can also
say :xor simply ZZ.
Navigating Around the File
When you open up a file in vi you will find the cursor at the line you asked for during
the invocation. Unlike a word processor, vi starts up in command mode. It does not
start inserting the text you enter. So any key you press is taken to be a command. vi
has many commands, and just about any key is likely to be taken as one. Once a
command is given, subsequent keys pressed will pertain to the command until you exit
the command. If you press a key that is not a valid command in command mode,
nothing will happen and vi will emit a beep.
For example, to move around the file, you can use the arrow keys. If your terminal
type is not properly set and you have some problem with them, you can use j , k , 1
and h for down, up, right and left respectively. The commands 1or h will work only
within the line. At the last or first character respectively of the line, they have no
effect. Similarly pressing k at the first line or j at the last line of the file has no
effect. To scroll forward half a screen, use "D and to scroll half a screen back, use
Similarly, "F and "B will take you forward and backward one whole screenful Linux Utilities
and Etlitor
respectively. If you are at tlie bottom of tlie screen and you press 1 or the down
arrow key, the display scrolls up by one line and your cursor continues to remain at the
last line. To scroll forward one line without changing the line at which the cursor is,
use "Y. Likewise, "E will scroll backward one line without moving the cursor. The
commands 0 and $ take you to the beginning and end of the current line respectively.
Operations on the window can blank out tlie status line, which you can always get
back by "G. To move forward one word, say w and use b to move backward one
word. But unlike the character at a time commands, this works througout the file,
which means that pressing b at the first word of a line will take you to the last word of
the previo~lsline. The command will not have ally effect if you are at the first word of
tlie file. Similarly w will have no effect at tlie end of tlie file. Note tliat b will bring
you to the beginning of tlie current word if you are not already there and to the
beginning of the previous word otherwise. Similarly e brings you to tlie end of the
next word if you are at the elid of tlie current one. and to the end of the curtent word
itself otherwise. These lower case commands define a word in a way that is similar to
the defiliition of an identifier in progra~n~ning languages like C. Tliis is very convenient
while programming, as vi is really a programmer's editor. Ifyou want to consider a
word to be a sequence of characters delimited by spaces, you can use the upper case
equivalents W, B and E.
*l'hesecommands all take counts. Tliis means 20W will take you 20 words forward
and 90b will take you 90 words backward, with the appropriate definition ofword.
The % colnrnand takes you to the matching opening or closing (, { or [ character. To
move forward a sentence, use ( and 1 to move a sentence back.
Similarly [ and ] move forward and backward one paragraph. These too can be
preceded by a number tliat specifies the count.
Adding, Deleting and Changing Text
By now you have a good idea of tlie kind of commands v i takes. With your feet wet,
it will not be hard to understand the commands for actually changing text. First let 11s
see how to insel-t text. You can do this by using the i command. This puts you into
insert mode. In this mode, whatever you type becomes part of tlie file. The text is
added starting from before the current position of the cursor. To come out of insert
~iiodeback into command mode, you call say ESC or " [ . You can also use I to insert
text at the beginning of the current line. Similarly, the a command adds text after the
current position of the cursor, and A adds text at the end of the current line. To open
up a new line under the current line, type o and use 0 if you want to open up a line
before the current line. To add a control character to tlie file, type "V followed by tlie
character. The s command deletes the current character and puts into insert mode,
while S deletes all text on the current line and puts you into i~isertmode.
Deleting text is similarly straightforward. The x command deletes the character at tlie
current cursor position but does not move tlie cursor. At the elid of the line, the
command brings tlie previous character under the cursor. So pressing x repeatedly
anywhere on a line will filially leave yo11with a blank line. The X command deletes
characters to the left of the current cursor position and on reachingthe beginning of
the line no more characters are deleted.
To delete more than one character use the d command. This has to be followed by
another letter to illdicate what is to be deleted. So dw deletes a word, db deletes a
word in the backword direction and dw and dB delete a word in tlie forward and
backward directions according to the respective definitions. Word deletio~ishappen
across line boundaries. When deleting words on tlie next or previous line, the two lines
are joined together. To delete the rest of a sentence from the current position, use d(,
and d) will do the same LIPto the beginning of the sentence. The same can be done
for paragraphs as well with the d { or d) commands.
Linux Operating System All the above deletion commands can be preceded by a number to indicate how many
times they should be performed. To delete a line completely, say dd, or use D to
delete the rest of the line from the current cursor position. Similarly dAwill delete a
line from the beginning till the current cursor position. These commands will not
-emove the newline character. To delete a block of lines, give the range preceded by
a colon, as in : 4 , 1 0 d to delete from the 4* to the lo* line (both inclusive). Here you
can use a . to indicate the current line and $ to indicate the end of the file. So :.,$d
will delete the rest of the file starting from the current line. You can also use the +
sign to indicate the number of lines to delete, as in :15 ,+8d to delete 8 lines starting
from the 15* line. I

Internally v i maintains the line number of each line in the edit buffer. You can
display line numbers by saying : s e t number or :s e nu. All commands that begin
with a colon have to be followed by the ENTER key before they will take effect.
Changing text is done in much the same way. The r command will replace the
current character with whatever you type next, while R places you in replace mode.
Then each character you type will replace the next character until you press ESC. To
replace a fixed number of characters by the same character, precede r with the count,
such as 23r. The command changes the case of each character that is a letter. It
too can be preceded by a count.
For changing blocks of text, use the c command followed by what you want to
change, such as cw for a word, c w to use the other definition of a word, c$ to change
text upto the end of the line and c A to change text upto the beginning of the line. To
change the complete line on which the cursor is located, use cc. You can precede cw,
cW, cb, cB or cc by a count to indicate how many words or lines are to be changed.
All c commands place you in insert mode that you need to exit in the usual way with
ESC or "[.
The . command can be used to repeat the last action. To join the next line to the
current one by deleting the newline character between them use the J command.
Searching for, Copying and Moving Text
Let us now see how to search for text. The f command searches for the next
character you give on the same line. This can be preceded by a count, so saying 3fx
will look for the 3rdx from the current cursor position. Similary F looks for the
character in the backward direction. A ; continues the search for the same character
in the same direction, while a , continues to search for the same character in the
reverse'direction. Both these commands work only on the current line, but the ;or,
commands can be used on a different line after repositioning the cursor.
To search for any text, precede it by a I character. It place the cursor at the
beginning of the first occurrence of the text pattern. To go to the next occurrence,
say n and say N to find the same pqttern in the reverse direction. If the pattern, say
hello, is not found, the message
P a t t e r n n o t found: h e l l o
is displayed on the status line at the bottom of the window. You can start the search
in the backward direction from the current curson position by preceding the text with
?. Both the I and ? will wrap around the file end or beginning. So after reaching the
end, the search will continue from the beginning of the file. You can use the d
command to delete text from the current cursor position to an occurrence of a search
string, say he1 l o , by saying dlhel l o .
You can bookmark a position in the file with m followed by any letter. So mx will
bookmark the current cursor position. Now you can reach that position from
anywhere in the file by saying 'x. To reach the beginning of the line containing the
bookmark x, you can say 'x. Bookmarks are valid only for that edit session.
You can ~tndothe effect of niost com~nandsby the u command, but repeating it Linux UtiIilies
and Editor
merely brings back the previous situation. So the commalid works like a toggle.
However, you can use U to ~ ~ n 911 d ochanges on a line if you have not moved
away from it. Deleted text goes into an unnamed buffer, from where it can be
retrieved by using the p command and placed after the current cursor position.
The P command places it before the current cursor position. You can use these
commands repeatedly to place the contents of the buffer at different points in the
file. Tlius to take care of a transposition error involving two characters, say xp
at the first character.
The y comniand yanks a block of text into the unnamed buffer without deleting it.
So you can use yw or yy (also Y) to yank a word or a line. These can be
preceded by a count. You can then place the text wherever you want by first
going to that point and then using p or P.
Finally, you can use any of 26 named buffers by n1.eceding the command with "
followed by the buffer name, which can be any lower case letter of tlie alphabet.
Thus "1n4yy will yank 4 lines and place them in tlie named buffer In. To put back
the text at some point in the file, just go to that point and say "mp. You can
append text to a named buffer by using the same buffer name but in upper case.
This conipletes ourvery quick overview of tlie vi editor. Linux also has available
an office suite that includes a full fledged word processor suitable for editing text
documents, while vi is useful for editing programs.
Linux has a full screen windows based editor, gedit,that creates text files. But
and features that vi does, in spite of the
it does not offer the wealth of co~n~nands
hct that it is windows based. For a programmer, it might yet be better to use v i .

In tliis chapter we have covered a lot of ground and the treatment of the topics
has had to be brief. We have looked at some text manipulation com~nandsthat
are frequently useful. We studied the meaning of per~nissionmodes for files that
you see in the directory long listing, and also saw how to change them for files
that we own. Next we saw how we can construct our own commands easily by
joining together filters with pipes. This also brought us to the concept of the
standard input, standard output and standard error. We then looked at how to
write simple shell scripts in tlie bash shell. The graphical facilities available in
Linux were then touched upon followed by a brief discussion of the programmer's
editor vi.

Check Your Progress 1

1) Linux does not type out the file. On trying to type out a directory called
"linux" that does not exist, we get an error m,essage

cat: linux: Is a directory

2) On trying to cat a file that does not exist, we get an error message
cat: highest: No such file or directory

3) If there are two files filel and file2 that are the sanie after byte offsets
offset1 and offset 2, you can verify tliis using clnp using
$ cmp filel file2 offset1 offset2
Litlux Operating System
4) You can use wc on a binary file but the results are not meaningfill for such tiles.

Check Your Progregs 2

1) You will not be, able to do so and will get an error message in both cases.

2) No. This is because of the definition of search permission. But you might be
able to find out the files in it ifyou give it as the argument to the Is command.

3) Yes, you only need write permission on the directory. It does not matter
whether you can write to the files or not or even whctlier yo11 own them or not.

Check Your Progress 3

1) Try yourself
2) You can say
Is-l ( w c - 1

3) It is useful when you not only want to pipe the output of a command to another
command, but also want to see or save that output.
Check Your Progress 4

1) It gives all the filenames except those that are hidden, that is, thosc that s t a ~with
a period (.). To get these you can say
echo .*
2) Try yourself
3) Try yourself


There are a host of resources available for further reading on the subject of Kcd Hat
Linux version 9.0.

1) iliux
2) litt~://www.linux.orqgives among other information, a list of good books on Red
Hat Linux.

3) Considerjoining a good Linux mailing list.

Structure Page Nos.
4.0 introduction 67
4.1 Objectives 67
4.2 On-line Co~n~nunication 68
4.3 Off-line Co~nrnunication 76
4.4 Apache Server Settings 81
4.5 Network Server Settings 85
4.5.1 Domain Name Server
4.5.2 Network File Server

4.6 Summary
4.7 Solutions/Answers
4.8 Further Readings

In tliis unit, yo11will learn how to communicate with otlier users in Linux. Such
communication can be offline or online. Online communicatio~ican be done using the
write command. Wliile instant messaging applications are commonplace these days,
they are not specific to Linux and are available for most popular operating systems.
We will take a quick tour of an instant messaging application from one oftlie popular
providers to understand some oftlie facilities tliat are available. Electronic mail is one
oftlie offline applications available in Linux and we will lookat the Ximian Evolution e-
mail client tliat also allows you to schedule your engagements. The Apache
webserver is a very popular one, and you will learn the elements of configuring it to
enable your computer to serve out web pages. You will also see how to configure
some other network services such as tlie domain name service and a network file
system server. Again, because of the lack of space, we will be able to look at only the
basic concepts and features and will not be able to delve into the details of these
- matters. There are also some otlier services that we will not be able to touch upon in
tliis short chapter.

After going through this unit you sliould be able to do tlie following tasks. The
configurations that you will be able to perform will be at a basic level and you will not
become an expert. .
comniunicate witli otlier users on the same machine with tlie write command;
use an instant messaging applicatio~ito chat witli another user on the network;
use the Ximian Evolution e-mail client to send and receive mail;
perform simple configuration of the Apache webserver on your machine;
configure your machine as a domain name server, and
coilfigure your machine to be a network file system server.
Linux Operating System
In Linux there are two ways of communicating with other users online. The first is
available if the other user is bgged in to the same machine. Whenever this is so the
user will be a terminal on the machine to which you can send messages using the
write command, even if that user has connected to your machine from another
machine over the network. While the facilities are rudimentary, write is quick and
simple to use. If you require more sophisticated features, you can use an instant
messaging application from any of the popular providers, or use the gaim instant
messenger that comes with Linux.
The write command
This command allows you to send a message to another user logged onto the same
machine at the same time. It is thus a means of online communication because the
recipient obtains the message immediately. There are other means of communication
that we will look at that are offline in the sense that you send the message and the
other user might not pay any attention to them if he so desires. Of course, even with
the write command, the other user might not pay attention to the message that you
send. The same is true for an instant messaging application as well. So the distinction
between what we are calling online and offline methods is just that in the former, the
other user or users are expected to be available at that time -they may or may not
choose to respond. If they do decide to engage in the communication, they are
available at the other end and you can then conduct the conversation.
You should be careful while using write as it can be very annoying to receive a
message which clutters up your screen while you are concentrating hard trying to do
some piece of work. Sometimes you have some precious output on the screen which
you have obtained after some effort and a write message appears and causes that
output to scroll off. If you are working in a terminal window you can scroll back to see
your output, but it can still be annoying to be disturbed. Or you are working in an editor
and the message garbles your screen. There are many such situations in which you
would rather not receive any message on your screen. Again, some people are more
touchy than others on this issue. So you should be careful and use write only when
you have something urgent to say, or when you are sure that the other party will not
mind. In fact, one of the most irritating times to receive a write message is when
you are already replying to somebody else's write message. You might even want
to arrange with some friends for such a situation to happen and see how it feels.

One thing you could do is to find out using the p s command what the intended ,
recipient is doing. If your party is in the shell, it might not be so inconvenient for him.
On the other hand, if he is in vi or some application package, then it might be best not
to bother the person. Then again, the urgency of your situation needs to be taken into
account. Another possibility is to send the user a brief wri t e message asking
whether it is all right to send more. If the recipient does not want to be bothered at
that time, she can tell you so. All said and done, you should be aware of the fact that
write can be a rude command to use.
After this long sermon, we can come to the command itself, which should be a breeze
for you after all of the two units of Linux experience that you have had. Let us find
out some of the users on the system currently.
[kumarr@linuxkumarr]$ who
ramk ttyl Dec 10 20:47
kumarr pts/0 Dec 10 22:59 ( : 0 . 0 )
khanz tty2 Dec 10 21:29
pramod tty3 Dec 10 22:ll
Suppose you, kumarr,want to write to khanz and ask him about some program he User to User
had promised to give you. So you say: Communication

[kumarr@linux kumarr]$ write khanz

Can I have that matrix inversion program please?
I need it badly to test out my work.

We get back the prompt after sending the message. Notice a few things about
write. One is that after issuing the command there is no indication at all that you
should proceed with your message, because there is no prompt on the screen nor any
automatic acknowledgement which comes from the other end. The command expects
input from the standard input and faithfully transmits it to the destination.
Therefore after issuing the command you can type in your message, which can be as
long as you like. When you are finished, you should type the end of file character to
signal the end of input. This character is usually "D. On doing this you will get back
the prompt. There is no indication whether the other party has received the message
or not. Also the message should not be longer than a screenful or the other person
might have difficulty reading it, even though you can scroll back in a graphical terminal
window in Linux.
Now what about the other end of the channel? Let us zip across to khanz's terminal
and see what he has got, omitting the secret work he was busy with when you butted
Message from kumarrelinux on pts/O at 23:08 ...
I need it badly to test out my work.

So he did got your message, but what about a reply? Well, you did not see anything on
your screen because he has not had a chance to answer yet. Let us see his reply
[kumarr@linux kumarr]$ write kumarr
I was downloading it but the line got cut midway.
Will give it when I have it.
Have patience or get it yourself.

and that is exactly what you receive on your terminal except for the letters EOF in
place of the "D.
So we now have seen a straightforward case of exchanging urgent messages with
write. Often such messages would have gone by mail. The write command is
more commonly used for carrying on an online conversation with others who are also
logged in at the time, rather than just sending a message. Let us see how to do this.
Using the information from the who command earlier, let us say we try to converse
with pramod.
[kumarr@linux kumarr]$ write pramod
Linux Operating System Instead of immediately writing out your message, you can wait to see if prarnod is in a
mood to respond. After a minute or so you have not had a reply and so you just come
out with AD. He is too busy to talk to you, or maybe he just does not want to be
disturbed and has arranged matters that way. This is getting to be irritating now, so let
us try somebody else.
[kumarr@linux kumarr]$ write ramk
Message from ramkelinux on ttyl at 11:44 ...
At last somebody is ready to talk to you! This means that ramk has something like this
on his screen.
Message from kumarrelinux on pts/0 at 11:43 ...
Now you are both all set to carry on a conversation, because both have issued a write
command for writing to each other and can consequently write to each other's
terminal. So go ahead and pour out your woes to your only friend in the installation.
I wanted a program so badly but khan has not yet got it. I
Which program? I am sure he must have tried
don't know what to do.. .
What is happening here? This can be disconcerting for beginners, but there is nothing
mysterious about it. The communication is asynchronous and full duplex. Both sides
can transmit and receive at the same time, and unless you wait until the other side has
finished, there can always arise opportunities for confusion. What you need is a
protocol to be adhered to so that the screen does not get cluttered up and cause
bemusement. The thing to understand here is that there is no way of knowing when
the other party has finished unless the protocol is set up and observed. This is because
after every linefeed character the message is sent to the other side and there is
nothing to restrict a message to one screen line. So the other party might respond
before you have finished, especially if you have also entered a linefeed in your
There are many local conventions you could come up with for this, but let us see a
protocol where we use ga at the end of each message and terminate the conversation
with a bye. Now the previous conversation will be more intelligible to both parties.
I waited a program badly but khan has not yet got it.

Which program?

I don' t know what to do.

I am sure he must have tried.

"D i1
This was when everything was favourable. Sometimes you will have the following
spot of bad luck.
[kumarr@linux kumarr]$ write rarnk
write: ramk is not logged in
This response is self explanatory. If you try to .mite to a user who is not logged in you
will get this response from linux. Since write is an online command, it is not enough
for the user to be a valid user on that installation. The user must actually be logged in
to the system at the time you try to write to him. You can always make sure of that by
doing a who first. If the person you want to write to is not logged in, you can save
yourself the trouble of trying to write, knowing you will fail.
Then there are the times when you check out the users of the system and find
something like this;
[kumarr@linux kumarr]$ who
ramk ttyl Dec 10 20:47
kumarr pts/0 Dec 10 22:59 (:0.0)
khanz tty2 Dec 10 21:29
pramod tty3 Dec 10 22:ll
shyama tty4 Dec 10 23:46
shyama tty5 Dec 11 01:29
Now if you try to write to shyama you find
[kumarr@linux kumarr]$ write shyama
write: shyama is logged in morP +ha? once; writing to
If that user is logged in onto more than one place, you will find that Linux automatically
writes to the lowest numbered terminal into which that person is logged in. That is
usually fine, but if you want to specifically write to the person at some other terminal,
you can do so by giving the terminal number of your recepient as well with the
command itself. Thus
[kumarr@linux kumarr]$ write shyama tty5
will write to shyama at the terminal tty5 rather than the default terminal of tty4.
So you see that you write to a terminal, not to a user. It follows that you can
write to yourself if you wish.
Are you at the mercy of others to be able to work peacefully? Not entirely, because
there is a command in Linux to prevent other users from being able to write to your
terminal. In Linux every device is a file and you could use the chmod command to
turn off wr ite permission for others to that file. Then users will not be able to
write to your terminal and consequently will not be able to disturb you while you are
working. But to use write you would need to know which device file corresponds to
your terminal. An easier way is to use the mesg command.
[kumarr@linux kumarr]$ mesg n
Now anybody trying to write to you will get a message like this
write: kumarr has messages disabled on pts/0
mesg co~iimandw~thoutany arguments. l o restore wrlte perm~ss~on, you can use rne y
argument to mesg. Any denial of write permission lasts only for tlie duration of Y O L I ~
login session. You can have a different write status on some other terminal to whicll
you are logged in. You need to be aware of tlie fact that tlie superuser can always
write to your terminal, irrespective of mesg status.
You should use the mesg command only when you are doing something important and
do not want to be interrupted. Just as it is rude to unnecessarily bother a person, it is
also rude to shut your doors to others trying to reach you, perhaps with something
The write command gets its input from the standard input and so you can always
write tlie contents of a file to a
[kumarr@linux kumarr]$ write ramk < mymessage
Here the recipient will see the contents of the file. So the message shoi~ldbe short. lest
it be hard to read off the screen. This session will not be interactive, because it will
end after tlie file has been sent off and the party at tlie other end will get an EOF.
Anotlier facility you liave is to send a message to all users logged in at the time. This
can be done with tlie wall command.
[kumarr@linux ku~narr]$wall

Don't anv of vou QUVS want lunch?

[kumarr@linux kumarr]$
Broadcast messacle from kumarr ( ~ t s / O )(Sun Dec 12

Don't any of you guys want lunch?

Here even the sender gets tlie message. An ordinary user cannot be sure that all those
logged in will get the message because some users might liave disabled the receipt of
messages. So this command is suitable for tlie superuser only. It is usually used to
send important messages pertaining to the installation to the users.

& Cheek Your Progress 1

1) What do you think are the advantages and disadvantages of electronic

communication compared to
a) Postal Communication
b) A telephone conversation

2) Can you think of a couple of other ways of sending output to another terminal
other than the ones covered here?


72 ................................................................................................................................
User to User
3) What happens if a user logs out after you have started writing to him?


4) If you wanted to send some message requiring some preparation, how would you
use to write?

..... ...
i .......................................................................................................................

Instant Messaging Applications
The w r i t e command that we looked at is rather rudimentary in that it does not offer
very much by way of features or convenience. But it is useful if you want to
communicate quick and fast with no set up required. For something that is much more
powerfill, you can use ally of the instant messagi~igapplications available today. With
these applications you call communicate online with any user anywhere in the world if
both of you are conllected to the Internet. You can also hold conferences where more
than two users can participate.
The act of using an instant ~nessagingapplication is often referred to as cllatting. This
lias become a very popular m a n s of cornmu~licationtoday. While not specific to
Linus, chat applications are comnionly used and will be described here briefly. Such
applicatione are available from various providers but the one we will describe here is
the Yahoo chat, called Yahoo messenger. This should not be construed as any
endorsement of this particular application by the author or by IGNOU. This example
has bee11used because you will not be able to appreciate the features of such
applications unless we discuss them with reference to some specific application.
The Yalioo messenger application has many good features that make it useful and
popular. It is available free of charge from the Yahoo website and is provided under
different operating systems illcludilig Red Hat Linux. Once tlie file has been
downloaded, it needs to be installed on your machine. This act requires root perlnissioli
and will therefore not be discussed in this unit. We assume that your systeni
administrator has done this for you. You can set up things in various ways but we will
also assume here that you have to start up the application yourself whenever you want
to chat wit11 solnebody or want to set up a conference. For this just'liave to issue
the command:
[kumarl.@linux kumarr]$ /usr/bin/ymessenger
If you have set up your path properly in your login environment, you can omit tlie
usr/bin.and simply say ymessenger after enteri~lginto graphics mode and
creating a terlnirial windowv. This brings ilp two windows that read Yalioo Messenger
and Login. Tobe able to use the applicatioll you must already have a Yahoo id. If you
do lint have one, you could click on tlie button in the Login window that says "Get a
Yahoo! ID". In the Login window you can now login by providing your id and
password. The password is not echoed 01.1 the screen as you type and instead, you see
an asterisk (*) for evely character that you type. This is to provide some security
because then somebody looking over ),our shoulder will not be ablc to lnalie out your

There are also two checkboxes available in the Login window. 'l'he first one will tell
tlie application to remember your id and password the next time you login. This can be
very colivellient, but tliel-e are two points to consider here. First, you might well forget
Linux Operating System your password if you do not use it for long. That can be inconvenient, though you can
provide some information that you gave while signing up for the id and obtain a new
password. That process takes time, however. Secondly, it is certainly most unwise to
use that option unless you are working on a personal machine that you do not share
with others, or at least with those you cannot trust. On a public computer, you must
never set this option. Otlierwise somebody could masquerade as you and perhaps
perform objectionable acts in your name.
The second feature is tb be able to login under invisible mode. When you enter the
application, you will not be visible to others as having logged in. This will prevent
others from trying to converse with you as they will not know you are online. We will
see later that you can also put yourself into invisible mode after logging in normally.
The other Messenger window is blank in the beginning. While the Login window is
visible, the Messenger window will not respond to your input (except for window
manager operations that allow you to resize or close the window). It also shows in a
status bar at the bottom that you are Not Connected.
Once you provide a valid id and password the login window closes, the application
connects to the Internet and shows this in the status bar at the bottom of the
Messenger window. It will also state that you are available, unless you have logged in
invisible mode. You will initially not have any friends on the application so the middle
portion of the window will be blank.
To be able to make use of the application, you need to have people you can chat with.
These are called friends. So let us now add some friends to our list. To do this, click
on the icon labelled Add, to open up a window that says "Add Friend".
The Add Friend window shows you four steps that you need to take to add a friend.
You must know that person's id to be able to do so. Next, you have to decide what
group that friend is to belong to. The application allows you to choose different kinds
of groups into which you can classify your friends or contacts. You have the groups
"Work" and "Personal" available to you by default. You can create a new group if you
want to do so.
The ability to create groups is very useful as you can classify your contacts
appropriately. For example, you could set up a group like "Family" where you put only
your family members and relatives. Business or workplace contacts could be in the
group called "Work" and so on.
In the next step you can enter the identity under which you want to add your friend.
This will default to your login id.
In the last step you can enter a short message that your friend will see when she next
logs in to the application, thereby telling her that she is now on your friend list. She
could then choose to likewise add you to her friend list under the appropriate group.
After this you can click on the "Add Friend" button to add the person to your list of
friends. Now the person is displayed in the Messenger window under the appropriate
group as your friend.
You can change your status by right clicking on the status bar at the bottom of the
Messenger window. You get a list of status messages that you can choose from.
These include "Busy", "Not At Home" and so on. When who have you on your
friends list login, they will see that status message against your name. Friends who are
online at the time are displayed in bold, the others are displayed in ordinary type.
Under invisible mode, your friend list is displayed in italics.
Now suppose your friend is online. You can now begin a chat session with that person
by clicking on the Message icon in the Messenger window. This brings up another
window that shows up the name of the friend in the title bar at the top. Below that are
two rows of menu options. This is followed below by a text area where you can see
the messages that have been exchanged in that session. Below that is another area User to User.
where you can type in your message. Communication

For this message area there are several options available to you. You can set your
messages to bold, italics or underline format by clicking on the B, I or U buttons. That
changes the style of the text that you type subsequently in the message area. To stop
bold, italics or underline, just click on the button again - it acts as a toggle. The
recipient at the other end will see the message with the proper style. You can select
more than one modification to the text style at the same time, such as bold and
underline simultaneously.
Besides, there are options to change the font and the size of the characters you type.
There is a drop down list available for both of these that includes a bewildering array
of choices.
That is not all! You can also change the colour of the text that you type to any of
some preset colours. As if that were not enough, you can create any custom colour
you want to by specifjling the RGB or HSB values of the colour. And then there are
the different emoticons you can send by clicking on the smileys icon. There are
several of them to display all kinds of feelings or emotions.
Once you have constructed your message, you can press the enter key or click the
send button to have your recipient see what you typed. This is visible at your end
also. Messages sent and received can be distinguished both by the id of the person as
well as the colour.
When your conversation is over, or at any point that you wish, you can save the
transcript of the entire discourse in a file on your disk. You could also cut and paste
the conversation into a file in your word processor. If a person is not responding, you
can "buzz" your friend to draw attention using the "Friend -> Buzz Friend" option in
the menu bar. 'This will send an audible sound to the other end (will work only if the
other party has their speakers on) as well as shaking the chat window of your
There are several other options available and we will not be able to talk of all of them
here. But one very useful and important facility is that of conferencing. Here you
can invite a third party, and a fourth and more, to join in the conversation. Here all of
you get to see what all of the others are saying. Thus you can conduct a meeting on-
line. They are of course free to join your conference or to decline.
You can send a file to your recipient by using the "File -> Send" option or simply use
the "Send File" option. You are then directed to another window where you can
indicate the details of the file to be sent. With this you can also send a message to
your friend. One more feature is the ability to ignore a user. You will then no longer
receive any messages from them.
As your friends come online, you will receive a notification telling you about the event.
Similarly when you come online, any users who have you on their friends list will be
advised about the fact.
There are several preferences you can set to customize the look and feel of the
application to your taste. These can be accessed by using the "File ->
Preferences" menu option. You can, among other things, change the privacy
options, decide the colour scheme used or set the alerts that you will receive.
So you see that an Instant Messaging application is much more sophisticated than the
rudimentary write command that we saw earlier. However, for a quick and short
conversation, you could still use write. These days you can also conduct a voice
chat with your friends, effectively using your computer as a telephone. This would
require a microphone and speakers at both ends and a reasonably good Internet
connection. You can also conduct a voice conference.
Check Your Progress 2

1) What is meant by being in invisible mode in Yahoo Messenger?

2) How do you being chatting with a friend?


3) What would you want to buzz a friend?

I 4) What are the different status massages that you can show others?

5) How can you save a transcript of the conversation you have had with a friend?

Let us now explore the facilities available i ~ ;Linux for offline communication. This
term is used here to refer to a method of communicatio~iwhere the other party is not
necessarily on-line at tlie time. The recipient sees your message only the next time
that she logs in. After looking at the array of features available in an instalit
messaging application, you might wonder what good it would be to use any other
method! But consider some of its limitations and disadvantages.

The other party has to be available at the same time as yo11are. This can be
inconvenient across different time zones.
Unless you keep yourself focussed, the conversation can tend to ramble and go on an
on. This means more time spent on the chat proper.
lfyou are using text mode, then typing things out quickly can be difficult and tiresome
unless you are a trained typist.
lnfrastructural issues are important. If either side has a power or network outage, the
conversation cannot happen.

Lengthy files cannot be sent, or even if they are sent, there is no chance for the
recipient to peruse them.

We can get around many ofthese limitations by using an offline mode of

cornrnunication such as electronic mail. While some of the good features of instant
messaging might not be available, there are some advantages to it.
Communication is asvnchronous. You send vour message and the other Dartv can

I 7. File attachments can be sent and the other party can r e ~ l vafter examining the file.
Typing speed is not much of an issue as there is no one impatiently waiting for your User to User
reply at the other end. Communication

Infrastructural bottlenecks are of less significance. The message can be sent or

received as and when resources become available.

At the same time, if both parties are online, e-mail can be almost like an online means
of communication as people exchange e-mail messages rapidly one after the other.
We will therefore look at the e-mail facilities available in Linux. Here we will not
concern ourselves with the mechanisms of setting up an e-mail system, which is the
job of the system administrator or the network specialist at your installation. We
assume that has been done and we will only look at an e-mail client to explore the
features and facilities that it offers.

Linux has a rudimentary e-mail client in the mail command. This is a text oriented
facility that is difficult to use, especially in today's scenario where we are ali
accustomed to graphical interfaces. It works at the command line level and allows us
to send, receive and otherwise manage e-mail messages. But here we will look at a
more sophisticated e-mail client - Evolution from Ximian. To be able to use it, it needs
to be set up on your machine. Here we assume that the basic set up has been done
for you and that you are ready to use it as your primary e-mail client.

To start up the client, click on the little arrow near the Red Hat on your bottom tray.
This brings up a menu of choices from which you need to choose "Internet ->
Evolution Email". This takes you to the main window panel on your screen. his
window has several parts that are briefly described below. You will find that there are
many ways of reaching a particular option. For example, to see your inbox, you can
click on the Inbox link on the right hand panel in the summary page, or choose Inbox
from the left hand panel, called the Shortcut bar, itself. We will here look briefly at
some of the main features of the client.

The client has features such as helping you keep track of your appointments and tasks
that you need to do. Here we will not dwell on those aspects as we would like to
focus only on the communication aspects of the client that are made available through
the e-mail related facilities.

Menu Bar

At the top is a menu bar with the options File, View, Actions, Tools and Help. Each of
these in turn has several options. The bar is context sensitive. For example, when you
are viewing the summary, you will not see the Edit button. Likewise, the options that
appear under the View or Actions button depend on where you are currently.

The View option lets you choose the appearance of the window. You can choose to
see the Shortcut bar on the left or to hide it. You can also choose to see or hide a
Folder bar that shows all the mail folders that you have. This appears to the right of
the Shortcut bar.

The Actions option lets you send or receive your messages through your e-mail server
that has been configured for your client. If you choose this option then all messages
that have arrived on the server will be transmitted to your client and will appear in your
Inbox. Also any messages in your Outbox will be sent out.

The Tools option lets you change the Settings of the client. This will allow e host of
preferences to be set. These include the settings related to mail messages, message
composition, servers, contact lists and others. You can also configure the
synchronizationof your computer with a Palm Pilot.
Linux Operating System The Help option gives you a full description of how to configure and use the Evolution
e-mail client. You should refer to it for all the details that we will not be able to discuss
The File option lets you create a new mail message, set up an appointment or add a
task. You can also work with folders, i~nportexternal files, print or work offline. Many
of these choices can also be used through other navigational paths.
Shortcut bar
This bar appears on the leftmost part oftlie window, i~nlessyou liave chosen to hide it.
It has several choices.
The Summary shows you some weather information in the centre pane, while tlie right
hand pane shows the number of messages in your oi~tboxand inbox. You also see any
appointments and tasks that you liave left. All of these are links that take you to the
respective feature. So clicking on the "Inbox" will take you to your inbox.

Clicking on Inbox takes you straightaway to your Inbox, where you can see a list of the
messages that you have received with the sender, subject and date. You see the total
number of messages and the number of new messages as well.
There are also shortcuts to your appointments calendar and todo list.
You can maintain you Contact list by clicking on Contacts.

If you right click on the Sliortcut bar, you get a nienu whereby you can change the
appearance of the bar. You can now -
Hide the Sliortcut bar, whereupon you can get more space for the actual option
that you are at currently. So if you are in your Inbox and you hide tlie bar, the
space that becomes available is now used for your lnbox itself. You can get back
the bar by clicking on tlie View option in the menu bar at the top of tlie window
and selecting the Sliortcut bar.
Choose to see large or small icons in the Shortcut bar according to taste. Small
icons take up little space and give a compact appearance.
You can create another Shortcut group where you can put in your own sliortci~ts
to folders that you clioose, such as a folder that you liave created.
You can change the names of groups or remove groups that you have created.
In box
The Inbox shows you at the top statistics on the number of new and total messages
that you have. By clicking on a column header sucli as "From", "Subject" or "Date",
you can sort tlie list in ascending or descending order, or even remove the colunin. You
can also add columns of your own by selecting one of the available clioices and you
can place tlie column wherever you like.
Wlien you click on a message summary you can see tlie actual message in the bottom
half of tlie window. You can now perform tlie usual actions of replying to tlie message.
deleting it or forwarding it to another set of recipients.

You can search through your iiiessages based on several criteria, sucli as
Wliat the subject does or does not contain
What the body does or does not contain
What the sender's name contains
Wliat the recipient's name contains
Your own custom criteria that you can build up using the options provided User to User
Composing Mail
One way of beginning to compose mail is to select Actions -> Compose New
Message when in the Inbox. This brings up the "Compose a Message" window that
lets you enter.
The "To" or recipient information
Information on those to whom you want to copy the message, using the "Cc" field
You can choose to send a "blind" copy by using the "Bcc" field. Other recipients will
not be able to see that the mail has gone to the Bcc addresses, but they will be able to
see the other addresses to which the mail has been Cc'd. To be able to uLe the Bcc
field, you might have to choose the View option on the top menu bar and cneck the
Bcc option in it.
For the above three fields, you can bring up your contact list by clicking on the To, Cc
or Bcc buttons. Now you can select by name the contacts to whom you want to send
the mail. When the list appears, you can place contacts in any of the three fields that
you need. This way you do not have to remember any e-mail addresses, nor do you
have to type them in.
The subject line. Although this is not compulsory, it is good to enter a subject so that
the recipient can make out what the message is about when it sits in her inbox. The
subject should be descriptive enough so that this can be done.
The Format option on the menu bar in the Compose windows has many features.
You can now start entering the message itself. Here again you have many features
available. To begin with, the message can be in plain text or in HTML. In either case,
you can make the text bold, underline it, put it in italics or use strikethrough mode.
You can choose the font size for your message.
You can align the text that is entered - left, cemered or right alignment are possible.
You can change the colour of the text from among several preset choices, or you can
even create your own custom colour.
You can create bulleted or numbered lists, with choices for different kinds of
numbering such as Roman or alphabetical.
You can indent your text as desired.
While you are entering your message, you have several facilities available through the
"Edit" option on the menu bar.'
You can undo an action that you have performed by mistake, such as changing the
indent or the font colour.
If you find you have undone something by mistake, you can redo that same action.
You can cut or copy and paste a block of text from another file to the message window
or vice versa. The cut option will delete the text from the original location, while the
copy option will leave the original as it is.
You can find and replace text in your message.
You can spell check the text that you have entered in your message.
Besides, you can add an attachment to your message. This attachment can be any file
that you like to put in. Various emoticons, or smileys, can be inserted into the message
Linux Operating System body as well. Apart from this, you can insert images that you have, hypertext links,
ruler lines, text and html files directly into the body of the message. Having done all
this and composed your message, you can now use the "Send" icon on the toolbar, just
below the menu bar, to send your message off to the ;ecipients.

If you wish, you can save your message as a file on the disk using the "File" option in
the menu bar. You can also save your message in your Drafts folder for editing and
sending later. This is useful when you are not able to complete an elaborate message
in one session and want to continue to work on it later.


To be more organised, you can store your mail in various folders. The default set of
mail folders consists of Inbox, Outbox, Drafts, Sent and Trash, besides which there is a
folder for your contacts. There are also folders for your calendar and todo list, but we
do not look at them here.

The Inbox stores all messages that you have received. New messages that you have
not read are to be seen in bold. The Outbox stores messages that you have composed
and that you have asked to be sent. They remain here until they have been sent off
successfully. If, for example, the network link is down, the message might remain here
for some time till the link is restored. The Drafts folder contains messages that you
have composed and chosen to save instead of sending off. As we saw before, this
could be because you need to work on the message some more in a later session. The
Sent folder contains messages that have been' successfully sent off. They are moved
here from the Outbox when this happens.

Yo11can delete a message from any of these folders if you do not want them lying
around. Such messages are not removed permanently at that time but are instead
moved to the Trash folder. This gives you a chance to undo the delete if you realize
you have made a mistake, or if you change your mind. To remove a message for good,
you need to delete it from the Trash folder.
You can also create your own folders by using the File -> New -> Folder option.
You will be asked to specify under which folder you want this to be created. You might
find it useful to create new folders to organise your messages better. For example,
instead of letting all your inco~ningmailclutter up your Inbox, you might like to store it
in folders organized by sender name or organisation.

Contacts I

You can create a list of contacts with various details like their name, organisation, title,
contact details with e-mai I, postal address, phone numbers and so on. This can have
other notes on them together with their birthday, spouse's name, anniversary, web page
and other information too.

You can remove contacts and edit their information as well. This contact list can then
be used while sending mail, as already descqbed. You do not have to remember e-mall
addresses and can just use the name. You can search for contacts using various fields
as well.

Besides what we have described above, you can set a host of preferences for the look
and feel of your client. With this wealth of features, it is a real pleasure composi~lgand
sending e-mail on your Linux machine. This is a big advance over the rudimentary
facilities offered by the mail command that is inbuilt in Linux.
Linux Operating System because the impact of a reconfiguration is installation wide and is not confined to the
user who makes the change. Also it requires access to facilities that are accessible
only to the superuser. .
What if you are not an expert user and are not very familiar with the webserver? HOW
do you begin to configure it? One way is to use the grapl~icalHTTP Configuration
Tool that comes with Linux. This gives you a user friendly interface and saves you
from having to know any complex commands. To be able to use this tool. apart from
superuser or root access to the machine, you need to have the X-Window system
running. This needs setting up by your administrator, and after logging in, you can
invoke it using the command
[root@linux root]# startx
You need to understand that if you use the HTTP Configuration Tool, you cannot
configure the webserver by hand. This is because the tool generates the file after you
exit the tool. Any changes you have made are therefore not preserved. Also there
could be some modules that you have added to your webserver. The tool only supports
modules that are made available with Linux. If you use any other nodules from other
sources, they cannot be configured using this tool.
To start the tool click on the red hat icon with a little upward pointing arrow. This is the
Main Menu Button for Red Hat Linux, So you need to say Main Menu Button ->
System Settings -> Server Settings --> HTTP Server. If yo11wish, you can also start
up the tool from the command line at the root prbmpt.
[root@linux root]# redhat-con£ig-httpd
This brings up the main window of the tool, shown in Figure I. You are currently at
the Main tab where you enter the basic settings for tlie webserver.
In the Server Name, you should enter the complete or fully qualified domain name of
the machine on which you are doing the configuration. This could be something like, or If you do not give a valid name,
when the webserver starts up, it tries to obtain the name from tlie 1P address of the
machine. The name of the machine that you give does not have to be the same as this

'. . . *. ~ & & " . & ~ *

Set addril.sses far Apache t o trster~far requctsts 1):

- -- ----- --- - - ---- --.- - -

L-....-------...--.- I

- - - - - - . v I I W Y I U
1 --- ---.--------
L 3 -----

Figure I:M a i n Window of H T T P Configuration Tool

The next field that you enter is the e-mail address of the webmaster. It defaults to User to User
root@,1ocalliost as can be seen in the figure. You can configure the webserver's error
pages to contain an e-mail address. This can then be used by users to send e-mail to
report errors. You can make the address something like

Next you can set up tlie ports on which the webserver should listen for requests. The
default is port 80 for lion-secure communication. You can add an address by clicking
on tlie Add button at the right. This brings up another window where you can either
clioose to Listen to all addresses or specify an IP address. You can also specify tlie
port number at which you want to listen to requests from that address. You will have
to make a separate entry for every combination of IP address and port number. It is
better not to use domain names because of the possibility of DNS lookup failures.
You can edit or delete an entry by selecting it and then choosing the appropriate option
from the buttons on the right. Note here that while the edit option lets you cancel your
edit and seeks co~~firniationfrom the OK button before your entries take effect, the
delete button immediately deletes the entry without further ado or warning.
Virtual Hosts
This completes your basic settings. Now you should go to the next tab, that is "Virtual
Hosts". On clicking here you will see the virtual hosts listed by name and address.
Initially both wi I I say "Default Virtual Host". In the lower portion of the window is a
button labelled "Edit Default Settings". You need to click on this to bring up another
window titled "Virtual Host Properties". On the left ofthis window you will be on the
option for "Site Configuration". On the right you see entries for the Directory Search
Page and the Error Page. You should not need to change these settings in tlie
beginning. However, the tool does give you options to Add, Edit or Delete these
The Directory Search Page is the page where the webserver looks for content to
serve out when a user points a browser at the server's URL without specifying any
directory or with a directory name ending in a /. These are searched for in the order
tliat they appear here.
'The Error Page is used to gracefully handle errors. The message in the footer is what
the user sees i n case of an error. If you click on the Edit buttonsyou can change this
behaviour. The user can be redirected to any URL that you choose in such a situation,
and this can be an internal or external one. For an internal URL choose the File
option. Let us say you want to show the user a message that you have stored in a file
called badrequest.html whenever he makes an invalid request. In the Error Page,
select Bad Request and click on Edit. In the behaviour, from the drop down list,
clioose File and enter the name of the file. This file must be under the Document Root
The last menu option here is for the Default Error Page Footer. Her; you can clioose
the default, no footer or the default together with the e-mail address of tlie person
maintaining the website, tliat was specified during the basic settings.
Having done with Site Configuration, you can move on to the Logging menu. Here
you can configure the Transfer log and the Error log. The transfer log logs ail
connection attempts to the webserver, with their IP address, date and time and tlie file
that the client is trying to access. The default for this is the file /var/log/httpd/
access-log. Similarly the error log holds all errors that the webserver encounters
and the default for this is the file called error-log in the same directory.
You can change these default log files by entering either an absolute pathname or a
pathname relative to the server root. You could also choose a custom log format by
entering a string that defines the format, but we will not go into this here.
Linux Operating System The log level determines the amount of logging that goes on and you can set to one of
the eight possible levels, from Emergency that logs the least amount, to debug level that
puts in a large amount of information. The default is to log only errors or more severe

The last option here is the Reverse DNS Lookup, which you should leave at the "No
Reverse Lookup". You can also do a Reverse Lookup or a Double Reverse Lookup,
but this is not recommended because of the load it would place on your server and the
Internet in general.

The next menu option under Virtual Hosts is Environment Variables. Here you can
control the environment variables that are passed onto Common Gateway Interface
(CGI) or Server Side Include (SSI) pages. This has three options -to set, to pass and
to prevent an environment from being passed to tlie CGI script.

I n the "Set for CGI Scripts" section, you can choose the Add button to add an
enviro~ime~it variable to be sent to CGI scripts. This brings up a small window called
"Environment Variable" where you can enter the name of the variable and its value.
Then choose OK to add it to the list. Similarly in tlie "Pass to CGI Scripts" section,
you can choose the Add button to bring up a window where you can enter tlie name of
the environment variable. This passes to any CGI scripts tlie value of that variable
when the webserver was started. Click on OK to add this to tlie list. Finally, in tlie
"Unset for CGI Scripts" section, you can enter the name of variables that you do not
want to pqss to CGI scripts. For all tlie three cases, you can also edit and delete
entries alreay made.

The last menu option here is Directories. Here you can set various options for
different directories. At the top are options that are the default for all directories not
mentioned in the lower portion of the window. You can edit these default options by
using th~:Edit button the right. In the bottom part of tlie window you can set options
for specific directories. For this click on the Add button at the right.

You now see a "Directory Options" window with various sections. In the Order
section, you can either allow all machines to access the directory, process a deny list
first or process an allow list first. In the Deny List and Allow List sections, you can
either select all hosts or specify hosts based on matching with a partially specified
domain name, an 1P address or a subnet. You can also put in the directory to which
these options apply. Moreover, you can choose to allow directives in a . htpaccess
file to take precedence. There are also some options that you can set. These sanie
options can also be set for the default directories. These include allowing CG1 scripts
to be executed, allowing server side includes and allowing the following of symbolic
links. You can also edit and delete directories that have options already set.

You would recollect that we have done all the above using the "Edit Default Settings"
button, which means that what we did applies to all virti~alhosts. Different virtual
hosts can be hosted on the same physical machine, and they can have different IP
addresses, ports or names. We will now see how to manage virtual hosts in Apache.

For every virtual host that you add, you can configure directories, environment
variables, logging and site options the same way as described earlier. To add a host,
click on the Add button which will bring you to the "General Options" button. You will
now see a window where you can specify the name of tlie liost, its document root, and
the e-mail address for the webmaster. In the Host information section, you can choose
the type of liost, which can be default, IP based or Name based. You should have only
one default virtual host. For IP based virtual hosts you have to specify the IP address.
This can be in tlie form IP :port if you want to specify the port as well, and you &an
specify multiple addresses by separating them with a space. You can likewise
configure name based hosts by putting in the information that is asked for. Name
based virtual hosts cannot work with SSL and can work only with a non-secure User to
webserver. You can set up SSL options by choosing the SSL menu option for your
virtual host. This requires that your webserver have been set up to allow SSL support,
and will require you to allow access through port 443 in the basic settings.


The next tab is "Serv'er" and it allows you to configure some basic settings for your
webserver. You should not normally have to alter these, at least the lock file and the
PID file. The Core dump directory is where the server dumps core if it crashes.

The Apache webserver must not be run as root as that would expose many security
holes in your system. The user for the server is specified in the User section, and by
default the user is Apache. Here you can also enter the group to which that user
belongs. This too is Apache by default. The user id is what determines access to the
system resources. Any file that cannot be accessed by this user cannot be accessible
to the server and will return an error. Also any CGI scripts run are run with the user id
of this user. So you must take care to see that any scripts that are not to be run by the
outside world catinot be accessed by the webserver user. Also any files that you do
not want to allow others to read should not be accessible to the webserver user.

You must ensure that the core dump directory permissions allow the Apache user to
write to it. If not, then it will not be possible to write core to the disk in case of a crash
Performance Tuning

This is the last tab in the HTTP Configuration Tool. The window that it opens up has a
few options that we look at here. In this case too the default options are likely to be
appropriate choices for most situations.

The "Max Number of Connections" is the upper limit on the number of simultaneous
client requests that can be handled by the webserver. This needs to be below 256 and
is 150 by default. For a higher value, above 256, you will have to compile the Apache
webserver again with the proper options - not recommended for beginners. If there
are more client requests they will be refused unless connections become available.
The "Connection Timeout" setting sets the number of seconds for which the
websewer will wait for a response to a communication request. The default value, as
you can see, is 300 seconds. You can also set the maximum number of requests that
are allowed per connection or allow any number of requests. If you allow persistent
connections, the server will keep a connection open even after a request has been
serviced. The time for which it will do so can be specified in "Timeout for next
Connection". This should not be set too high as it could slow down the webserver as it
waits for another request from clients.

With this we have looked at how to perform the basic configuration for the Apache
webserver. There are of course many features that we have not touched upon, but
after reading the material here you should be able to at least start off.


In this section we will look at how to set up your machine to serve as a Domain Name
server and as a Network File server. A domain name server helps convert domain
names to IP addresses so that human beings do not have to remember
incomprehensible strings of numbers and can instead work with names that they find
much more intelligible. You will need to have sufficient understanding of the domain
name service and the program, bind, that provides the service.
~ i n u vOperating system 4.5.1 Domain Name Server
It is certainly possible to configure bind by hand, but that requires a good understanding
of the format of the configuration files. If you are not an expert, the Bind
Configuration Tool provides a graphical, user friendly way of perforniing basic
configuration ofthe DNS service. However, any complex configuration will not be
possible through this tool.
Like other server configurations, setting up the DNS service also requires you to have
root or superuser access on your machine. Moreover, to run the tool, you need to be
working in the X-Window system so that graphical facilities are available. You can
start the tool through the command line at the root prompt, though.
[root@linux root]# rednat-config-bind
To start the tool from your Gnome desktop, click on the red hat icon with a little a

upward pointing arrow. This is the Main Menu Button for Red Hat Linux. So yo11
need to say Main Menu Button -> System Settings -> Server Settings -> Domain
Name Service. This will bring up the main window of the tool, as shown in Figure 2.
The configuration file for bind is / et c /named.conf. If you are going to use the
configuration tool, do not edit the file by hand as all changes yo11make will be lost
when the tool writes out to the file when it is closed. Unlike the HTTP Configuratioli
Tool, though, you can also put in your own configi~rationthat yo11make by hand, by
placing it in the file /etc/named.custom.

Figure 2: Bind Configuration Tool

You can work with the zone files and can add, delete or edit zones, which can be a
forward master, a reverse master or slaves To save your changes yo11need to use
the menu option File -> Save or just use the save button. If you want to quit without
making changes, use File -> Quit. The changes you made are reloaded by named so
that they take effect right away. I

You can add zones by clicking on the New button in the main window. A window
titled "Select a zone type" appears where yo11car1 select from Forward, Reverse 01. i
Forward Master User to User
A window for "'Name to IP Translations", shown in Figure 3, appears with the name
of the zone that you just entered. 'The zone file name is the same as that of the zone,
but with a . z o n e suffix. This filename is relative to the / v a r / n a r n e d directory.
In the contact field you can enter the e-mail address of the primary contact for the
domain. The default, r o o t @ l o c a l h o s t ,is probably not the best choice.
Next you need to enter the name of server that is authoritative for this domain. This
is used to create the Start of Authority record for the domain. You must specify a
primary nameserver and enter a record for it. The serial number has to be
incremented each time there is any change to the configuration file, so that slave
servers will update their own files. Usually it is set to the date of the file followed by
a number, such as 20041226001. To change the serial number from the default of 1,
click on the set button and enter it.
The butt011for "Time Settings..." lets you change the different life cycle times that
you have to specify in a DNS file. These are the time to refresh, retry, expire and the
minimum time to live (TTL). The values are to be entered in seconds, and here the
defaults that appear, 28800,7200,604800 and 86400, are reasonable enough that you
can leave them alone. However, depending on the characteristics of your site, you
niiglit have to alter these values.

-. - -- ---
Scrlal Number:

Figure 3: Forward Master Configuration

Finally you can add records for hosts, aliases and nameservers by clicking on the
Add button in the Records section. You must add an entry for a nameserver.
When you are done you can save the configuration.
Reverse Master
When you choose to add a reverse master zone, you have to enter the first three
octets of a valid IP address. The tool performs the necessary checks to see that
the address entered is of a valid format. After you click OK, you will see a new
window titled "IP to Name Translations" that shows several fields for you to
enter. The first is the IP address field that is the same as the IP address that you
just entered. The name of the zone is constructed from this by putting the octets
in reverse order and appending ".in-addr.arpa7'. The name of the zone file is the
Linux Operating System same as this with the suffix being ".zone". The contact field contains the e-\nail
address for the primary contact for the zone. As in tlie case of a forward master,
you have to enter the name of the server that is authoritative for the domain
together with the serial number. This is automatically incremented by the tool and
can also be set manually by using the Set button.
You have to again add the zone life cycle information and provide at least one
name server for the zone. The portion here that is different from the forward zone
is the reverse lookup table of that gives the hostname for each IP address in the
zone. When you click on the Add button you are prompted to add the IP address
and the complete hostname (ending with a period) for hosts in the zone.
At the end of this you can save tlie configuration or quit. If you save, tlie named
service will take cognizance of the changes and they will take effect. The window for
Reverse Master configuration is shown in Figure 4. arpa

I10 168 192
-- - -

. - .-

Slave Zones
You can also add a secondary master or a slave zone to your configuration. These
serve as backups to the primary master for the zone. Here you have to add
information on the nameservers from which the slave is to pick up its data, together
with the name of the DNS database file. This name is specified relative to the /var/
named directory. The nameservers are specified as IP addresses.
4.5.2 Network File Server
You can configure a Linux machine to work with a Network File System (NFS), where
files on other machines on tlie network can be made available as if they were local
files. A Linux machine can work as an NFS client, whereby it accesses files on the
network. You can also configure your Linux machine as an NFS server, whereby you
can let other machines access files on yours. In this section we will look at how this
can be done.
As we have seen for the webserver and DNS server cases, although yo11can
construct an NFS configuration file by hand, Linux comes with a tool to ease the task.
This is the NFS Server Configuration Tool. It requires superuser or root access to use
tlie tool. Being graphical, you must have the X-Window system running to be able to
use the tool. But you can still start up the tool from the command line by issuing the
following command at the root prompt
[root@linux root]# redhat - con£ i g - n f s
The NFS Server Configuration Tool both reads from and writes to the configuration
.file /etc/exports, and so you can modify the configuration file by hand after using the
tool. If you use the tool again later, it will understand and recognize your changes,
provided you did the configuration correctly with the proper syntax. The main window
of the tool is shown in Figure 5 below:
ale MP

i -- -.
. -- - ---- .- - - -- . -. -- . - . .. -- . , - .-- -- I
Figure 5: N F S Server Configuration Tool M a i n Window

To share a directory, called adding an NFS share, you need to click on tlie Add button
above. This brings up a window with the title "Add NFS Share" that has three tabs.
The "Basic" tab allows you to specify a directory and a radio button lets you decide
whether you want to allow read-write or read only access to others on it. You also
have to specify the machines or hosts that are to be allowed access to that directory.
This can be done by:
Giving a fully qualified domain name. This should be something your niacliine
can resolve to an IP address.
Giving an IP address.
Giving a host name, again your machine should be able to resolve this to an IP
Giving a group of machines by specifying them as a domain name or host name
with wildcards. You can use a * for matching any number of cliaracters except a
period, and a ? to match any single character.
Giving an 1P network by specifying the network and a / followed by the number
of bits in the netmask, or by specifying the netmask itself.
Doing the above makes the directory accessible to the host or hosts with permissions
as desired.
The "General Options" tab has five options as described below:
If you want to allow ordinary users to be able to start the NFS service and allow
shares, you have to allow the service to be started on ports higher than 1024.
This does make the service less secure because tlie share does not require the
concurrelice of tlie administrator.
You can decide to allow insecure file locking.
You can decide to disable subtree checking. This is useful if you have exported
an entire file system, because your server will no longer check to see whether a
file requested by a client is in the directory that has been shared.
You can choose to force synclironization of writes immediately.
You can choose to disable sy~ichronizationof write options, where the server
first writes out to disk the changes caused by a request before replying to it.
I L i n v r Operating System The "User Access" tab has the following options that you can set.
You can allow the superuser of a client machine root privileges on your maclii~ie
This is a big security risk and sliould be used only if necessary. Otherwise, by
default, even tlie root user of tlie client is treated as an anonymous user on your
You can map all users on the client to the anonymous ilser on your ~iiacliine.If
you clioose this option, you can set tlie user id and group id of tlie anonymous
You can now click on tlie OK button to save the co~ifigurationyo11 have made. Of
course you can add as Inany directories as you wish to share. You call also edit
directory properties by selecting it and choosing tlie "Properties" button in the main
window. This button is initially greyed out when there are no directories shared.
Si~nilarlyyou can delete a directory by selecting it and choosing the "Delete" button.
Whether you add, edit or delete a directory, tlie configuration takes effect immediately
after you save it. Tliis is done by generating tlie new /etc/exports file and restarting
the NFS server daemon.

This brings us to tlie end of tliis unit. tiere we have looked at two broad tlienies -
witli otlier users and setting up youl- machine as a server for different
kinds of services.
In user commu~iication,we have looked at online and offline co~n~nunicatio~l. We have
seen how to use tlie write command to quickly co~nmunicatewitli otlier users on Y O L I ~
machine. It is a simple command tliat provides only a rudimentary co~nmunication
facility. We then looked at an instant messaging application from Yahoo! That provides
many sophisticated features and allows us to talk to anyone else connected to tlie
Internet. l l i e only demand this places on us is tliat it needs a good connection to tlie
Internet, while tlie write com~na~id has no such constraints.
For offline co~iimunicationwe looked at tlie Evolution e-mail client from Ximian. Tliis
allows us to communicate asynchronously witli users who niiglit not be online at tlie
same time tliat we are. It lias a wealth of features tliat make the task of sending and
receiving mail easy and we therefore did not consider the inbuilt mail conitnand in
We then looked at setting up three different kinds of services. First was tlie Apachu
webserver tliat is available in Linux and is one of tlie ~iiostwidely used webservers.
We saw how to use the configuration tool provided witli L i n ~ to~ xconfigure tliis
Next we saw how to configure our macliine as a DNS server using tlie configuration
tool available in Linux. Finally, we saw how to set up our machine so as to make it an
NFS server.
All the server settings were discussed witli reference to tlie user friendly, graphical
configuration tools available in linilx.

Check Your Progress 1
I ) a) Postal co~n~nunicatiotiis slow atid can be unreliable. But you can send
physical material by post, something that is quite impossible electronically.

b) A telephone conversation is synchronous and we can listen to tlie otlier

90 party's response immediately. We also know if the otlier party lias got our
message. When communicating using a computer, we can use User to User
asynchronous methods so that both parties do not have to be present Communicrtion
2) Try
cat /dev/tty04
where ldevitty04 is the device file corresponding to the desired terminal.
One can also try
cp msgfile > idevltty04
3) You get an error message like
write: Inputloutput error
4) Prepare the message and store it in a file such as msgfile. For this you can use vi
or any other editor. Then say
write khanz < msgfile
because write reads the standard input. You will have to see that khanz is logged
in. If he is logged in from more than one terminal you will need to specify the
terminal as well.
Check Your Progress 2
1) You can login but others who have you in your friend list will not be able to see
that you are online. This is called logging in invisible mode.
2) Try Yourself
3) When she has not responded to your message for quite some time and you want
to draw her attention.
4) Try Yourself
5) One way is to select the transcript and copy it to a file in your favourite word
processor. . .

Check Your Progress 3

1) Try Yourself

messages. This makes it easier to look for a message.

4) This saves us from the trouble of having to remember a large number of e-mail
addresses. One can save the contact details of a person and then just use a
short name or his nickname to send mail to him.

There are a host of resources available for further reading on the subject of Red Hat
Linux version 9.0.

2. http:/ gives among other information, a list of good books on Red

Hat Linux.
3. Consider ioininc!a good linux mailing list.
Structure Page Nos.
5.0 Introduction 92

5.1 Objectives 92
5.2 System Administration 93
5.3 Installing Linux 94
5.3.1 Choosing an Installation Method
5.3.2 Choosing an Installation Class
5.3.3 Pre-installation Checks
5.3.4 Installation

5.4 Booting the System 105

5.5 Maintaining User Accounts 107
5.6 File Systems and Special Files 110
5.7 Backups and Restoration 113
5.8 Summary 114
5.9 Solutions1Answers 114
5.1 0 Further Reading 115

I n the previous units you have been introduced to Linux and have got an idea of its
features and the facilities available in it. In this i~nitwe will look at how to administer a
Linux system and take care of it so that you can make use of its power. This would
mean being able to install Linux on a machine and configuring and setting it up so that
you could start working on it. It also requires maintaining tlie machine subsequently,
such as by adding user accounts and keeping your data safe by backing it up.
The activities described in this unit are mostly performed as the superuser. So you
have to be very careful and understand the commands yo11 issue thoroughly, because
Linux does not conduct many checks on what the superuser asks it to do. As an
ordinary user you could not modify a file ifyou did not have permission, but the

cause severe damage to the installatio~ithrough one mistakenly issued conimand.

After co~npletingthis unit, you should be able to have an understanding of basic system
administration tasks and be able to perform basic installation, configuration and
maintenance of a Linux system. Some of the abilities you should have acquired are:
understand what is meant by system administration;
understand the responsibilities of tlie system administrator;
message. When communicating using a computer, we can use User to User
asynchronous methods so that both parties do not have to be present Comm~nicrtion
2) Try
cat ldevltty04
where Idevltty04 is the device file corresponding to the desired terminal.
One can also try
cp msgfile > ldevltty04
3) You get an error message like
write: Input/output error

4) Prepare the message and store it in a file such as msgfile. For this you can use vi
or any other editor. Then say
.I write khanz < msgfile

because write reads the standard input. You will have to see that khanz is logged
in. If he is logged in from more than one terminal you will need to specify the
terminal as well.
Check Your Progress 2
1) You can login but others who have you in your friend list will not be able to see
that you are online. This is called logging in invisible mode.
2) Try Yourself
3) When she has not responded to your message for quite some time and you want
to draw her attention.
4) Try Yourself
5) One way is to select the transcript and copy it to a file in your favourite word
Check Your Progress 3
1) Try Yourself

2) The mail command has a rudimentary, hard to use interface. It does not have the
features one would expect to have in a good e-mail client.
3) It allows one to organise one's mail better. Related messages can be stored in
different folders rather than all messages being in one folder with hundreds of
messages. This makes it easier to look for a message.
4) This saves us from the trouble of having to remember a large number of e-mail
addresses. One can save the contact details of aperson and then just use a
short name or his nickname to send mail to him.

There are a host of resources available for further reading on the subject of Red Hat
Linux version 9.0.

2. htt~://www.linux.orggives among other information, a list of good books on Red

Hat Linux.
3. Considerjoining a good linux mailing list.
- --

Structure Page Nos.

5.0 Introduction 92
5.1 Objectives 92
5.2 System Administration 93
5.3 Instal ling Linux 94
5.3.1 Choosing an Installation Method
5.3.2 Choosing an Installation Class
5.3.3 Pre-installation Checks
5.3.4 Installation
5.4 Booting the System
5.5 Maintaining User Accounts
5.6 File Systems and Special Files
5.7 Backups and Restoration
5.8 Summary
5.9 Solutions/ Answers
5.10 Further Reading

In the previous units you have been introduced to Linux and have got an idea of its
features and the facilities available in it. In this unit we will look at how to administer a
Linux system and take care of it so that you can make use of its power. 'I'his would
mean being able to install Linux on a machine and configuring and setting it up so that
you could start working on it. It also requires maintaining the ~nachinesubsequently,
such as by adding user accounts and keeping your data safe by backing it up.
The activities described in this unit are mostly performed as the superuser. So you
have to be very careful and understand the commands you issue thoroughly, because
Linux does not conduct many checks on what the superuser asks it to do. As an
ordinary useryou could not modify a file ifyou did not have perlnission, but the
superuser can change any file irrespective of its permission settings. This might seein
like a convenience, and it is indeed so. But it also means that you have the potential to
cause severe damage to the installation through one mistakenly issued command.

After completing this unit, you should be able to have an u~iderstandi~ig of basic system
administration tasks and be able to perform basic installation, configul.ation and
maintenance of a Linux system. Some of the abilities you should have acquired are:
what is meant by system administration;
understand the responsibilities oftlle system administrator;
install Linux on a personal computer;
understand how to boot a Linux system and what goes on while starting it up;
how to add and maintain user accounts;
understand character and block special files, and
know how you can back up data from the system and restore it when required.


You have started working on a Linux system and have learnt some of the basic
facilities provided by the operating system. When you began your exploraticbn of
Linux, you were given a user account on a machine. For this to have happened,
what are the actions that somebody would have performed for you? Let us cry to
work backwards and figure this out.
First of all, somebody would have had to load Linux on the machine that you are
working on. This would mean having to know how the operating system is to be
loaded on to your machine. Secondly, having got the machine working under Linux,
so~nebodywould have to set up user accounts and give them permission to log in to
the machine and work on it. There are several other such activities that one can
think of.
Configuring the system to connect to the local area network (LAN)
Adding new hardware devices to the system, such as hard disks, a printer or a
CD-ROM drive. Taking backups of the important system and configuration files.
Booting up and shutting down the system as needed. Restoring the system to
normal working in case of a crash, by using the backups.
Fixing software problems that might arise, such as a corrupted system file.
Addressing issues such as performance tuning if the system is slow. Making sure
that the system is secure from the assault of unscrupulous persons. Installing
operating system upgrades and patches as required. Irlstalling and configuring any
new software that has been acquired by the organisation. Providing required
network services such as e-mail, Internet connectivity and other services as
appropriate. Helping ordinary users in trouble, such as those who might have
forgotten their password.
Being able to do the above requires much more knowledge of the working of Linux
than you have obtained so far. It also requires experience with various commands,
tools and utilities. The tasks listed above are not the only ones that need to be
performed for ordinary users to make use of the system and are only indicative.
Moreover, most of these responsibilities can be perfonned only by persons having
superuser or root access to the system. Ordinary users, without root permission,
cannot run many of the required commands. Because of this, these tasks have to
be performed by experienced individuals, and with great care. A moment of
carelessness could result in a wrong command being issued or an incorrect option
being used, with the potential of catastrophic damage to the insta!lation and to the
work of several users who use that machine.
The activities we have described above are the domain of a role called the system
administrator. The person who performs these tasks is called the system administrator.
Depending on the size of the organisatiou, the responsibilities of a system administrator
can be discharged by one person or by a group dedicated to this work. These people
need to have adequate experience and training or knowledge about the working of
L.inux Operating System Linux, and need to keep themselves updated with the latest happenings to keep their
knowledge current.

In a larger organisation, the work of a system administrator can be divided into various
specialities. with a different person or group looking after each such speciality. These
can be:
A Network Administrator to look after the LAN, Internet connectivity and
network services such as e-mail.
A Security group to ensure that the system is secure from hackers and other
disreputable individuals.
A Hardware support group to keep hardware in fine fettle and to ensure it works
well with your Linux system.

Solnetimes you can have a Systems Group with different individuals or sub-groups
lookingat these functions. The exact structure and division of responsibility will
depend heavily on the kind of organisation, the number of users there and the nature of
work performed. In some companies, all installations might be perfornied by a
different group or might be part of the computer supplier's work itself. A software
development group in a financial services company might have much more need for
security and so that aspect might receive more emphasis in such an establishment.

Any installation will tend to find the need for performing certain tasks again and again,
or there might be a need to do certain things for which there are no specific
commands or utilities in Linux. The system administrator therefore has occasion to
create and use shell scripts that will help her do all this easily. She should therefore be
skilled at shell programming. Such locally developed programs are often kept in a
directory such as /user/local/bin for general use.

So we see that the system administrator is responsible for installing and maintaining the .
Linux installation. The specific nature of duties will depend on the organisation, but
there are a few tasks that are common. The system administrator will therefore need
to have adequate skill and experience in those tasks. [n addition, he will often be
faced with problems that have not occurred before. He should therefore be good at
problem solvingand innovation. Some ofthe qualities and training that he needs to
have are:

Knowledge of the structure of Linux and its usage

Tools and utilities with their various options

r Shell programming

Diagnosing the causes of problems.

These are therefore the qualities you have to imbibe as you take on the task of system
administration. We will now look at how to perform some of the tasks of the system


One of the basic tasks that you need to perform first of all, before you can do anything
else, is to install Linux on your system. There are many ways in which you can do this
and we will look at the main methods here. As always, because ofthe limited amount
of space that we have here, we will concentrate on the main points. For more details,
you should refer to the documentation that Red Hat Linux makes available to you.
The installation process can be broken down into the following steps:
Choosing an installation method Unix System
Choosing an installation class
Pre-instal lation checks
Actual installation
Configuration and set up
In some cases you might find it expedient to perform an upgrade instead of a full
blown installation. This is something you could decide while choosing the installation
method. There are also different things to be taken care of when installing Linux on
different kinds of computers. For large machines that are more powerful than the
typical microcomputer, the vendor ofthe macliine would provide the Linux installation
and support meclianism. Here we are looking at installing Linux on an IBM
compatible personal computer. If your PC is of another type, such as an Apple
Macintosh or a laptop or an older IBM compatible, there could be additional intricacies
involved that we will not be able to cover here. You would need to make sure that
Red Hat Linux will work on that system.
So now let us assume that we have a computer on which Linux will work and begin
the steps for performing the installation.

5.3.1 Choosing an Installation Method

You have to first decide how you are going to be performing the Linux installation, as
there are many methods available. One straightforward way is to do a local
installation using a Linux distribution purchased from Red Hat. In that case you get a
CD-ROM that you can used to boot your machine with. The rest of the installation
can then be continued using the Linux CD-ROMs provided. For simplicity, we are
assuming here that your computer lias an IDE CD-ROM drive and that there is no
other operating system installed on it. This means that your computer is blank, with
nothing else on it and your Linux installation is going to be the first time anything has
been put on it. If you have some other hardware, then there will be an additional
driver diskette that you will need to have and that you will have to insert at the
appropriate time. You can boot the Linux installation program from a floppy also.
Some other ways of installing Linux are:
Using an FTP server that has the Linux images on it
Using an HTTP server that lias the Linux images on it
Using an NFS server that has the Linux images on it.
In all the above cases, you will need a network driver floppy diskette or a PCMCIA
driver diskette.

5.3.2 Choosing an Installation Class

There are different classes or types of Linux installations that you can choose from.
They are appropriate in different situations and you can decide the one to use based on
the intended end use of the system. Remember that these types really determine what
kind of software components are installed and there is no fundamental difference
between them. They are really a short, predetermined set of components or
packages. The classes are briefly described here.
Personal Desktop
This is the simplest installation that brings in the least number of software packages.
It is useful if the machine is going to be used by an end user, such as at home, or for
Linux Operating System office productivity. It will also install the GUI desktop environ~neiltwith the X-
IVindow system. This is useful for new users who are just getting familiar with Linux
and will not want to perform advanced tasks.
Such an installation needs 1.8 GB of free space. During the i~lstallationyou can still
choose to install additional packages that are not part of the default installation. So
what you really put on the machine is still up to you. But it does save you from the
tedium of choosing every single package to put in.

This installation will use LIPto twice your RAM as disk space for your swap partition.
The root partition will hold all the system files and user files. The size of the boot
partition will be I00 MB.


A workstation installation is useful for professional software developers. It puts in a

graphical user interface together with basic software develop~nenttools and more
system administration utilities. It will use up to 2.2 GB of disk space. The other
characteristics are the same as the Personal Desktop installation. Both of these can .
take up any other software packages that you want to install as yo11go through the
process. Remember that if you choose to put in more packages, the disk space
required will be correspondingly greater.


If you are going to use your machine as a server then you would perhaps not need
much configuration to be done on it. In such a case you can do a server installation
without even putting in a graphical user interface. You would then need just 850 MB ,
to 1.5 GR of space depending on how much functionality you plan to put in. Should
you decide to put in the GUl, the space required would increase correspondingly. 'The
other characteristics of the default server installation are the same as for the other


A custom installation is the most flexible option as it does not have any predetermined
packages that will be put in. You have to decide which packages you want as you
proceed. This therefore requires an understanding of the packages tliat are available
and their dependencies. It is meant for advanced users who know exactly what they
want and need the freedom to decide. The disk space required varies from 475 M B to
5.0 GB, depending on what you choose to put in.

All the above classes of installations have the same partitions if you choose automatic
partitioning. Also, the disk space requirements mentioned above assume you are
installing only the English language version. Should you choose other languages as
well, the space requirements will go up in each of the above cases.


It is also possible to install Linux on a system tliat already has some earlier version of
the same operating system. The old Linux version should be 6.2 or later, because tliat
is when the rpm method of package installation was introduced. If that is the case,
you do not have to go through all the steps needed in a fresh installation. The
advantage is that all the data that you have will be preserved in an upgrade. Your
partitions will not be altered and only the appropriate software packages will be
upgraded. So you do not have to go through the exercise of backing up your data and
restoring it after the installation has been completed.
5.3.3 Pre-installation Checks U n ~ xSystenl
Before conimencing your installation, it would be politic to garner information about
your machine. You first need to see how much hard disk space you have. That could
liave an impact on the kind of installation you can perform. However, in these days of
large hard disks of 80 GB and above, it is unlikely to be a constraint. Yet it is best to
make sure.
When we refer to the disk space, it means unpartitioned disk space that is not currently
being used by anotlier operating system because every partition on the disk behaves
like a separate disk drive. It is quite possible to install Lini~xon a machine tliat is
currently running kame other version of Linux or of an operating system like Microsoft
Windows of some flavour, such as Windows 2000 or Windows 98.
You next need to find about more about the type and make of the hardware on your
machine, as tliis is information you will have to provide as you go ahead with the
installation process. For this, you will need to refer to the documentation provided by
the manilfacturer of your machine. If you have an assembled machine, refer to the
documentation that came with the computer components tliat you put together. In
many cases, your existing operating system can give you information about your
hardware. For example, in Windows 2000 you can look at your Device Manager tab
under tlie System icon in tlie Settings to find out about the hardware and tlie specific
type and make. While tliis is no substitute for acti~allyfinding out about your hardware
pliysically, it is usually sufficient for you to be able to perform the installation.
Here is a list of some of the hardware that you should get more information about, to
be able to carry out your Lini~xinstallation without interruption.
The hard disk - is it an IDE or a SCSI? What is its capacity and is there ally
volume label? What are the partitions you will want to create and what will be
their sizes? For example, do you want to have /tmpor /home as separate
partitionsor will everything be in / r o o t ?
Sirnilarly you need to know about your CD-ROM drive. Is it an JDE or a SCSl
Wliich is your hard disk controller? If using a SCSl adapter, who is the
manufacturer and what is the model number?
What kind of mouse do you have? Here you must know the mouse type, such as
serial, bus or USB and the protocol, such as generic. Also note the number of
buttons, which are commo~ily2 or 3. Does it have a vertical or horizontal scroll
What kind of nionitor do you have? Here note the manufacturer and the model
number for reference.
What are the characteristics of your display adapter? This is especially important
if you are going to install the Graphical User Interface. Remember tlie
manufacturer and the model number as well as the amount of video RAM used.
Find out about your sound card. For this you again need to know tlie
manufacturer and the model number. In addition, note down tlie chipset i~sed.

Do not forget the amount of RAM in your computer.

Besides tlie above, you will need to have some more information for your computer to
be able to access tlie network. First you liave to choose a name for your system.
This is a personal choice and has to be unique within a domain. Orgallisations liave
their own schemes for this. Some use the names of rivers, mountains, sages or places.
Others leave it to tlie system owner while still others use mundane numbering schemes
~ n u Operating
x System such as market ing001. You will have to follow the organisation's ~olicyhere.
Make sure you know the organisation's Internet domain name. This is typically
derived fiom the organisation's name but could be different. For example, for
IGNOU, the domain name is ianou .ac .in. In larger companies, the Internet
domain name is further subdhided and if so, you have to know the domain name for
your subdivision in the organization. This could be something like
Next, make note of your network interface card. Again, here you must know the
manufacturer and the model number.
Find out the IP address allotted to your machine. This could be a static IP address
decided by the organisation. If it is allocated dynamically by DHCP, you should be
aware of the DHCP server address that does this allocation. In many cases, while
the address is allocated by a DHCP server, it is permanent in that it does not change
from one boot to the next. In addition, you need to know the network mask for your
In case your machine will boot off a machine on the network, you need to supply that
machine's IP address.
You also need to know the IP address of the default gateway for your network that
connects it to the outside world.
Lastly, you need to note down the IP address of the DNS server that your machine
will use to resolve hostnames to IP addresses and vice versa. There could be more
than one nameserver, in which case you need to know the IP addresses of those
machines as well.
Once you have all of the above information, you can proceed to the actual installation
of Linux on your machine. You should see that all of this is noted down on a piece of
paper for ready reference as you go ahead with the process.
5.3.4 Installation
We will now see how to install Linux on your machine using the Linux bootable CD-
ROM. As we have already observed, there are several ways of installing Linux.
Here we are assuming a simple scenario where you are installing Linux fiom a Red
Hat distribution from a CD-ROM on a computer with IDE drives. There is no other
operating system running on the computer, so we do not have to take into
consideration the issues involved in creating a dual boot system.
As a beginner to installation, you would prefer to use the graphical user interface with
a mouse for your work. Of course, the keyboard can also be used for working with
the GUI. Later, when you become more experienced, you can look at using a
command line interface and performing more intricate installations. These can include
using text mode installation, booting from a different source, controlling memory usage,
using kernel options and so on.
To begin loading Linux, insert your bootable CD-ROM into the drive and turn on the
machine. Here you will need to make sure that your system is configured to boot
fiom the CD-ROM. For this you might have to change your BIOS settings to alter
the boot order. If this is taken care of, your machine will display a prompt
boot :

At this point you can either do nothing and the boot process will start automatically
after some time. Alternatively, to begin right away, you can press the ENTER key, If
you do this, you would be ignoring the various boot options that you are presented with
by the program. That is just what you would probably want to do as you learn about
the process of loading Linux.
Once the booting process starts, you should find that your hardware is automatically
detected. If this does not happen, you will have lo do the installation in expert mode. Administration

But here we assume that things go well and you are able to proceed. You will now get
the boot loader screen, where you should select the option to install from CD-ROM.
The system will first try to determine the type of your CD-ROM drive. If yours is an
IDE type drive, the program should detect it. In case you have a SCSI drive, you will
be asked to choose a SCSI driver. 1f.your drive is an IDE but the program is not able
to detect it, you will need to refer to the Linux installation documentation or seek expert
help on the matter.
If all goes well, you will come to a screen that says Language Selection. Here you
have to specify the language that you would like to use during the installation process.
There is a wide choice here, that includes Chinese, Japanese, French, Italian and many
more. Let us assume that you want to work with English, in which case you should
select it and then click on the Next button to continue.
Tlie next screen that you get prompts you to select your keyboard layout type that you
want to use. Here you would probably want to use the U.S. English layout. This is the
QWERTY keyboard that we are familiar with and that has the $ sign over the number
4 in the top row. So select this layout using the mouse. You can also change your
keyboard layout after the installation is over by using the keyboard configuration tool.
This brings us to the next screen, which is where we specify the kind of mouse that we
have. Here there are many choices, and unlike the previous two cases, it is not at once
apparent what ty?e you are likely to have. The research on your hardware that you

Mouse Configuration
Choose the correct mouse type

Do you have a PSR, USB, Bus

2 Bunon Mouse (PSf2)
or serial mouse? (Hint If the
connector your mouse plugs
into is round, it is a PSR or a
Bus mouse; if rectangular,it is
US6 mouse; if trapezoidal, it is

Try to find an exact match. If an

exad match cannot be found,
choose one which is
compatible with yours.
Othemise, choose the

If you have a serial mouse, pic

Figure 1: T h e Mouse Selection Screen

would have done in the previous section is what will now come in useful. You need to
choose from among the many mouse types supported. Since you already know the
kind of interface your mouse uses (PS/2, AT, serial, USB) and the number of buttons
that it has, you will be easily to make the appropriate selection. Figure I shows this
screen to make things clearer for you.
Linux Operating System What does one do when one cannot find an entry that seems to match our mouse?
You can try the Generic type. If your mouse has a scroll wheel, you can make the
selection as applicable, by choosing USB or PSl2. Another selection that you have to
make is whether to emulate three buttons when your mouse has only two, This can
make it easier to use a graphical user interface. The emulation is done by considering
the middle button to be substituted by both the left and right buttons. So if you press
both of them simultaneously, it is equivalent to pressing the middle button.
After completing the installation, you can make your mouse left handed. This is more
convenient for left handers as it corresponds to their natural hand. Here the functions
of the left and right mouse buttons are interchanged. So the right button becomes the
main button.
Finally, if your mouse is a serial mouse, you will have to specify the device or port
(such as COM 1 or COM2) that your mouse connects to. Now having answered all
the questions related to your mouse, you can click on the Next button and proceed to
the next screen.
The installation program can detect a previous version of Linux that is already present
on your system. In such a case, you will now come to a special screen that will
prompt you and ask whether you want to upgrade your existing installation. Should
you choose to upgrade, all your existing data will remain safe. None of your partitions
will be changed and only the required files will be altered and overwritten. This option
will work for Linux versions 6.2 and later. You will have the option to customise the
installation and to choose the packages you want upgraded.
However, it might be that you simply want to throw away your old installation and
begin again from scratch. This time your data might or might not be preserved,
depending on what kind of partitions you make in your fresh installation. If they are
the same as the existing ones, your data will be safe. Should you choose a different
partitioning scheme, then your data will be erased and will no longer be accessible
after the process is over.
Once you have made your choice, you need to click on the "Next" button to move on
to the next screen. This is where you choose your installation class or type. You
already know about the differences between the Personal, Workstation, Server and
Custom installations. If your machine will be used by developers in an office
environment, the Workstation type might be best for you. After making your selection,
go to the next part.
Now you come to an important screen where you have to partition your hard disks.
This can be a daunting task for a beginner, but since you are a system administrator, it
should be easy for you. Linux comes with a tool called Disk Druid to help you do this.
Whenever, you perform an installation, you should be prepared for the possibility of
losing all data on the disk. Therefore, it is important to back up all your important data
before commencing the operation. In this idiscussion, we have not so far dwelt on the
point because we assume you are installing on a new machine that does not have
anything on it.
When using Disk Druid, you will have full control over the partitions. You will be able
to choose the partition sizes and the types of the file systems you want to create on
them. You will be able to decide where they will be mounted when Linux runs.
However, if you do not want to go through this, you can ask the program to perform
automatic partitioning. This does not give you much control but is a good option if you
do not want to change anything or are doing your first Linux installation.
Even automatic partitioning will allow you to choose what kind of existing partiti*&
are to be deleted from your disk. These choices are presented to you on the next
screen. You can decide that you want to delete all old Linux partitions, or all existing
partitions that might have other operating systems or file system types installed on Unix System
them. Instead, you can also choose to preserve all existing partitions and use Administratidn
whatever free space is available on the hard disk. Since you might have more than
one hard disk, the screen allows you to choose the one on which you want to create
these partitions. All the partitioning choices will apply only to the disk that you have
You can then review the partition selections that will apply and confirm or decide to
modify them. Here you will be working with the Disk Druid utility, as you would have
had you chosen to partition manually. At this point you will be faced with some detail,
as you have to decide where you want Linux to be installed. You would have already
made these choices while preparing for the installation.
The Disk Druid shows you the hard disk and its model number at the top of the
screen. You also see the number of cylinders, heads and sectors that collectively
describe the drive's geometry. You should make sure that this is in tune with what you
already know about your hard disk. The tool then shows the device file corresponding
to the device, the point in the directory hierarchy at which it will be mounted, the type
ofthe file system it will contain, whether the partition will be formatted, its size and the
start and end cylinders for the partition. This is shown for every partition.
Let us take a brief look at the different kinds of file systems that are available to you.
A swap partition is used to increase the amount of virtual memory that your Linux
system can use, as it supplements the RAM. Whenever required, pages are swapped
from RAM to the swap partition on the disk and are loaded back when possible.
Usually the size of the swap partition is made twice the RAM that you have. Linux
has a file system called VFAT that is compatible with Microsoft's FAT file system and
supports its long filenames.
The tool also allows you to create RAID partitions for redundancy that makes for
more safety of your data, because if one partition develops an error, you can still
access your data from the other. However, in this first shot at Linux installation, we
will not venture into configuring RAID partitions. But this can be done by first
creating two or more partitions that have a RAID file system type.
You can also create logical volumes using the tool. Here you can use one or more
partitions on the same or different hard disks to work like one single logical partition or
volume. This can allow you to have volumes that are larger than any single hard disk
that you have. Again, in this introduction, we will not go into more detail about creating
and maintaining logical volumes. You can create physical logical volumes by selecting
that as your file system type.
The ext2 file system is the basic Unix file system and ext3 is the journal l ing version of
ext2. Journalling allows you to quickly recover from system crashes. The default file
system type in Linux is ext3, and is also the recommended choice.
Let us now look at the operations we can perform with the tool. You can add, remove
or modify partitions. You also have a reset button that lets yau restore the initial state
of the disk, the situation that prevailed at the time you started the session. If you reset,
the changes that you might have asked for in the session will be lost.
You can remove a partition from the disk. If you do so, you will be asked to confirm,
as this has the potential to cause loss of data if it was an existing partition that was in

When you choose to add a partition, you have to provide information about it. The first
thing is the mount point. To help you, there is a pull down menu that you can use to
select the appropriate value here. For example, the boot partition should be mounted
on /boot and the root partition on /. Then you need to enter the type of the file
Linux Operating System that you want the partition to contain. The next selection is where you specify the
hard disks that can contain the partition. If you do not select a disk, then your partition
will not be created on that disk. You would usually let the tool decide where to place
the partition.
You now need to enter the size of the partition. You can either enter a fixed size in
MB, or choose to allow the partition grow from a base size to an upper limit as
required. You can even choose to let the partition grow to fill up the entire available
space on the disk. Next you can decide to let this be one of the primary, or first four,
partitions on the hard disk. If not, it would become a logical partition. The last option
while adding a partition is specifying whether you want to check for bad blocks while
formatting. While it is a good thing to do, checking for bad blocks can take a fair
amount of time, especially with the large capacity hard disks of today.
Similarly, when you select a partition for editing, you can change its attributes such as
the file system type or size. If the partition information has been already written to the
disk, you can only change the mount point of the partition. Should you want to change
other attributes, the only way is to remove the partition and create it again with the
new attributes.
Once you have done partitioning your hard disks, you need to move ahead to the next
installation screen that lets you install your boot loader. A boot loader is needed so that
it can load Linux. Whenever the computer is started up, its BIOS loads the program
that is installed on the Master Boot Record (MBR) of the hard disk. This program
then loads the operating system. You can also install the boot loader on the first sector
of your boot partition, in which case the boot loader on the MBR will need to be asked
to start up your boot loader. So if your disk has only Linux as the operating system,
you should place your boot loader on the MBR.
Linux has two boot loaders called Grub and Lilo. Grub is powerful and can load Linux
as well as other operating systems. Lilo is also a good boot loader and can boot Linux
from several different sources. You will also have to choose which operating system
to boot from by default, in case you have another already installed on your hard disk.
Then when you boot your machine, you will have to choose the other manually if it is
not the default.
You need to remember that if you do not install a boot loader, you will be able to boot
Linux only through a boot diskette. So you should install one unless you have some
special reason for not doing so. This could be because you already have your
favourite boot loader, such as a third party commercial offering like Partition Magic,
installed on the hard disk. After the boot loader installation screen, the n e ~screen
t you
reach will depend on whether you have a network interface card on your computer. If
so, you will reach the network screen. In an organisational set up, this is the most
likely situation. So let us now look at the configuration to be done here.
If you were installing off a network, then you would have already used a network
driver diskette to be able to work. But if you started installing using, say, a CD-ROM,
then you can now configure your network cards. You have to select from the devices
that are detected during installation and decide whether they should be activated
automatically at boot time. For each device, you need to edit its properties, namely, its
IP address and nehnask. If these will be supplied by a DHCP server, you can specify
this here. These values will depend on what is used in your organisation.
You can now enter the hostname and let it be detected automatically by a DHCP
server. These decisions you would have already made as part of your pre-installation
preparation. Now you also need to put in the IP addresses of the gateway for your
network that connect it to the outside world and the IP addresses of up to 3 DNS
servers for it. If you are using DHCP, these will be provided automatically and you
need to enter this information only if you are providing the IP address of the machine Unix System
manually. Administration

It is quite all right to provide this information manually for one network interface card
and to set these values for another card through DHCP. Once you are done with the
network configuration you can select the Next button to move on to the next screen
where you will set up your firewall.
In these days of networks, your computer is vulnerable to all manner of attacks by
persons so inclined. A firewall offers protection against intruders over the network.
Well configured, it reduces the chances of an attack greatly. You can choose from
three levels of predetermined security policies. The first is the option of not using a
firewall at all. While it might seem strange after what we have just said, this can be a
good choice if you are sure your machine is going to be on a trusted network, such as
a corporate network protected by other firewalls. Also, you might be planning to
perform a more elaborate firewall configuration later.
The next level of security that you can choose is medium. This disables access from
the outside to reserved ports, that is, up to port 1023. So services like HTT?, FTP and
so on will not work. Also barred are NFS servers and clients and X-Window display
access to remote machines. The X font server is also disallowed.
The highest level of security bars all but DNS and DHCP. If the pre-configured
firewall rules seem too restrictive or are not what you want, you can always perform
additional customization. One thing that is possible is to declare some devices as
trusted, whereupon no firewall checking will be done for them. You could do this on a
multi-homed machine, where some of the networks are trusted. So if you are on the
Internet through one interface and are connected to your company network through
another, you can decide to declare the company network as trusted. You can also
choose to allow access to additional ports beyond those allowed by your security level.
Some of these are listed as service options that you can select through a checkbox, for
instance mail and FTP. Besides, you can allow any arbitrary ports by using the
port : protocol
such as 1111:tcp.
Having secured your system, you can select the Next button to move on to the
succeeding screen where you can set your language options. Linux allows you to
work in multiple natural languages. As you might imagine, you have to choose at least
one language to work with. If you choose only one language, it is the default as well.
If you choose more than one language, you need to choose one language that will be
your default.
The language that you chose to use for installation at the beginning of the installation
process might not be the same as the language you choose to install for use thereafter.
However, that is the language selected by default. If they are different, then after the
installation is over, you will be able to use only that language. For example, if you use
English (USA) as the language for installation, and seleot French (France) as the
language in this screen, then your installation will continue in English. Once the
installation is over, you will be able to use only French.
You should choose all the languages that you might want to use during normal working.
But it might be better to avoid choosing languages that you are not likely to use,
-because of the extra disk space that will be taken up by putting them in.
-- - -

Well, that has been a lot of choosing and decision making! Now it is time to sit Unix System
back and let the machine do some work for a change. When you go to the next
screen, you are at a point where you have to make one final decision about
whether to go ahead with the installation as you have chosen. This is the last
chance you have to abort safely, because if you go ahead here, the partition
information will be written to disk and the installation will begin. Even so, to abort
the installation, you need to reboot the computer.
Linux Operating System To select the time zone, you have two methods. You can enter the offset from UTC
for your location. So for India choose the option for +5:30, as Indian Standard Time is
5 hours 30 minutes ahead of UTC. For countries that use daylight saving time, you car_
set that too.

The second method is to set the time zone interactively, based on your location. You
see a map of the world with many important cities marked out with yellow dots. The
place you select will be shown with a red X.

Once the time zone has been set, it is time to set up your root password. This is an
important password, as the root or superuser has complete control over the system.
Restrictions and permission settings that apply to ordinary user accounts are no bar for
the root user. So this password must be set with care. Make sure that it is not easy to
guess. You have to enter the password twice and both the entries must match for the
installation to move forward. If you are going to be administering this system, you
must preserve the password carefully. But even then, do not use this account for
ordinary work, because a small mistake as root could damage your installation. Use it
only for administrative work on the machine.

The next screen is for setting up authentication information. You need not really do
anything here unless you are going to set up network passwords. But you could
choose the "Enable shadow passwords" option. This keeps your password more
secure because the actual password is stored in the file /etc / shadow instead of
/etc/passwd.The shadow file is readable only by the superuser, unlike the
passwd file that is readable by all.
After this you come to another important screen where you configure the packages to
be installed on your machine. This is where choosing an installation class is useful.
Depending on what has been chosen, a list of package groups appears. You have the
option of accepting the recommended packages for installation or of deciding on them
yourself. Each group of packages can have optional packages that can be installed
depending on your preference, besides base packages that are installed with that group
by default.

When you choose to customise the packages to be installed, you have to select the
checkbox next to the package group. Then you can click on the details link to obtain a
list of all packages that constitute the group. Here you can select the individual
packages that you want to have. After selecting the package groups, you can see all
the packages that will be installed on your machine. This can be done in an
alphabetical listing or as a tree structure under each group. Certain required packages
needed to run Linux cannot be selected or deselected as they do not appear in the
package listings. They are always installed. Information about a package can be had
by clicking on it.

What you need to be aware of is that some packages might be dependent on others in
order to work properly. You need not worry about what these dependencies are as the
install program finds that out automatically for you. After you have completed your
package selection, you get a list of such unresolved dependencies. You are then given
the option of resolving these dependencies by including the dependent packages,
ignoring the dependencies or simply discarding the packages that have the
dependencies. Remember that if you choose to ignore the dependencies, the packages
with the dependencies might not work as expected. Of course, if there are no
unresolved dependencies to start with, you will not see this screen.

You can see the amount of disk space that will be required by your selection, so if
there are constraints you can adjust your package selection. However, in these days
of large disks, it is not likely to be a problem.

If you have another operating system such as Microsoft Windows 2000 loaded on your
machine, you would have the choice of selecting it to boot from. If you choose to take
no action, the default operating system will be booted up anyway after the timeout
ncrind ha9 elansed.
need to enter this information only if you are providing the IP address of the machine
manually. Administration

It is quite all right to provide this information manually for one network interface card
and to set these values for another card through DHCP. Once you are done with the
network configuration you can select the Next button to move on to the next screen
where you will set up your firewall.
In these days of networks, your computer is vulnerable to all manner of attacks by
persons so inclined. A firewall offers protection against intruders over the network.
Well configured, it reduces the chances of an attack greatly. You can choose from
three levels of predetermined security policies. The first is the option of not using a
firewall at all. While it might seem strange after what we have just said, this can be a
good choice if you are sure your machine is going to be on a trusted network, such as
a corporate network protected by other firewalls. Also, you might be planning to
perform a more elaborate firewall configuration later.
The next level of security that you can choose is medium. This disables access from
the outside to reserved ports, that is, up to port 1023. So services like HTTP, FTP and
so on will not work. Also barred are NFS servers and clients and X-Window display
access to remote machines. The X font server is also disallowed.
The highest level of security bars all but DNS and DHCP. If the pre-configured
firewall rules seem too restrictive or are not what you want, you can always perform
additional customization. One thing that is possible is to declare some devices as
trusted, whereupon no firewall checking will be done for them. You could do this on a
multi-homed machine, where some of the networks are trusted. So if you are on the
Internet through one interface and are connected to your company network through
another, you can decide to declare the company network as trusted. You can also
choose to allow access to additional ports beyond those allowed by your security level.
Some of these are listed as service options that you can select through a checkbox, for
instance mail and FTP. Besides, you can allow any arbitrary ports by using the
port : protocol
such as Ill1 :t c p .
Having secured your system, you can select the Next button to move on to the
succeeding screen where you can set your language options. Linux allows you to
work in multiple natural languages. As you might imagine, you have to choose at least
one language to work with. If you choose only one language, it is the default as well.
If you choose more than one language, you need to choose one language that will be
your default.
The language that you chose to use for installation at the beginning of the installation
process might not be the same as the language you choose to install for use thereafter.
However, that is the language selected by default. If they are different, then after the
installation is over, you will be able to use only that language. For example, if you use
English (USA) as the language for installation, and seleot French (France) as the
language in this screen, then your installation will continue in English. Once the
installation is over, you will be able to use only French.
You should choose all the languages that you might want to use during normal working.
But it might be better to avoid choosing languages that you are not likely to use,
because of the extra disk space that will be taken up by putting them in.
You are now at the tail end of the installation process. The next item to be configured
is the time zone. Here you can choose to set your system clock to Universal Time
Coordinated (UTC) that is based on the O0 longitude that passes throigh Greenwich.
The time that you will then see will be based on UTC and the time zone that you enter.
Linux Operating System To select the time zone, you have two methods. You can enter the offset from UTC
for your location. So for India choose the option for +5:30, as Indian Standard Time is
5 hours 30 minutes ahead of UTC. For countries that use daylight saving time, you can
set that too.

The second method is to set the time zone interactively, based on your location. You
see a map of the world with many important cities marked out with yellow dots. The
place you select will be shown with a red X.

Once the time zone has been set, it is time to set up your root password. This is an
important password, as the root or superuser has complete control overthe system.
Restrictions and permission settings that apply to ordinary user accounts are no bar for
the root user. So this password must be set with care. Make sure that it is not easy to
guess. You have to enter the password twice and both the entries must match for the
installation to move forward. If you are going to be administering this system, you
must preserve the password carefully. But even then, do not use this account for
ordinary work, because a small mistake as root could damage your installation. Use it
only for administrative work on the machine.

The next screen is for setting up authentication information. You need not really do
anything here unless you are going to set up network passwords. But you could
choose the "Enable shadow passwords" option. This keeps your password more
secure because the actual password is stored in the file /etc / shadow instead of
/etc/passwd. The shadow file is readable only by the superuser, unlike the
passwd file that is readable by all.

After this you come to another important screen where you configure the packages to
be installed on your machine. This is where choosing an installation class is useful.
Depending on what has been chosen, a list of package groups appears. You have the
option of accepting the recommended packages for installation or of deciding on them
yourself. Each group of packages can have optional packages that can be installed
depending on your preference, besides base packages that are installed with that group
by default.

When you choose to customjse the packages to be installed, you have to select the
checkbox next to the package group. Then you can click on the details link to obtain a
list of all packages that constitute the group. Here you can select the individual
packages that you want to have. After selecting the package groups, you can see all
the packages that will be installed on your machine. This can be done in an
alphabetical listing or as a tree structure under each group. Certain required packages
needed to run Linux cannot be selected or deselected as they do not appear in the
package listings. They are always installed. Information about a package can be had
by clicking on it.

What you need to be aware of is that some packages might be dependent on others in
order to work properly. You need not wony about what these dependencies are as the
install program finds that out automatically for you. After you have completed your
package selection, you get a list of such unresolved dependencies. You are then given
the option of resolving these dependencies by including the dependent packages,
ignoring the dependencies or simply discarding the packages that have the
dependencies. Remember that if you choose to ignore the dependencies, the packages
with the dependencies might not work as expected. Of course, if there are no
unresolved dependencies to start with, you will not see this screen.

You can see the amount of disk space that will be required by your selection, so if
there are constraints you can adjust your package selection. However, in these days
of large disks, it is not likely to be a problem.
Well, that has been a lot of choosing and decision making! Now it is time to sit
back and let the machine do some work for a change. When you go to the next Administration
screen, you are at a point where you have to make one final decision about
whether to go ahead with the installation as you have chosen. This is the last
chance you have to abort safely, because if you go ahead here, the partition
information will be written to disk and the installation will begin. Even so, to abort
the installation, you need to reboot the computer.
Once you click on the Next button here, the install program will start installing
Linux and all the selected packages according to the options that you have
provided. There is nothing for you to do but to wait and watch the installation
proceed. To relieve the monotony and to reassure you that progress is indeed
being made, you can see a bar and other screen messages that give the latest
situation regarding the install. As you can imagine, the time taken here will depend
on how fast your computer is and what packages you have chosen for installation.
Presently your installation will be completed. You will then be asked whether you
want to create a boot diskette. You should create one, because it will enable you to
boot should anything happen to your boot loader. You can create the diskette even
after the installation is over and you have started working on it. For that matter,
you can perform most of the steps in the installation such as configuring devices,
language selection, package selection, configuration of services, firewallingand so
on at any time even after the initial installation is over. The only requirement is that
you know the root password as only the superuser can perform such maintenance.
If you want, you can now configure the X-Window system server that is needed to
get your graphical user interface. You have to choose the video card that your
machine has from the list provided. If you know your card characteristics well,
you can select the unlisted card and configure it, but in general, if your card does
not appear in the program's list, it is not supported by the X-Window system. After
selecting the card, you have to specify the amount of memory it has. Try to give
the correct value and consult the card documentation if needed. While specifying
more memory will not harm anything, it can mean that you have trouble with your
X server.
The next screen lets you configure your monitor. You will be presented with a list
of monitors from which you should choose your display, or the one closest to it. If
your monitor does not appear on the list, choose an appropriate Generic monitor.
Here you have to be careful that you do not select a monitor that has capabilities
beyond yours. Your monitor can be damaged permanently if the selected monitor
has horizontal or vertical synchronization frequencies beyond those of your display.
Your monitor could get overclocked and be destroyed in such a case.
Now decide your colour depth and display resolution. You can also decide whether
after booting you want to land up in graphics or text mode. In the latter case you
will be presented with a command prompt from which you can issue any Linux
commands that you wish. It might be better to set up the machine to get into
graphics mode directly. Finally you can see your efforts bearing fruit. When you
select the Next button on this screen, you will see the long awaited message that
tells you the installation is complete. You will now be asked to reboot the machine.
You should remove your CD-ROM or diskette from which you had booted the
machine for installation, otherwise the computer will boot again from that device
and not from your hard disk.


Now you are ready to boot up the machine from your hard disk, using your freshly
installed Linux. You can reset the computer or power it off and on again. After the
Linux Operating System machine's preliminary power on checks are over, you will come to a screen where you
have the choice of booting the default operating system. Let us assume here that you
have configured Linux to be your default system.

If you have another operating system such as Microsoft Windows 2000 loaded on your
machine, you would have the khoice of selecting it to boot from. If you choose to take
no action, the default operating system will be booted up anyway after the timeout
period has elapsed.

Once Linux starts to boot, you will see several checks being performed, at the end of
which you are presented with the prompt to login. This assumes you have not chosen
to start up the graphical user interface, in which case you see a graphical login screen
rather than a text based terminal.

When you boot up Linux for the first time there is some configuration you might like to
do, such as setting the system date. You will be presented with a Setup Agent that will
lead you on through such tasks.

Booting is so called because the job invhlves something akin to lifting oneself up by
one's bootstraps, that is, from a systemwhich is off you need to have a system running
a complex operating system like Linux This task is done in stages, with a very simple
program in the computer's ROM that runs and loads a boot loader program on say, the
hard disk, which is then able to load the whole of the Linux kernel.

Once the Linux kernel is loaded, it brings the system state to the run level that is
specified in the file / e t c / inittab. In this state you have the system in multiuser
mode with NFS services available, if configured. This is the default state for a Linux
system. If you want to perform some maintenance on the machine you would do it in
single user mode that is run level 1. In this state only the console is available for
logging in and other users cannot come in.

The tasks to be done when entering a particular run level are determined through a file
called / e t c / r c .d / r c n .d, where n is the run level. This gives a list of scripts that
are run, and consists chiefly of services that are started up.

Together with booting up, you need to know how to shut down the system safely.
When in operation, the file system is buffered in RAM, meaning that it is stored in the
RAM and is then flushed to the disk from time to time. Thus the file system on the
hard disk is not always in synchronization with that in RAM. So abruptly powering off
the computer can badly damage the file system, sometimes beyond repair. To power
off a computer running Linux, use the shutdown command, which really is a user
friendly front end to the init command.

You can look at the manual entry for shutdown to see all of its many options. There
are only two that you are likely to use frequently. To initiate a shutdown immediately,

[root@linux root]# shutdown - h now

You can also give an absolute time in the form hh:mm, such as 2 3 :4 5 to shutdown
the computer at that time. More likely you want to specify the amount of time to wait
by specifying +m for the number of minutes you want to give as the grace period. The
keyword now is equivalent to + 0.

Sometimes you want to not just shutdown but to reboot as well. For this you can use
the -r option to the command.

[root@linux root]# shutdown - r now

This command will perform all the necessary work to sliutdown your machine in an Unix System
orderly manner.

Check Your Progress 1

1) List some of the duties of a system adniinistratos.

2) Turn off the computer abruptly when you and other are working on it. See how a
file system cousistency check is performed. Is it possible that some data gets lost.


3) Find liow to force a file system consistency check.


You liave seen in the second unit how users can login into the system and how
passwords are used to prevent unautliorised access. You also saw liow one or more
users could be associated with a particular group. When you studied the long listing
provided by tlie - 1 optiori to the 1s command, you saw how the user name and group
were also given for each file in the listing.

You also know that an ordinary user cannot help you if you have forgotten your
pass\vord, and tliat only tlie superuser call set somebody's password without already
knowing what it is. One of the duties of the system administrator is in fact maintaining
user accounts. Tliis activity encompasses creating new accounts, deleting accounts of
users who are no longer permitted to access the site and helping people who might
liave forgottell their passwords. On many large installations the system administrator
will run regular cliecks on user passwords to make sure that they canliot be guessed

The Li~iuxutility for setting passwords does perform some checks for the quality of the
password. but do not rely on them completely. Some of the messages it can give are:

BAD PASSWORD: it is based on your username

BAD PASSWORD: it is too short

BAD PASSWORD: it does not contain enough DIFFERENT characters

BAD PASS WORD: it is too sin~plistic/systematic

These give you an idea of tlle kind of cliecks tliat are done, but the system
administrator can also help here by setting a minimu~nand niasimum time between
permitted password changes. The check for the minimum tinie is based on tlie
premise that an intruder will want to change the password as soon as he gains access.
The user call also be given a warning some time before the password is due to expire
and passwords not changed for a given time even after they expire can be taken as
inactive. You should choose passwords that are not easy to guess and should change
them periodically. 107
Linux Operating System With all this background, let us see just how user accounts are maintained. This
information is kept in a file called /etc/passwd. This file looks like this:

You should have been able to decipher some of this file. It contains a one line entry
for every account. The different fields in this line are separated by a colon (:). The
first field is the login name of the user. This is the name by which the user will be
known on the system. The second field simply contains an x when you are using a
shadow password file. Because the file is readable by everybody, placing the
password, even though encrypted, in the shadow file gives you added security. The /
et c / shadow file is readable only by root. So an intruder will not be able to easily
read even the encrypted password. Look at the shadow file entries for the accounts
shown above:

[root@,linux root]# cat / etc /shadow

The first field is the user's login name followed by the encrypted password. It can be
up to 34 characters long depending on the algorithm used. A * in the password field
means a user cannot login using that name because it will not match any password.
But the same effect can be achieved by locking the account using the -I option to the
passwd command. This does not apply to the superuser because in his case the
password check is not performed at all.

Coming back to the pas swd file, the third field is the user identification number, or
user id or uid. The linux operating system works in terms of ;he user id rather than the
name for most purposes. Any user with an id of 0 is a superuser, and ids below 100
are usually reserved for the use of Linux. Ordinary users get ids from 100 onwards.
Now we will discover an interesting fact. Suppose you login as an ordinary user,
kumarr, who has a user id of 500. Create a file /homekumarr/checking, logout and
login as root, and look its long listing.

108 [root@linux root]# 1s -1 checking

-rw-rw-r- 1 kumarr kumarr 665 Nov 29 21:13
checking Administration

Now edit the passwd file carefully and change kumarr in the first field to smith:
Look at the listing of the file checking again.

[root@linux root]# 1s -1 checking

-rw-rw-r- 1 smith kumarr 665 Nov 29 21:13


You will see that 1s now reports smith as the owner. This shows that the 1s
command uses the passwd file to translate the user id to the user name. If you delete
the account of kumarr by removing his entry in the pas swd file, you will see

[root@,linux root]# 1s -1 checking

-rw-rw-r- 1 500 500 665 Nov 29 21:13


This is because now 1s is not able to find out who the owner is and therefore reports
the user id instead. Do put back kumarr ' s account under his own name now!

The fourth field is the group identification number or group id or gid. The file
/ etc /group coptains the group names corresponding to the group ids, and also
contains information on which users belong to which group. This file is also used by
the 1s command to translate group ids to group names, just as it does with user
names. The fifth field is a comment field containing up to 30 characters. The sixth
field gives the home directory of the account and thus determines where he will reach
when he logs in. The last field gives the shell he will be presented with. If the
command there is not executable, the user will not be able to log in. The default shell
is / b i n / s h, used when the field is empty.
Managing User Accounts

You naw need to know as a system administrator how to add new user accounts,
remove or inactiyate them and change *eir characteristics. This is quite simply done
in Linux. You need to go to the stao button which is the red hat icon with an upward
pointing arrow, usually to the left of yo~lrtray. Then choose the appropriate options as
shown here.

Start -> System Settings -> Users and Groups

If you are not the superuser, you will be prompted to enter the superuser password.
You then reach the Rs;4 Bat User Manager screen. ~ e : e youbill see a list of user
accounts. This does not inc31~4esystem related accounts. You have buttons to Add an
account, at which you will have to enter the relevant information for the user such as
his group and initial password. You also have an option to manage groups, where you
can change the groups to which a user belongs.

To change the atfributes of a account, you need 10 select it and click the Properties
button, This brings up a User Properties screen where you have four tabs. Using
these you can change a11 inform~tiopabout the user, including setting his password and
changing the groups he belongs to.

You can also delete an account if you need to, or you can just lock it and disable
access to the account by any ordinary user.
Linux Operating System
So far we have looked at two kinds of files, directories and ordinary files. Linux looks
at everything as a file. So all hardware devices like terminals, tape drives, floppy
drives, CD-ROM or DVD-ROM drives, printers and scanners are considered to be
files in Linux. What this means is that there is a filename associated with each device
and you can read from or write to these files just as you would to an ordinary file.
There is a device driver in the kernel for every device supported and the name of the
file for the device points to it within the system. Thus when you perform an operation
on such a device special file the device driver takes over.

There are .two kinds of special files, character and block special, which are associated
with character oriented devices and block oriented devices respectively. A tape is a
character oriented device while a hard disk can be both character or block oriented.
Thus you will find that both kinds of special files exist for your hard disk on the system,
but that there a k only character special files for any tape drives. Actually there are
also pipe special files but we will not consider them here.

The bridge between the physical device name (the filename) and the driver h r the
device is located in the /dev directory. Let us look at a long listing of this directo~y,

[root@1inuxr ~ o t ] #cd Idev

[root@linux root]# Is -1
total 228
crw- 1 root root 10, 10 Jan 30 2003 adbmouse
w-r-r- 1 root m t 10,175 Jan 30 2003 8gpgm-t

cw- 1 root root 10, 4 Jan 30 2003 amigamouse

crw- 1 root root 10, 7 Jan 30 2003 migamousel
~tw- ImllM root 10,134 Jan 30 2003 apm-bios
dm-rr-x 2 root mot 4096 May 16 2Q04 staraid
crw- 1 root root lo, 5 Jan 30 2Q03 aurimouse
CW- 1-root root 10, 3 Jan 30 2003 &bm
crw- 1 root root lo, 3 Jan 30 2003 atinousc
crw- 1 milind root 14, 4 Jan 30 2003 audb
crw- 1milind rocst 14, 20 Jan 30 2003 audiol
and many more piuch lines. Your listing mi@t look somewbat dlflerent in terms of the
devices and other fields bere. But let us look at some of the main features of this
Tbe first thing you must have potloed is that the flrst chwaoter of the permission
modes is PO longer a byphen (-), but is c or b. Tbis indicates whether the device file is
character or block special. The other pern,issiol~modes have their usual meanings,
except that you cannot execute a device no matter how disgusting its behaviour might
be! So execute permission has no significhlctt here.
Instcad of the file size, you find two numbers separated by a comma. These are
called the major and minor device numbers. A major number stands for a class of
device like a terminal or a mouse, while the minor number gives the number of that Unir System
kind of device. Thus different terminals might have minor device numbers 0 (for ttyo), Administration
1 (for tty 1) and so ,on.
An entry for a device can be added by the mknod command. Suppose your terminal
major device number is 4 and you have 32 entries in the Idev directory from 0 to 3 1.
You will not be able to activate another terminal even if the driver can support it unless
the device entry is made
[root@linux root] # cd /dev
[root@linux r o o t ] # /bin/mknod t t y 3 2 c 4 3 2
The arguments to the command are the device name by which it will be known, the
type (c for character and b for block) followed by the major and minor numbers. A
device entry can be removed as usual with the rm command.
The /devdirectory in Linux is itself organised into several directories like / d e v /
raw for the hard disk as a raw device, / d e v / i d a for the hard disk as a bloek device
and so on. This is for convenience because of the large number of devices that are
supported. You must remember that merely making a device entry is not enough. The
Linux kernel must have support for that device. If you purchase a new device like a
DVD-RQM it will come with a driver that you can install on your system. This will
put the device driver for your device in the kernel so that you are able to use the
device. The device entry is thus a link to the device driver for the device.
We will now look at hard disks and see how they are utilised in a Linux system. A file
system is the complete hierarchy of directories and files starting from its root. A small
device like a floppy diskette cannot hold many files but a large (80 GB) hard disk can
easily hold several file systems. It is common to partition a large physical hard disk
into several loeical disks, 04 ewh of which a file system can then be created. This Is
dons by the mkfs cemrnand. You have already seen about partitioning disks yvhile
installing Llnux on y ~ umaohlne.
When you create a file system on a partition, you should use up all the space in the
partition because otherwise the extra space is simply wasted. The device is named as
a character-device before the file system is made. When it has a file system on it, it is
used as a block device. Although you could still read a disk with a file system as a
character devlce, it would be very difficult for you to interpret the data stored on it
unless you know intimately the structure imposed by the file system. Creating a file
system is naturally done only in system maintenance mode.

What happens when a file system is created on a disk? The disk could previously be
accessed only as a character device, but now a structure is imposed on this. You can
now take advantage of the fact that you can access blocks on the disk randomly
without having to go through all the previous blocks. So you can now look at the disk
quickly. The file system structure consists of the boot block, the super block, the
inodes and the data blocks.

The zeroeth block of'eyery file system is reserved for storing booting information. It
does not have any significance as far as the file system itself is concerned. It is the
first block, called the super block, which contains information about the file system.
Q Q ~ ofQ these items are the size of the file system, its name, the number of blocks
kept apart for inodes, the list of inodes and the list of free blocks.

The index node or the inode blocks vary in number depending on the size of the file
system and can actually be specified by the user while creating the file system. This
number is the same as given in the super block. There is one inode for every file or
directory in the file system and it contains information about the file such as the
Linux Operating System number of links to the file, the permission modes and the block numbers occupied by
the file. The first 10 such numbers are called direct blocks because they directly hold
information about the data blocks. The eleventh number holds a block address and
that block holds the addresses of the actual blocks. There are more levels of
indirection available so that you can store very large files in your file system. You
cannot have more files and directories in the file system than the number of inodes.
The remaining blocks in the file system contain the actual data in the files.

When the computer is booted, these file systems are not immediately accessible to
users. This is because each file system has to be attached to the main file system. To
do this you have to use the mount command.

The first argument to the command is the device file associated with that file system.
The sed.ond argument is the name of a directory. The mount command associates the
logical device containing the file system with the directory. Now /mnt becomes the
root of the directory hierarchy on the device. So if you had a directory called khanz
on /dev/hda4,you can now access it as /mnt /khanz. The directory Imnt
should preferably be empty before you mount some file system onto it, because while
the file system is mounted you cannot access anything that was there on /mnt
previously. To break the link between the file system and the directory say .

[root@linux root]# /bin/umount /mnt

Now you can no longer get at the files in that file system. The various file systems are
usually mounted automatically when the system reaches the multiuser state through
commands in the / etc /rc shell script. If you issue the mount command by itself, it
will list all the file systems currently mounted and the directories to which they are
If somebody is working on a file system, it would be disastrous to unmount it because
the file systei would then become inconsistent when the device suddenly vanished.
That is why you cannot unmount a file system unless no user or program is accessing
$. he umount,command will tell you that the device is busy and will not fake any

In the booting process, a special root file system is mounted on the root directory (I).
The major system directories like bin, etc and dev are under this directory. Since
this file system is always in use, you cannot unmount or mount it yourself. All the
other file systems that you mount are below I in the hierarchy, as you know.
Sometimes / tmp is also mounted as a separate file system.
You have seen the intricate structure of the file system. This structure is subject to
disruption due to many reasons. For example a block on the free list might also appear
attached to a file, or a block might appear on neither. An inade might appear
duplicated or a file might seem to be under no directory. Such situations potentially
mean the loss of data. Fortunately the file system contains a fair amou~tof redundant
information, and this enables a program to check whether it is consistent. If it is not, it
is usually possible to repair the-damage. The Linux system comes with a program
called / sbin/ f sc k that performs a file system consistency check.
This program is run before mounting the various file systems because if the system is
inconsistent to begin with it will get worse as users work on it. The f s c k program
looks for file systems to check in a file called / e t c / f stab. Also, the fsck
command is actually a front end to file system specific consistency check programs.
The file system check is not done every time the system reboots and is performed only Unix System
if the system was shutdown abruptly leaving the file system in an inconsistent state.
However after a certain number of reboots the check is forced anyway. The e x t 3
file system that is the default in Linux allowsjournalling, which means that the check
. . ,does not depend on the size of the file System but only on the size of the journal.
Every file system should contain a directory called lost+f ound,and this should be
the first operation on it when the file system is made. Whenever f sck finds a file
that is not linked to any directory, it places it in this directory. The program works in
several phases and each phase performs some different check. You can set options to
it that put it in interactive mode, where it expects a user response before taking any
corrective action on a file system it is trying to repair.

Check Your Progress 2

1) Remove the device file for a terminal and see what happens. Also try renaming
the file and see the consequences.


2) Add a blank line to the beginning ofthe password file. What happens? What if
there is a blank line in the middle?


3) Try uinounting a file system when users are working on it. What happens and why?



At a large installation, users do not usually have their own backups and the system
administrator is responsible for the integrity of the system. On smaller installations and
certainly on your own personal computer, you will be responsible for your own data
and program files. So it is useful for every user to be able to backup data and know
how to restore it if needed. As a computer professional you do not need to be told
how important backups are.

There can be many different backup strategies and tools that you can use. We can
classify backups into full backups, incremental backups and differential backups. A
full backup is a complete backup of an installation or a part of its file system. If
there is a complete crash, you can restore user data from this. But the operating
system configuration files are also something that one produces over a period of
time and with considerable effort. So you can consider a backup scheme for them
as well. How often you should take backups depends on how much you are
prepared to lose.

A full backup is easy to restore from, but given the large disk capacities of today, the
amount of time taken to make a full backup can be non-trivial. So you can think of a
full backup at periqdic intervals with daily or more frequent incremental backups,
where only files that have changed since the last backup are copied. But it can be
difficult to locate a needed file in an incremental backup, so the concept of differential
backups was introduced. Here you backup all files that have changed since the last
t i n u x Operating System r'ull backup. So the amount of backing up required is in between that of a full backup
and an incremental backup.

It is important to consider what tne backup media should be as well. Very often it is a
tape of some kind, but a USB disk or a network backup to a data centre can also be
considered. You have to look at the reliability of a backup and make sure that you do
not use media beyond their useful life. A backup is pointless if you cannot restore
from it when you need to. So make sure to test your backups periodically. You cannot
afford a single failure in a backup. You can also consider taking ~nultiplebackups each

Depending on the criticality of your business, you might keep different copies ofyour
backup at different locations. But whatever your company characteristics, you have to
make sure you have at least one backup offsite that is geographically sufficiently
distant from your site.

There are several different kinds of backup tools. Some are sophisticated commercial
offerings while at the other end you have the basic Linux commands such as tar and
cpio. Both of them work quite well and you can decide what you will use.

The tar command allows you to take a backup of all or selected files in a directory
hierarchy onto tape, floppy disk or the hard disk itself. Tar knows about directories and
links, and maintains headers, checksums and file permissions and owners. To take a
backup of all files under /home/ khanz

[khanz@,linux khanz]$ tar cvbf 40/dev/rmt0/home/khanz

Let us look at the meanings of the various letters after the tar command. The c
stands for create, and it causes tar to create the backup. Remember that anything
previously present on the backup medium gets erased thereby (unless it is a file on the
hard disk). The v is the verbose option of tar, and makes it chatter about what it is
backing up. The b is the blocking factor and defaults to 20. You then specify the file
or backup medium where the backup is to be taken followed by the directories to
backup at the end. Everything under the directories you mention is backed up. You
can also specify individual files ifyou want to.

To look at the contents of a tar file,you can use the t option.

[khanz@I! khanz]$ tar tvf /dev/rmtO

For extracting, you use the x option. One thing you should be careful about is the use
of absolute pathnames during the backing up. When you restore from such a backup,
it will restore to that same pathname. So it might be better to use relative pathnames
while creating a backup archive as you have the liberty of placing it wherever you
want while restoring.

You can also use the z option to compress the archive, thereby saving a fair a m o u ~of
space. The extent ofthe saving will depend on the kind of files that are being backed

Another useful command for creating and restoring from archives is c p l o . It reads
the list of files from the standard output and copies them to wherever you specify. For
generating the list of filenames, you can use a program like find.
i~:lUuL,L,.II...Ar. Lh9n7!.$
I c p i o - o >/dev/rmtO
f i n d /hom~/khanz/

You can I!se the manv options ofthe find command to choose files that satisfy specitic
cnnditiois so that only those files are backed up.

Check Your Progress 3

You have backed up a directory containing several files onto 12 floppies using tar.
When you try to restore these after a crash, the 4th floppy is found to be
Unix System

! corrupted. How much data do you lose?

I 2) Why is it useful to take differential backups?

It This has again been a long unit wherein we have tried to cover a lot of ground in a very
small amount of space. You saw what the responsibilities of a system administrator
were and how the exact cornposition of such a group depends on the organization
characteristics. The major topic of this chapter was Linux installation and you saw
how to perform a simple Linux installati011on a machine. You also were introduced to
I file systems and how the system was booted, with sonle idea of run levels. As a
system administrator, you would need to maintain user accounts and you saw how to
add, delete or change user account information inclucling their passwords. Finally Re
briefly looked at the important topic of taking backups and restoring l i o ~ nthern using
the t a r command.
This block would now have given you a fair idea of the Linux operating system and its
capabilities. It sllould have prepared you to read up the large alnount ofdocumentation
available on the subject and to explore the various resources devoted to Linux on the

Cheek Yo~irProgress 1
1 1) Try yourself
, 2) Try yol~rself

1 Check Your Progress 2
1) Try yourself

2) Tryyourself

3) Try yoi~rself

Check Your Progress 3

I) You will lose data from the 4thfloppy onwards.

2) These allow us to save space that would be hasted by taking a complete backup
every time. At the same Lillie you do not have to puzzle over which incremental
backup has a copy of the files you want to restore.
Linux Operating System
There are a host of resources available for further reading on the subject of Red Hat
Linux version 9.0.
1) http:Nwww.redhat.comldocslmanualsllinux
2) l1ttp:1lwww.linux.orggives among other information, a list of good books on Red
Hat Linux. I

3) Considerjoining a good linux mailing list.

Windows 2000

Structure Page Nos.

1.0 Introduction 5
1.1 Objectives 5
1.2 Windows 2000 Operating System Architecture 6
1.2.1 Peer-To-Peer Network
1.2.2 Domains
1.2.3 Network Protocols
1.2.4 File Services
1.2.5 Shared Folders
1.2.6 Distributed File System
1.2.7 Print Services
1.3 Using the Mapped Drive 14
1.3.1 Printing a Mapped Drive
1.3.2 Disconnecting a Mapped Drive
1.3.3 Viewing Directory Information
1.3.4 Creating a Shared Folder
1.3.5 Logging off a Client
1.4 A Few Important Facts About Windows 2000 Usages 16
1.5 Summary 17
1.6 Solutions/ Answers 18
1.7 Further Readings 18

Windows 2000 is a network operating system with built-in support for peer-to-
peer and client-server networking. The focus of a network operating system
(NOS) is on use of remote services and resources existing in a networked
computer system. In distributed operating system, the focus is on effective
utilisation of resources in distributed computing environment.
Windows 2000 consists of 4 separate products.

• Windows 2000 Professional

• Windows 2000 Server
• Windows 2000 Advanced Server
• Windows 2000 Data Center Server
Following is a list of features for Windows 2000 network support:

• It has an integrated support for network protocol like TCP/IP and IPX/SPX.
• It supports dial up networking (that facilitates mobile users to connect to a
computer that is running on Windows 2000 platform).
• Windows 2000 server incorporates Microsoft’s Internet Information Server
(IIS) that is a secure web server to host Internet.
• It supports a set of security features which were not there in earlier versions of
In this unit we will explore the issues related to networking support in Windows 2000-
operating system.

After going through this unit you should be able to:

• describe Windows 2000 operating system architecture;

• describe peer-to-peer networking support in Windows 2000;
• describe Windows 2000 domains;
Windows 2000 • identify protocols supported by Windows 2000;
• distinguish between FAT16 and FAT 32 file systems;
• how to share folders in Windows 2000;
• describe Distributed File System, and
• describe support of network printing in Windows 2000 environment.


CISC (Complex Instruction Set Computer) is a computer with a large number of
instructions (complex) and constructs. Most of the NOS are based on CISC whereas
early 80s designers recommended RISC (Reduced Instruction Set Computers) with
simple instructions.
Windows 2000 is a portable operating system that is meant for CISC based machines
(Complex Instruction Set Computing). CISC is a processor technology which is
represented by a large set of instructions with variable formats. Major processor
families used in the design of modern computer system are RISC, superscalar VLIW
(Very Large Instruction Word), superpipelined, vector and symbolic processors.
Windows 2000 is always pre-emptive, which means that the high priority process gets
executed first then compared to the low priority process. A complete Windows
architecture is given in Figure 1.

Windows 2000 system is made of layers: It works in two modes:

• User Mode
• Kernel Mode.

User Mode is responsible for providing insulation of end users from kernel mode.
Windows 2000 user mode API subsystems are responsible for execution for different
supporting system applications like win32 and POSIX. These subsystems have their
own API’s (Application Programming Interface) System data and hardware is
accessible to kernel mode layer of Windows2000. Operating system itself runs in the
kernel mode. Environment subsystems run in user mode. The lowest two layers
nearest to the hardware use the kernel and Hardware Abstraction Layer (HAL) that is
written in C and assembly language. Upper layers are written in C and are machine
independent layers. Most of the drivers in Windows2000 are written in C or C++.

Figure 1: Windows 2000 layered architecture

HAL (Hardware Abstractor Layer) Windows 2000
The aim of HAL is to present the rest of the Operating System with an abstract view
of hardware devices. It isolates the OS from platform specific H/W differences. The
HAL makes each components such as bus system. DMA controller, computer,
interrupt controller, system timer & memory module look the same to the kernel.
The aim of the kernel is to make the rest of the Operating System machine
independent, hiding all the low-level details. Accessing the hardware using HAL
Kernel is responsible for generating higher-level abstractions.

Kernel also includes the code for thread scheduling. It also provides low-level
support to two internal objects – control objects and dispatcher objects. The shaded
area is the executive. The entire executive area is written in C language and is
architecturally independent and can be easily ported to machine.

It consists of the following objects:

• Object Manager
• I/O Manager
• Process Manager
• Memory Manager
• Security Manager
• Cache Manager
• Windows/graphics manager
• Local Procedure Call Manager.

1. Object Manager: Creates, manages, and deletes W2K Executive objects and
abstract data types that are used to represent resources such as processes,
threads, and synchronisation objects. It enforces uniform rules for retaining,
naming, and setting the security of objects. The object manager also creates
object handles, which consist of access control information and a pointer to the
object. W2K objects are discussed later in this section.
2. I/O Manager: Provides a framework through which I/O devices are accessible
to applications, and is responsible for dispatching to the appropriate device
drivers for further processing. The I/O manager implements all the W2K I/O
APIs and enforces security and naming for devices and file systems (using the
object manager).
3. Process Manager: Creates and deletes objects and tracks process and thread

4. Memory Manager: Maps virtual addresses in the process’s address space to

physical pages in the computer’s memory.

5. Security Manager: Enforces access-validation and audit-generation rules. The

W2K object-oriented model allows for a consistent and uniform view of
security, right down to the fundamental entities that make up the Executive.
Thus, W2K uses the same routines for access validation and for audit checks for
all protected objects, including files, processes, address spaces and I/O devices.
6. Cache Manager: Improves the performance of file-based I/O by causing
recently referenced disk data to reside in main memory for quick access, and by
deferring disk writes by holding the updates in memory for a short time before
sending them to the disk.

7. Windows/graphic manager: Creates window oriented screen interface and

manages the graphic device.
Windows 2000 8. Local Procedure Call Manager: Enforces a client/server relationship within a
subsystem in a manner similar to remote procedure call facility used for
distributed application.

Minimum hardware requirements for Windows 2000 are 32-bit Pentium 133 MHz
processor, 128 MB RAM, 500 MB or more of disk space to set up Windows 2000.

1.2.1 Peer-To-Peer Network

MS Windows 2000 is an ideal Operating System for peer-to-peer networking. In a
peer-to-peer network, computers work independently, providing various services like:

• Each computer can have its own separate user accounts.

• Sharing of resources (folders, printers etc.) is possible.
• Each computer is responsible for managing its security.
• Easy set up for the network.

On a peer-to-peer network, workstations communicate with one another

through their own operating systems. Files, folders, printers, and the contents
of entire disk drives can be made available on one computer for others to

Here is a simple peer-to-peer network (Figure 2)

Figure 2: Peer-to-peer Network

1.2.2 Domains
A domain is a collection of accounts representing network computer uses, and group
of users all maintained in a control security database for care of administration.

In Windows 2000, domain is a collection of computers where a server computer

referred to as a Domain controller is responsible for the management of security for
the entire network. This type of logical grouping is desirable for corporate application.
Computers of a domain network have local user accounts, but are dependent on a
centralised information store called as Active Directory Service. Thus Active
Directory in Windows 2000 provides a centralised control.

Domains add several interesting features to Windows 2000 functionality.

• Centralised storage of user information.
• Each domain has domain controller associated with it. In Windows NT, domain
controllers are either BDC or primary domain controller. In Windows 2000 there
is only one type of domain controller.
• Extension of the existing network becomes easy.
• In Windows 2000 Active Directory unites namespace of internet with window Windows 2000
NT directory services since Windows 2000 domain naming uses DNS (Domain
Name System).

What is DNS, conceptually, the internet is divided into several domains (e.g., gov,
edu, com, net, etc.), where each domain covers many hosts. Each domain is
partitioned into several domains and these are further partitioned. The essence of
DNS is the invention of a hierarchical, domain-based naming scheme and a distributed
database system for implementing the naming scheme. It is primarily used for
mapping host names and e-mail destinations to IP addresses.

While creating a Windows 2000 domain, the DNS should be executing and properly
configured on the corresponding machine. If in case, DNS is not running, on creation
of a domain controller, it is automatically installed later. Thus domain provides
Windows 2000 with a grouping mechanism where not only accounts but also network
resources are grouped under a single domain name.
Joining a Domain
Windows 2000 has “Join A Computer To The Domain” permission for those
computers that wish to be a part of Domain. By obtaining this permission, an account
is created for that computer. It is like a class of objects, where all the objects of that
class are of the same type. The objects type may vary from users to computers. Active
Directory Service provides a hierarchy to various resources stored in domain. A
Domain has information about the objects it contains. It provides the network with a
secure boundary.

1.2.3 Network Protocols

Protocol refers to a set of rules that facilitate communication across a network. A
network application does not directly interact with the underlying network hardware;
rather it interacts with protocol software that follows the rules of a protocol.

Windows 2000 include support for following different protocols through various
3. Net BIOS Enhanced user Interface (NETBEUI)
4. Data link control (DLC)
5. ATM (Asynchronous Transfer Mode)
6. AppleTalk
7. Infrared Data Association (IrDA).

Default protocol in Windows 2000 is TCP/IP. Since TCP/IP is the universal protocol
of the Internet, thus enabling access to Internet resources. TCP/IP facilitates
communication over a network that is otherwise a collection of computers with
different architecture and operating systems. Two commonly used Windows 2000
troubleshooting utilities for TCP/IP are Ping and IpConfig.

The advantages of TCP/IP are:

• Designed for routing. (IP) and end-to-end data delivery (TCP)

• Is the most used protocol of Internet.
• Compatible with standard networking tools.
• Facilitates communication among diverse networks and network
operating systems.
• Enables the use of DHCP and WINS.
• Compatible with Microsoft Windows Sockets.

Windows 2000 ATM is a protocol that is able to provide voice, data and video services across
wide area networks.

NWLink is MS equivalent of Novell Netware.

IPX / SPX (Internet packet exchange / sequenced packet exchange)

Only TCP/IP is accessible to Windows 2000 networking running Active Directory

Services, not NWlink or NetBEUI.

NetBEUI is a kind of legacy protocol that is used to provide accessibility with existing
network (small network) that is already using NT.

Appletalk: Apple Computer Corporation developed this protocol suite and is included
in Windows 2000 so as to provide compatibility with Apple Machinist clients. In
addition because of Appletalk Windows 2000 can function as a router and a dial up

DLC (Data Link Control) protocol originally developed for IBM mainframes is
required for printers and other peripheral devices installed on a network.

Ir DA is a collection of bi-directional wireless infrared based protocols (that spans a

short range). It facilitates communication among multiple device types like camera,
printers and PCs.
IP Addressing
The IP address format is called the dotted decimal notation address.
It is 32 bits long and contains four fields, consisting of decimal values
representing 8-bit binary octets. For example, an IP address might be

A unicast transmission is one in which one packet is sent from a server to

each client that requests a file or an application.

A multicast means that the server is able to treat all the clients as a group and
send one packet per transmission that reaches all the clients. It saves the
bandwidth of a channel.

A subnet mask is used to divide a network into subnetworks to meet

addressing requirements with limited availability of address.
Static and Dynamic Addressing
Each server and workstation needs a unique IP address, either specified at the
computer or obtained from a server that assigns temporary IP addresses.

Static addressing involves assigning a dotted decimal address that is each

workstation’s permanent, unique IP address.

Dynamic addressing automatically assigns an IP address to a computer each

time it is logged on.

Dynamic addressing method uses the Dynamic Host Configuration Protocol

(DHCP), which is supported by Windows 2000 Server for dynamic addressing. It
provides an enhancement to TCP/IP. DHCP in addition to permanent addresses
assigned to computers that run a server it automatically allocates an address. Yet a
DHCP does not assign an address permanently, rather it specifies a lease for the
address use.

In Windows 2000, configuring TCP/IP using DHCP has many advantages. On Windows 2000
Windows 2000 servers that provide Internet communication, when one is configured
as a DHCP server, Windows Internet Naming Service (WINS) is also installed so
that the Windows 2000 Server is both a DHCP and a WINS server.

Domain Name System provides automated mapping between computer names and IP
address. Conversion of a domain name into an equivalent IP address is referred to as
name resolution, and domain name is said to be resolved to an address.

 Check Your Progress 1

1) What is the purpose of a directory service in Windows 2000?
2) In what mode does the console run?
3) How does a domain differ from a workgroup?

1.2.4 File Services

Windows 2000 provides read and write support for NTFS, FAT 16 and FAT 32 file
systems. FAT is designed for small disks and simple folder structure. Windows 2000
supports both FAT 16 and FAT 32 file system and FAT is designed for small disks
and simple folder structure.

A FAT 16 partition is divided into 512 byte sectors and disks have files in dusters in
the default cluster size dependent on partition size and can range from 8 sectors to 128
sectors. FAT 32 can support partition up to 2047 GB in size. The major advantage of
FAT 32 over FAT 16 is larger partition sizes.

NTFS (NT File System)

Windows2000 supports a new version of NIFS, i.e., NTFS version 5.0.
This new version of NTFS is better than in terms of reliability and better performance.

NTFS 5.0 includes the following features:

• All of the new features of Windows 2000 Active Directory Services.

• Storage features like reparse points.
• Features for Software Management.
• Enhanced security features for servers, which provides an authentication
mechanism to users before they can actually gain access to network resources.
• It supports CDfs;

The fundamental unit of disk allocation in NTFS is cluster that comprises multiple
Disk Storage Types:
In Windows 2000 two kinds of disk storage are possible:
Windows 2000 • Basic storage
• Dynamic storage.

Disk should be initialised with a storage type before data could be stored on it. Either
of the two storage types can be used on one disk. But in a system with multiple disks
both storage types can be used. Basic disk storage is the default storage type for
Windows 2000. All disks are basic until converted to dynamic. Disks can be managed
on local and remote networks. Only Windows 2000 has support for Dynamic storage,
which can be resized unlike basic storage type.

Basic disk is divided into partitions. Disk partition can be primary or extended and
they function as disks in their own entirety.

Dynamic disk is divided into volumes. Volumes can be simple, spanned, mirrored,
striped or RAID-5. Only computers running Windows 2000 can access dynamic disks.
File Replication Service (FRS)
Another file service feature supported by Windows 2000 is File Replication Service
(FRS). It is so configured that it automatically starts on all domain controllers and
manually on all standalone sectors. Its automatic file replication service is responsible
for the copying and maintenance of files across network.

Two kinds of replications are possible:

• Intrasite Replication
• Intersite Replication.
Sites are subnets comprising well-connected computers. Any portion of the network,
subnet, is a site.

1.2.5 Shared Folders

The mechanism by which resources across a network are accessible is referred to as
sharing. Only those users who have been granted access to the shared folders can use
files of a shared folder. By default any user who logs on to a computer has access to
the shared folders on that computer.

A shared folder data may range from personal to corporate data. A shared folder
Permissions may vary depending upon the kind of data a folder contains read, change,
and full control permissions.
Shared folders permissions exhibit the following features:
• They provide a security boundary not detailed security, since shared folders
permissions hold true for the entire folder and not to individual files.
• On a FAT system it is the only way to secure network.
• Full control is the default permission for a shared folder.

Permissions for a shared folder may be granted or denied to users or to groups. Also
if a user is denied permission for a shared folder then even if s/he is member of a
group that is granted shared access permissions for the folder, s/he cannot access the
Sharing a folder:
When a folder is shared it can be given a share name, comments can be added to it for
the description of the contents of the folder etc.

1.2.6 Distributed File System Windows 2000
Another Windows 2000 file service is Distributed File System;
It is an efficient and easy way to access shared folders across the network;
Files are arranged in a hierarchy in DFs. It is a logical tree structure, comprising DFs
root and DFs links. In DFs resources from various locations, servers are shared in DFs
Features of Windows 2000 DFs:

• Facilitates network administration

• Simplifies network navigation
• Provides a hierarchical logical organisation for shared folders across different
computers on a network.
Two types of DFs roots can be implemented on Windows 2000 Servers:

• Standalone DFs roots

• Domain DFs roots.

In standalone DFs roots, DFs is stored on a single computer. It has no support for
fault tolerance in case the computer that stores the DFs topology fails. Domain DFs
root writes the DFs topology to Active Directory. It supports file duplication in case
of failure. Here DFs links point to multiple copies of the same shared folder. When
changes are made to a DFs link that is a part of a domain DFs root, the changes are
automatically reflected to other members also.

1.2.7 Print Services

Windows 2000 has support for networking printing. Thus, it facilitates printing from
any computer in the network. Also printer can be managed from any computer by
having just a web browser installed on that computer. Using Windows 2000 various
components with different Operating Systems/platforms can send jobs for printing.

For network printing basic requirements are:

• Sufficient memory (RAM)

• Sufficient disk space
• A server computer.
Remote network printing, non-remote local printing and non-remote network printing
is supported by Windows 2000 networking printing. TCP/IP is the default network
protocol for Windows 2000 in use by many network-printing devices. Printers on a
network can be shared if printing jobs are more on the network that an unshared
printer is unable to handle.
In order to share an unshared printer on a network
In the Printers Windows.
1. Click the properties dialog box and then click on sharing tab.
This sharing tab acts as an interface for sharing a printer, on the network.
Managing Printing Jobs
Windows 2000 facilitates job management that primarily involves restarting,
resuming, pausing and cancelling printing jobs if a problem arises while printing.
Another interesting feature in Windows 2000 is that the user manages print job by
setting printing priorities and printing time, provided the user has been granted
manage Documents permission for the desired printer.

Windows 2000 In a network Windows 2000 facilitates managing network printers even with Web
browsers. Thus eliminating the need for having installed Windows 2000 on every
Role of a Printer Driver
In a network some computers cannot access the printer installed over the network.
This is due to the fact that printer may by attached to a computer that is not having
Windows 2000 installed on it.

Since Windows 2000 has all the required printer drivers installed within it and printer
drivers are responsible for the creation of special printer file that carries requisite
information the printer needs. Windows 2000 always keep the drivers up-to-date.

 Check Your Progress 2

1) In a multi-user environment while printing, how can the possibility of a user
ending up with a wrong document be avoided?
2) Can a single document be redirected on a network?
3) When do DCHP clients try to renew their leases?
4) Can moving and copying files and folders between disk volumes change their
compression state?
5) What type of data is replicated by FRS?
6) What is the default permission when a partition is formulated with NIFS?


Windows 2000 allows the user to assign a drive letter to a share network resource that
may be a printer, folder or a drive using the mapped drive. A file server or
workstation shares a mapped folder or drive on the network.

• By default, Windows attempts to reconnect any mapped drives the next time user Windows 2000
logs on. If you do not want this to happen, click to clear the Reconnect at Logon
check box.
• By default, you are connected to the other computer with the logon details that
you are currently using. If you want to use other credentials, click Connect using
a different user name, and then type the appropriate user name and password to
connect to this network resource.
• The mapped drive that we create is visible in the Folders, in Windows Explorer,
along with all the other drives on our computer. Files in the shared folder can be
accessed with any program on our computer by using the mapped drive letter.

To assign (map) a drive letter to a network computer or folder

1. Click Start, point to Programs, and then click Windows Explorer.
2. On the Tools menu, click Map Network Drive.
3. In Path, type the path to the resource you want. For example:
If a password is required, Windows prompts you.

• You can also right-click My Computer or Network Neighbourhood, and then
click Map Network Drive.
• To map to a computer or folder you have used recently, click the arrow to the
right of Path, and then click the resource you want.

1.3.1 Printing a Mapped Drive

Once the letter has been assigned to a drive, after selecting a file from the drive, pull
down the File menu, choose the Print option. Also by right click any document icon
and choose Print.

1.3.2 Disconnecting a Mapped Drive

To disconnect a mapped drive
Click Start, point to Programs, and then click Windows Explorer.
1. On the Tools menu, click Disconnect Network Drive.
2. In Drive, click the resource that you want to remove, and then click OK.

• You can also right-click My Computer or Network Neighbourhood, and then
click Disconnect Network Drive.

1.3.3 Viewing Directory Information

From the My Computer window,
1. In order to view the contents of a drive double click on a drive icon.
2. Then select a folder within that drive and double click on it and keep moving
down till the desired folder is found.

1.3.4 Creating a shared folder

To specify a path
1. Type the drive letter followed by a colon (:) and back slash (\). See the
examples in Note.

Windows 2000 2. Type the names of the folders and subfolders that contain the file, typing