Nothing Special   »   [go: up one dir, main page]

Operating System Cit333

Download as pdf or txt
Download as pdf or txt
You are on page 1of 124

Operating System (CIT – 333)

&
Linux/Unix Administration

DAE Computer Information Technology

Prepared by: Nauman sabir

Checked by: Sir Fiaz Nawaz(HOD IT) &

Mam Zunaira Sajjad

Please visit for more notes


https://dae-note.blogspot.com/

1
Abstract
I write or compile a Operating system book for students of 3rd year of RPI.

I try my best to give my effort for this Book. Error or mistake may be occurs during
study.

In next page the course content of PBTE of OS is given. But when u read the book
according to chapter may be you look at some different content so don’t worry
about this. It is same as board but I write in my own style and own method.

2
Course Content of OS according to PBTE LAHORE
DAE IN CIT

CIT 333 – OS

Learning Objects

1) Computer System Structure


1.1 Describe the general operation of computer
1.2 Describe Interrupts
1.3 Identify different I/O devices
1.4 Describe the Structure of I/O system
1.5 Describe different Storage device
1.6 Explain the Hierarchy of Storage device
1.7 Identify the protection issues encountered in a computer System
1.8 Describe Protection methods of computer Operation

2) Operating system Structure


2.1 List the Function of an Operating System
2.2 Describe Function of an Operating System
2.3 Explain How Operating System Manage the resources of computer
2.4 Enumerate OS Services and explain the Service
2.5 Define System calls
2.6 Identify System Programs that come with the Operating System
2.7 Describe the function of these System Programs
2.8 General Structure and Architecture of an Operating System
2.9 Illustrate the Structure and Architecture of Operating System
2.10 Discuss the Design Goal of Operating system

3) Unix/Linux Implementation
3.1 Describe the development of UNIX/LINUX Development
3.2 Explain the Design principle of UNIX/LINUX
3.3 Log in and Log out in system
3.4 Configure user own environment
3.5 Change and manage own password

3
3.6 Use Unix/Linux Help System(manual system)
3.7 Characterize Unix/Linux File System and its organization
3.8 Name correctly File and Directory

3.9 Creating and deleting File and Directory


3.10 Set the permission on File and Directory

4) Unix/Linux Basic Commands


4.1 Invoke Correctly Unix/Linux Command used in user and user-determination and file
search
4.2 Invoke Correctly Unix/Linux Command used in administration of own environment and
Process related job Command
4.3 Used Correctly Unix/Linux Command to Manipulates file and directories
4.4 Used Correctly Unix/Linux Command to Search and view at Content of File
4.5 Print File using Linux/Unix Commands
4.6 Used Correctly Unix/Linux Scheduling Command
4.7 Invoke Correctly Text Processing Commands
4.8 Used Correctly Unix/Linux Storage and Status Commands
4.9 Use other miscellaneous commands available to Unix/Linux 5 Text Processing
5.1 Invoke VI editor

5.2 Compose Text using VI editor

5.3 Describe Different Modes of vi editor 6 Unix/Linux Shell


6.1 Define UNIX Linux shell

6.2 Explain the Function of Shell

6.3 Describe bourn shell or Unix/Linux

6.4 Use bourn shell in Unix/Linux

7 System Administrations
7.1. SYSTEM ADMINSTRATION TASKS.
7.2. UNIX/LINUX INSTALLATION BASICS.
7.3. RESOURCE AND USER ADMINSTRATION.

4
7.4. KERNEL BASICS AND CONFIGURATION.
7.5. SYSTEM ACCOUNTING AND PERFOMINANCE MONITORING.
7.6. DEVICE AND MAIL ADMINSTRATION. 7.7. UUCP AND
FTP SERVICES ADMINSTRATION.
7.8. BACKING UP AND RESTORING THE SYSTEM.
7.9. FILE SYSTEM AND DISK ADMINSTRATION.

Index

Part # A. Basic Concept of Operating system…………………………….……………………………………………………...7-10


1) Software…….……………………………………………………………………………….………………………………………………….…07
2) Hierarchy and types of software………………..…………………………………..………………………………………………….07
3) Windows, DOS and Linux…………………………………………………………………….………………………………….………...10
1. Computer System Structures..........................................................................................................11-29
1.1 Define and Describe Operating System…………………………………………………………………………………..………11
1.2 List and Types of Operating
System………………………………………………………………………………..........……….14
1.3 Describe the general operation of computer……………………………………………….………………………………….20
1.4 Describe Interrupts………………………………………………………………………………………………….……………………..21
1.5 I/O devices………………………………………………………..…………………………….……………………………………………..23
1.6 Structure of I/O system…………………………………………………………………….…………………………………………….23
1.7 Storage device………………………………………………………………………………….………………………….…………………24
1.8 Hierarchy of Storage
device………………………………………………………………...………………………………………….25 1.9 Hard ware
Protection and methods…………………………………………………….………………………………………….26
1.10 Buffering and spolling……………………………………………………………...……………………………………………………28
2. Operating System Structures……………….……………………………………………………………………………………30-64
2.1 List the Function of Operating
System…………………………………………………………………………………….……….30
2.2 Describe Function of Operating
System…………………………………………………………….…………………………….30 2.3 Managing computer
resources OR component of OS………………………………………………………………………32
2.4 Explain OS Services………………………………………………………………….……………………………………………….…….53
2.5 System calls ……………………………………………………………………………………………………………………….…………..55
2.6 System Programs……………………………………………………………………………….………………………………….….......57
2.7 General Structure and Architecture of Operating System……………………………………………………….………58
2.8 Design Goal of Operating
System……………………………………………………………………………………………………64 Part # B. DOS,
Commands and Directory…………………………………………………………………………………………65-69

5
3. Unix/Linux Implementation……………………………………………………………………………………………………….70-86
3.1 Describe UNIX/LINUX
Development………………………………………………………………………………………………...70
3.2 Design principle of
UNIX/LINUX………………………………………………………………………………………………….......72
3.3 Log in and Log out in
system……………………………………………………………………………………………………………73
3.4 Configure user own environment…………………………………………………………………..
………………………………..74
3.5 Change and manage
password…………………………………………………………………………………………………….....74
3.6 Unix/Linux Help
System……………………………………………………………………………………………………………………75
3.7 Unix/Linux File
System……………………………………………………………………………………………………………………..75
3.8 Directory structure, Name and File
sys……………………………………………………………………………………….......76
3.9 Creating and deleting File and
Directory…………………………………………………………………………………….......79
3.10 Set permission on File and Directory………………………………………………………………………………………………82
4. Unix/Linux Command…………………………………………………………………………………………………………………87-96

5. Text Processing…………………………………………………………………………………………………………………...97-102

5.1 Invoke Vi editor…………………………………………………………………………………………………………………………97

5.2 Compose Text using vi……………………………………………………………………………………………………………….97


5.3 Modes of vi
editor…………………………………………………………………………………………………………………..102

6. Unix/Linux Shells……………………………………………………………………………………………………………….103-107

6.1 Define Unix Linux shell……………………………………………..………………………………………………………………103

6.2 Explain the Function of Shell……………………………………..……………………………………………………………..104

6.3 Describe bourn shell………………………………………………..……………………………………………………………….105

6.4 Use bourn shell in Unix/Linux……………………………………………………………………………………………………107

7. System Administration……………………………………………………………………………………………………………….108

Past paper………………………………………………………………………………………………………………………………………110

6
Part#A
Basic Concept of Operating system
This chapter is not including in your course content but this is very important for learning
Operating system.

So don’t ignore this. Here only some terminology and some definition

Topic you learn

1) Software
2) Hierarchy and types of software
3) Windows ,DOS and Linux

1) Software

A set of instruction given to the computer to perform a specific task or solve a problem called
software or program. OR

Software is the combination of instructions to perform the specific task. Soft ware is also called
program.
2) Hierarchy and types of software

Fig 0.1

7
2.1) Software

A set of instruction given to the computer to perform a specific task or solve a problem called
software or program. OR

Software is the combination of instructions to perform the specific task.

Software divided into two categories: according to Fig 0.1

• System software
• Application software

2.1.1 System software

System software is computer software designed to operate and control the computer hardware
and to provide a plate form for running application software.

Operating systems, utility programs, and device drivers are the examples of system software.
Operating system is the main and most popular type of system software. according to Fig 0.1

• Operating system

An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs. It enables the computer
hardware to communicate and operate. DOS and Windows example of OS.

• Utility programs

A program that performs a specific task related to the management of computer function,
resources, or file, password protection and virus protection.

Utility program help manage, maintain and control computer resources.

Example: File manager, image viewer, Diagnostic utility, PC maintenance utility, Antivirus, Disk
cleanup and Firewall etc…

Device Driver

A device Driver is a computer program that operates or controls a particular type of device that
is attached to a computer like printers

2.2.1 Language Translators whatever language or type of language we use to write our
programs, they need to be in machine code in order to be executed by the computer. There are
3 main categories of translator used, according to Fig 0.1

• Compiler The language translator program that translates the complete source
program into machine code as a whole is called compiler. The C and C++ compilers are
best examples are compilers.

8
• Interpreter The language translator program that translates the source code into machine
code statement by statement is called interpreter.
• Assembler The language translator program that translates the program written in
assembly language into machine code is called Assembler.
2.3Library Programs
Library programs are compiled libraries of commonly-used routines. On a Windows system they
usually carry the file extension dll and are often referred to as run-time libraries. The libraries
are run-time because they are called upon by running programs when they are needed. When
you program using a run-time library, you typically add a reference to it either in your code or
through the IDE in which you are programming.
Using library programs saves time when programming. It also allows the programmer to
interact with proprietary software without having access to its source code.

Application software
An Application software or group of program that is designed for end user. It is used to perform
various applications on computer, also known as application package.
Ms Word, Access Photoshop is the example of Application software.
• General-Purpose Software
Software is general-purpose if it can be used for lots of different tasks. You can use a word
processor to write letters, memos, essays, instructions, notes, faxes, invoices and lots more.
These days we tend to use integrate suites of office software where a range of general-purpose
software is provided, usually with the facility to combine elements from each application in a
single file.
• Special-Purpose Software
This software performs a single specific task. This task might be complex like payroll calculation,
stock control etc. but will be based on a single task.
• Bespoke Software
Bespoke software is written for a single client. Large organizations have a need for welldeveloped
applications suited to their specific needs. Such software is often expensive to develop since the
development costs are not shared among a large number of people purchasing the software. It
is also known as custom software.
PackagedSoftware
The software that is developed for sale to the general public is called packaged software.
Packaged software is used to solve some common problem of many people or users

9
3) Windows, DOS and Linux

Difference between MS-DOS and Windows Operating System

DOS Windows
Windows provide the graphic
DOS (Disk Operating System) interface to the user for
Definition are simple text command interacting with hardware and
based operating systems. executing their application
programs.
Windows uses graphics,
DOS provide the command images and text to provide the
GUI
based interface to the user. interface to the user to
interact with the machine.
Commands are used as only Uses various input devices for
Input System way for the user to give input this purpose such as mouse,
to the machine. touch screen.
Not available, DOS can
Windows allow multiple task
Multitasking execute a single task at a time.
to be operated at same time.

Require very less computer


Booting More demanding.
resources.
Provide security from various
Security Provide no security
external threats ( like virus ).
Price DOS is free Windows is costly
Very less user- friendly as user Very much user friendly
User-friendly have to learn the commands provide very easy way to
for using the DOS. interact with the machine.

10
Chapter#1

Computer System Structures


Topic to Learn
1.1 Define and Describe Operating System 1.6 Structure of I/O system
1.2 List and Types of Operating System 1.7 Storage device
1.3 Describe the general operation of computer 1.8 Hierarchy of Storage device
1.4 Describe Interrupts 1.9 Hard ware Protection and methods
1.5 I/O devices 1.10) Buffering and spolling

1.1) what is Operating system? Describe them?

An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs. It enables the computer
hardware to communicate and operate. OR

Operating system is a computer software and interface between hardware and user, it enables
the computer hardware to communicate and operate

DOS, Windows, UNIX, Linux and Mac are today’s core operating systems; they all run from big
systems to Smart phone &handheld devices to ease human work.

11
Fig 1.1

1.1.1) Computer System Structure

Computer system can be divided into four components: show in fig 1.2

• Hardware _ Hardware component provides basic computing resources like CPU,


memory, I/O devices
• Operating system_ Controls and coordinates use of hardware among various
applications and users
• Application programs _ define the ways in which the system resources are used to solve
the computing problems of the users
Word processors, compilers, web browsers, database systems, video games
• Users _ People, machines, other computers

Four Components of a Computer System

Fig 1.2

1.1.2) Some important point about OS

OS is a resource allocator

Manages all resources

Decides between conflicting requests for efficient and fair resource use

OS is a control program

12
Controls execution of programs to prevent errors and improper use of the
computer

1.1.3) Computer Organization and Architecture

In short, computer organization mainly deals with how a particular hardware works in a
computer where as computer architecture deals with how to design a circuit for such
hardware.
Let me give you an Example. Assume that I bought a car. I know how to drive it. It is enough to
learn how to start it, how to shift gears and how to apply brakes etc. to drive a car, you do not
need to learn how to repair if anything fails. Knowing how to drive a car is nothing but computer
organization.
If I have to repair my car then I should drive it to a mechanic because he would knows how it
was manufactured and how to repair it. This is computer architecture.
If you know both driving and repairing then you know both organization and architecture.

Difference between Computer Organization and Architecture


Computer Organization:

• Computer Organization encompasses all the physical aspects of computer system.


• Computer organization will answer you how does a computer work.
• Example: circuit design, control signals, memory types this all are under computer organization.
Computer architecture:

• The visual interface of computer.


• Logical terms as seen by the programmer.
• Computer architecture will answer you how do I design a computer.

13
Example: instruction sets, instruction formats, data types, addressing modes
1.1.4) OS Environment

Operating systems are designed to meet multiple applications in various environments.

OS nature can be Stand-alone, Multiple Users, Multitasking or Real Time Operating System.

1.2) Operating system Types

1.2.1) Batch operating system

The users of batch operating system do not interact with the computer directly. Each user
prepares his job on an off-line device like punch cards and submits it to the computer operator.
To speed up processing, jobs with similar needs are batched together and run as a group. Thus,
the programmers left their programs with the operator. The operator then sorts programs into
batches with similar requirements. Show in Fig 1.3 and 1.4

The problems with Batch Systems are following.

• Lack of interaction between the user and job.

• CPU is often idle, because the speeds of the mechanical I/O devices are slower than CPU.

• Difficult to provide the desired priority.

Two basic diagrams are Batch OS.

Figure 1.3 Figure 1.4

Memory Layout of simple Batch OS.

14
Fig 1.5 Memory layout

1.2.2) Multiprogramming Operating System

In a multiprogramming system there are one or more programs loaded in main memory which
are ready to execute. . Only one program at a time is able to get the CPU for executing its
instructions (i.e., there is at most one process running on the system) while all the others are
waiting their turn.
The main idea of multiprogramming is to maximize the use of CPU time. Show in Fig 1.6

Fig 1.6
Detail

To overcome the problem of underutilization of CPU and main memory, the multiprogramming
was introduced. The multiprogramming is interleaved execution of multiple jobs by the same
computer. In multiprogramming system, when one program is waiting for I/O transfer; there is
another program ready to utilize the CPU. So it is possible for several jobs to share the time of
the CPU. But it is important to note that multiprogramming is not defined to be the execution
of jobs at the same instance of time. Rather it does mean that there are a number of jobs
available to the CPU (placed in main memory) and a portion of one is executed then a segment
of another and so on. A simple process of multiprogramming is shown in figure 1.7

15
Fig 1.7
As shown in Fig 1.7, at the particular situation, job' A' is not utilizing the CPU time because it is
busy in I/0 operations. Hence the CPU becomes busy to execute the job 'B'. Another job C is
waiting for the CPU for getting its execution time. So in this state the CPU will never be idle and
utilizes maximum of its time.
A program in execution is called a "Process", "Job" or a "Task". The concurrent execution of
programs improves the utilization of system resources and enhances the system throughput as
compared to batch and serial processing. In this system, when a process requests some I/O to
allocate; meanwhile the CPU time is assigned to another ready process. So, here when a process
is switched to an I/O operation, the CPU is not set idle.
Multiprogramming is a common approach to resource management. The essential components
of a single-user operating include a command processor, an input/ output control system, a file
system, and a transient area. A multiprogramming operating system builds on this base,
subdividing the transient area to hold several independent programs and adding resource
management routines to the operating system's basic functions.

1.2.3) Multiprocessing

Systems that have more than one CPU are called “Multiprocessing”, and task is divided into
more than one processor (CPU). OR
In multiprocessing operating system a task is divided between more than one processor(CPU)
so that parallelism can be achieved.
Detail

In Multiprocessing system, CPU shares the computer bus and some time memory and I/O
device etc. Multiprocessing system is more reliable and faster than Multiprogramming.

16
If the underlying hardware provides more than one processor then that is multiprocessing.
Several variations on the basic scheme exist, e.g., multiple cores on one die or multiple dies in
one package or multiple packages in one system. Anyway, a system can be both multi
programmed by having multiple programs running at the same time and multiprocessing by
having more than one physical processor. There are Two types of multiprocessing.
Asymmetric Multiprocessing Symmetric Multiprocessing

Each processor runs a copy of the OS, and these


Each processor is assigned a specific task. Processor copies communicate with each other when needed.
that controls the system called master processor
_ Many processes can run at once without
and it give the instruction to solve processor.
performance deterioration.
_ more common in extremely large scale _ Most modern OS support SMP.
_ master slave relationship

17
Fig 1.8 Fig 1.9 Fig 1.10

Asymmetric Symmetric Architecture of Symmetric

1.2.4) Multitasking (Time Sharing OS)

A multitasking Operating system is any type of system that is capable of running more than one
program at a time using switching or scheduling technique. Modern Computer uses this type of
OS.
Time sharing is also called multitasking it is a logical extension of multiprogramming.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so
frequently that the user may interact with each program while it is running,

This type of OS is used in modern OS when multiple tasks share common resources (e.g. CPU
and memory).

The main motive of multitasking is to utili ze the CPU efficiently and reduce the response time.
Operating system uses CPU scheduling and multiprogramming to provide each user with a small
portion of a time. Show in Fig 1.11 and 1.12

Figure 1.11 Figure 1.12

18
1.2.5) Multithreading

Some time a program need to do multiple at the same time. It is an extension of


multiprogramming. In multithreading the program is divided into multiple task OR

This capability of Operating systems allows different parts or stages of any software or program
to run concurrently. Show in Fig 1.13
It supports multiple executions simultaneously and ensures that each application executes
within its standard format. UNIX, Linux and Windows

Fig 1.13

1.2.6) Network operating System

Network Operating System runs on a server and provides server the capability to manage data,
users, groups, security, applications, and other networking functions. The primary purpose of the
network operating system is to allow shared file and printer access among multiple computers in
a network, typically a local area network (LAN), a private network or to other networks. Examples
of network operating systems are Microsoft Windows Server 2003, Microsoft Windows Server
2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.

The advantages of network operating systems are following.

• Centralized servers are highly stable.

• Security is server managed.

• Upgrades to new technologies and hardware can be easily integrated into the system.

• Remote access to servers is possible from different locations and types of systems.

The disadvantages of network operating systems are following.

• High cost of buying and running a server.

19
• Dependency on a central location for most operations.

• Regular maintenance and updates are required.

1.2.7) Distributed System

Distributed system is similar to network OS. However in such OS there is no need to exchange
info explicitly. It is handling by the OS itself. OR

Distributed systems use multiple central processors to serve multiple real time application and
multiple users. Data processing jobs are distributed among the processors accordingly to which
one can perform each job most efficiently.

The processors communicate with one another through various communication lines (such as
high-speed buses or telephone lines). Two schemes are mostly used for building distributed
system. Show in table with fig. Fig 1.14 and 1.15

Tightly Coupled System Loosely Coupled System


In Tightly Coupled System the processor In loosely Coupled System the processor does not
share memory and a clock in such kind of share memory and a clock and each processor has
multiprocessor system communication take its own local memory. And the processor
place through the shared memory. communicates with each other through various
communication lines like high speed bus or
telephone line.

Fig 1.14 Fig 1.15

1.2.8) Real time Operating Systems (RTOS)

20
Real time Operating Systems (RTOS) responds quickly or instantly.
This types OS work with real environments, such whether forecast, storms and cyclones water
telemetry systems, Civil and Military aviation systems, air traffic control, GPS and GIS
applications. DOS and UNIX are not real-time OS.

1.3) Computer system Operation

• A modern general-purpose computer system consists of one or more CPUs and a


number of device controllers connected through a common bus that provides access to
shared memory (see Fig1.16)
• Each device controller is in charge of a specific type of device (for example, disk drives,
audio devices, and video displays).
• The CPU and the device controllers can execute concurrently, competing for memory
cycles.
• To ensure orderly access to the shared memory, a memory controller is provided whose
function is to synchronize access to the memory.

Fig 1.16 modern computer system.

• For a computer to start running, when it is powered up or rebooted-it needs to have an


initial program (bootstrap program) to run.
• Typically, it is stored in read-only memory (ROM) or electrically erasable programmable
read-only memory (EEPROM), known by the general term firmware, within the
computer hardware.
• It initializes all aspects of the system, from CPU registers to device controllers to
memory contents.
• The bootstrap program must know how to load the OS and to start executing that
system. To accomplish this goal, the bootstrap program must locate and load into
memory the OS kernel.
• The process of initializing the computer and loading the OS is known as bootstrapping.

21
1.4) Interrupts

The meaning of interrupts is to break the sequence of operation. It is a signal receives from I/O.

While the CPU is executing a program on “interrupt” breaks the normal sequence of execution of
instruction, diverts its execution to some other program called (ISR). Interrupt service routine,
after executing ISR the control is transferred back again to the main program.

The Programmable Interrupt Controller (PlC) functions as an overall manager in an


InterruptDriven system. It accepts requests from the peripheral equipment, determines which of
the incoming requests is of the highest importance (priority), ascertains whether the incoming
request has a higher priority value than the level currently being serviced, and issues an interrupt
to the CPU based on this determination

1.4.1) Interrupt handling

There are two common ways in which buses implement interrupts vectored and polling

1.4.1.1) Vectored

Devices that use vectored interrupts are assigned an interrupt vector. This is a number that
identifies a particular interrupt handler. This vector may be fixed, configurable (using jumpers or
switches), or programmable. In the case of programmable devices, an interrupt device cookie is
used to program the device interrupt vector. When the interrupt handler is registered, the kernel
saves the vector in a table. When the device interrupts, the system enters the interrupt
acknowledge cycle, asking the interrupting device to identify itself. The device responds with its
interrupt vector. The kernel then uses this vector to find the responsible interrupt handler.

1.4.1.2) Polling

Polling is the process where the computer or controlling device waits for an external device to
check for its readiness or state, often which low level hardware. for example when a printer is
connected via parallel port the computer waits until the printer has receive the next character.
These processes can be as mints as only reading one bit.

1.4.2) DMA

Direct memory access (DMA) is a method of transferring data from the computer RAM to
another part of the computer without processing it using CPU or without using CPU.

Direct Memory Access (DMA) is a capability provided by some computer bus architectures that
allows data to be sent directly from an attached device (such as a disk drive) to the memory on

22
the computer's motherboard. The microprocessor is freed from involvement with the data
transfer, thus speeding up overall computer operation.

The process is managed by a chip known as a DMA controller (DMAC).

While most data that is input or output from your computer is processed by the CPU, some data
does not require processing, or can be processed by another device. In these situations, DMA can
save processing time and is a more efficient way to move data from the computer's memory to
other devices.
For example, a sound card may need to access data stored in the computer's RAM, but since it
can process the data itself, it may use DMA to bypass the CPU. Video cards that support DMA can
also access the system memory and process graphics without needing the CPU. Ultra DMA hard
drives use DMA to transfer data faster than previous hard drives that required the data to first
be run through the CPU.
In order for devices to use direct memory access, they must be assigned to a DMA channel.
Each type of port on a computer has a set of DMA channels that can be assigned to each
connected device. For example, a PCI controller and a hard drive controller each have their own
set of DMA channels. Usually a specified portion of memory is designated as an area to be used
for direct memory access. In the ISA bus standard, up to 16 megabytes of memory can be
addressed for DMA.

In older computers, four DMA channels were numbered 0, 1, 2 and 3. When the 16-bit industry
standard architecture (ISA) expansion bus was introduced, channels 5, 6 and 7 were added. ISA
was a computer bus standard for IBM compatible computers, allowing a device to initiate each
channel requires two lines in order to function. One line is for is for the DMA controller, which
asks for clearance from the CPU. The other line is for the CPU to recognize that the DMA
controller is able to send data over the lines without disruption from the CPU.
DMA channels are used to communicate data between the peripheral device and the system
memory.
DMA channels are slower than later data transfer methods, and therefore are not as common.
One later interface is the Ultra DMA, which has a data transfer rate up to 33 MB per second.
Each DMA transfers approximately 2 MB data per second.

1.4.2.1) DMA Structure

DMA is a feature of modern computers that allows certain hardware subsystem within the
computer to access system memory independently of the CPU. Without DMA
when the CPU working, it is typically fully occupied for entire duration of the read write operation,
and it unavailable to perform other work. With DMA the CPU intiates the transfer, does other
operation while the transfer is in progress, and receive an interrupt from DMA controller when
the operation is done.

23
Diagram
of how modern computer work. Fig 1.17

1.5) I/O devices

All sort of information is to be feed into computer for ultimate results, for this purpose Input /
Output devices will be used.

1.5.1) Input devices

Enable user to enter data towards computer.

1.5.2) Output devices

Enable the user to view the computer in soft or hard copies.

Input devices

Keyboard
Mouse Microphone (speech input)
Scanner
Digital camera
Trackball Stylus

Output devices
Computer screen
Laser printer
Loudspeakers

1.6) I/O Structure

♦ After I/O starts, control returns to user program only upon I/O completion.

– Wait instruction idles the CPU until the next interrupt

24
– wait loop (contention for memory access).

– At most one I/O request is outstanding at a time, no simultaneous I/O processing.

♦ After I/O starts, control returns to user program without waiting for I/O completion.

– System call – request to the operating system to allow user to wait for I/O completion.

– Device-status table contains entry for each I/O device indicating its type, address, and state.

– Operating system indexes into I/O device table to determine device status and to modify table entry to
include interrupt.

1.7) Storage device

A storage device is any computing hardware that is used for storing, porting and extracting data
files and objects. It can hold and store information both temporarily and permanently, and can
be internal or external to a computer, server or any similar computing device.
A storage device may also be known as a storage medium.

Storage devices are one of the core components of any computing device. They store virtually
all the data and applications on a computer, except hardware firmware. They are available in
different form factors depending on the type of underlying device. For example, a standard
computer has multiple storage devices including RAM, cache, a hard disk, an optical disk drive
and externally connected USB drives.

There are two different types of storage devices:


Before discuss the types of storage devices we learn about temporarily& permanently OR
Volatile& Non volatile

Volatile memory
Volatile memory, also known as volatile storage, is a sort of computer memory that requires
power to maintain the stored information and popularly known as temporary memory. Like
RAM
Non volatile Memory
This type of memory retains the stored information even if power is off. BIOS are the practical
example of NVM. It is designed for permanent or fixed programmable memory.
Now we discuss primary and secondary

• Primary Storage Devices: Generally smaller in size, are designed to hold data
temporarily and are internal to the computer. They have the fastest data access speed,
and include RAM and cache memory.

25
• Secondary Storage Devices: These usually have large storage capacity, and they store
data permanently. They can be both internal and external to the computer, and they
include the hard disk, compact disk drive and USB storage device.

26
Several types of disks may be used for Secondary

Optical disks (including CD-ROM, writeable CD, DVD


Backup Storage Devices e.g. tape

Main memory – only large storage media that the CPU can access directly.
Secondary storage – extension of main memory that provides large nonvolatile storage

Magnetic disks – rigid metal or glass platters covered with magnetic recording material.
Disk surface is logically divided into tracks, which are subdivided into sectors.
The disk controller determines the logical interaction between the device and the

Registe

Cache

Main Memory

Flash/USB

Hard Drive

Tape Backup
Price Speed Size

Fig 1.18 Fig 1.19

27
storage.

• Floppy disks
• Hard disks

1.7.1) Storage Structure


• capacity.
• ••
computer.

1.8) Storage Hierarchy

Storage systems organized in hierarchy.


Speed
Cost
Volatility
Diagram of Storage Hierarchy is show in next page Figure 1.18 and 1.19

1.8.1) Register
In a computer, a register is one of a small set of data holding places that are part of a computer
processor. A register may hold a computer instruction.

1.8.2) Cache
Cache memory is extremely fast memory that is built into a processor. Cache memory to store
instructions that are repeatedly required to run programs, improving overall processor speed.

1.8.3) RAM
Random Access Memory is working memory of a computer where data is temporarily stored for
various processes. Computer memories that dynamically stores program and data values during
operation and in which each byte of memory may be randomly accessed.

1.8.4) Flash/USB memory universal serial bus is often used for the same purpose for which floppy
disk or CD was used, i.e. for storage. This is used for backup of data and transfer from one to
other computer,

1.8.5) Hard Disk Hard Disk drives are also called Mass storage, used to store large amount of
programs or data It read and write masses (bulk) of data on magnetic and optical media in

28
nonvolatile nature and measured in Megabytes, Gigabytes and Terabytes. Hard disk drives, floppy
disks and Optical disks are forms of mass storage.

1.9) Hardware Protection

About Protection?
Resources require protection from illegitimate access.
That is, ensure that each object is accessed correctly and only by those processes that are allowed
to do so. Principle of protection
Programs, user and system should be given just enough privileges to perform their tasks.

Hardware protections Methods

Dual mode operation I/O


protection
Memory protection CPU protection

Hardware level protections are through following mechanisms in OS:


1.9.1) Dual mode operation: This is the basis of all the protections. All the process operations
are performed through either User mode or Kernel mode. User mode is the one in which
execution is done on behalf of a user And Kernel/monitor mode is the one in which execution is
done on behalf of operating system. So basically all the privileged operations are performed in
Kernel mode.

1.9.2) I/O protection: All the input/output operations are privileged instructions and hence are
done in kernel mode. OS must ensure that application prog which is part of user mode does not
get control of computer in Kernel mode.

1.9.3) Memory protection: User mode should be given access to only those memory locations
for which they are allowed. It is achieved by having at least two registers viz. Base register: It
stores the starting physical address of the allowed memory location Limit register: It stores the
size of the range. So whenever CPU asks for the memory location access by giving its access, it is
checked if it falls between Base address and Base+ Limit address. In kernel mode OS has access

29
to all the memory locations including kernel and user memory. Loading of base and limit
registers is again a privileged instruction and hence done in Kernel mode.

1.9.4) CPU protection: It is achieved through a timer which is decremented with every clock
tick. When timer reaches 0, interrupt occurs and current process execution is suspended by
CPU. It is used to implement time sharing, also used for computing current time. Loading of this
timer is privileged instruction and hence done in kernel mode.

1.10) Buffering and spolling

1.10.1) Buffering

A buffer is an area of main memory for holding data during input and output data transfers. A
buffer contains data that is stored for a short amount of time typically in RAM.

In short A Temporary storage area, Usually in RAM.

Detail

A buffer contains data that is stored for a short amount of time, typically in the computer's
memory (RAM). The purpose of a buffer is to hold data right before it is used. For example, when
you download an audio or video file from the Internet, it may load the first 20% of it into a buffer
and then begin to play. While the clip plays back, the computer continually downloads the rest
of the clip and stores it in the buffer. Because the clip is being played from the buffer, not directly
from the Internet, there is less of a chance that the audio or video will stall or skip when there is
network congestion.
Buffering is used to improve several other areas of computer performance as well. Most hard
disks use a buffer to enable more efficient access to the data on the disk. Video cards send images
to a buffer before they are displayed on the screen (known as a screen buffer). Computer
programs use buffers to store data while they are running. If it were not for buffers, computers
would run a lot less efficiently and we would be waiting around a lot more. In figure 1.20 shows
buffering while we use internet and figure 1.21 show working of internal computer buffer

30
Figure 1.20 figure 1.21

1.10.2) Spooling

Spool: Simultaneous peripheral operation on line.

A spool is a buffer that holds output for a device, such as a printer, that cannot accept
interleaved data streams.
Spooling overlaps input of one job with the computation of other jobs.

31
Chapter#2

Operating System Structures


Topic to Learn
2.1 List the Function of Operating System 2.5 System calls
2.2 Describe Function of Operating System 2.3 2.6 System Programs
Managing computer resources OR component 2.7 General Structure and Architecture of
of OS Operating System
2.4 Explain OS Services 2.8 Design Goal of Operating System

2.1) List the Function of Operating System:


According to some reference According to some other reference

Resource Management Booting the computer


Storage Management Performs basic computer tasks
Process Management Provides a user interface
Memory Management Handles system resources
File Management Provides file management
User Interface
Program Execution
Security

But we select some common function from them

1. Resource Management 4. File Management


2. Process Management 5. User Interface
3. Storage Management 6. Booting

2.2) Describe Function of Operating System

2.2.1) Resource Management

Operating system will manage all the resources those are attached to the system means all the
resources, like memory, processor, I/O etc, those are attached to the system are known as
resources of computer system and OS will manage all the resources of the system.

When multiple users or multiple jobs running are concurrently on the operating system,
resources must be allocated to each of them. Some (such as CPU cycles, main memory, and file
storage) may have special allocation code and rules.

32
In general, a computer system has some resources which may be utilized to solve a problem.
They are

Memory Processor(s) I/O File System

2.2.2) Storage Management

Operating system also controls all the storage operation means how the data or file will be
stored into the computer and how files will be accessed by the user’s etc.

All the operation those are responsible for storing and accessing the files & also creation of file.
Directory etc… handle OS.

2.2.3) User Interface

All operating systems need to provide an interface to communicate with the user. This could be
a Command Line Interface or a Graphical User Interface. There are two types of interface.

CLI GUI

• Command line interface Graphical user interface


• It is command based It is Graphical Click able
• CLI is a method of interacting with a GUI is a method of interacting with a
computer via a text terminal computer via Graphical, pointing, mouse CLI is more
advanced, beginner users may etc.
struggle to use a CLI GUI is more user friendly with graphics CLI uses
less computer resources due to allowing mouse clicks etc.
being a simple command line so has its GUI hogs more computer resources due to
advantages over GUI. graphics etc.
• Example :Unix and DOS Example: windows, xp,7 and Linux

2.2.4) Booting

The process of starting or restarting the computer is known as booting. A cold boot is when you
turn on a computer that has been turned off completely. A warm boot is the process of using
the operating system to restart the computer.

Note: Process, memory and File Management cover in next topic 2.3.

33
2.3) Component of Operating System OR Explain How OS manage resources:

2.3.1) process management


2.3.2) memory management
2.3.3) Device management
2.3.4) Storage management
2.3.5) File management

2.3.1) Process management

Def: Process management is an integral part of any modern day Operating system. The OS must
allocate resources to processes, enable processes to share and exchange information, protect
the resources of each process from other processes and enable synchronization among
processes.

The operating system is responsible for the following activities in connection with process
management:

• Creating and deleting both user and system processes


• Suspending and resuming processes
• Providing mechanisms for process synchronization
• Providing mechanisms for process communication
• Providing mechanisms for deadlock handling

Process management based on:

i) System Process

System process required to starting an OS, and stored in memory.Explore.exe is biggest process.

ii) User process

When user opens any task in computer, user process generated, including resource (CPU,
memory, file etc.)

2.3.1.1) What is Process?

A process is a program in execution. A process needs some certain resources, including CPU time,
memory, files and I/O devices to accomplish its task. OR A process is defined as an entity which
represents the basic unit of work to be implemented in the system.
Program is a passive entity and process is an active entity.

A program by itself is not a process. It is a static entity made up of program statement while
process is a dynamic entity. Program contains the instructions to be executed by processor. A
program does not perform any action by itself.

34
A process includes:

Program counter: Current activity including, processor registers

Stack: containing temporary data

Data section: containing global variables

Text section: The program code, also called

Heap: containing memory dynamically allocated during run time

Components of process are following.

S.N Component & Description


Object Program
1
Code to be executed.
Data
2
Data to be used for executing the program.
Resources
3
While executing the program, it may require some resources.
4 Status
Verifies the status of the process execution. A process can run to completion only when all
requested resources have been allocated to the process. Two or more processes could be
executing the same program, each using their own data and resources.

2.3.1.2) Process states

As a process executes, it changes state. The state of a process is defined as the current activity
of the process. Process can have one of the following five states at a time. Show in fig 2.1

S.N State & Description

New
1 The process is being created.
2 Ready
The process is waiting to be assigned to a processor. Ready processes are waiting to have
the processor allocated to them by the operating system so that they can run.
Running
3 Process instructions are being executed (i.e. The process that is currently being executed).
4 Waiting
The process is waiting for some event to occur (such as the completion of an I/O
operation).

35
Terminated
5 The process has finished execution.

fig 2.1 process state

2.3.1.3) Process Control Block, PCB


S.N Information & Description
1 Pointer
Pointer points to another process control block. Pointer is used for
maintaining the scheduling list.
2 Process State
Process state may be new, ready, running, waiting and so on.
3 Program Counter
Program Counter indicates the address of the next instruction to be
executed for this process.
4 CPU registers
CPU registers include general purpose register, stack pointers, index
registers and accumulators etc. number of register and type of register
totally depends upon the computer architecture.
5 Memory management information
This information may include the value of base and limit registers, the
page tables, or the segment tables depending on the memory system
used by the operating system. This information is useful for de allocating
the memory when the process terminates.
6 Accounting information
This information includes the amount of CPU and real time used, time
limits, job or process numbers, account numbers etc.

36
Each process is represented in the operating system by a process control block (PCB) also called
a task control block. PCB is the data structure used by the operating system. Operating system
groups all information that needs about particular process.
PCB contains many pieces of information associated with a specific process which are described
below. And memory layout of PCB show in Fig 2.2

Fig 2.2 PCB

Process control block includes CPU scheduling, I/O resource management, file management
information etc.. The PCB serves as the repository for any information which can vary from
process to process. Loader/linker sets flags and registers when a process is created. If that process
get suspended, the contents of the registers are saved on a stack and the pointer to the particular
stack frame is stored in the PCB. By this technique, the hardware state can be restored so that
the process can be scheduled to run again.

2.3.1.4) Process Creation

Parent process creates children processes, which, in turn create other processes, forming a tree
of processes. Generally, process identified and managed via a process identifier (PID).

Processes are the primitive units for allocation of system resources. Each process has its own
Address space and (usually) one thread of control. .

37
Each process has a parent process, which explicitly arranged to create it. The processes created
by a given parent are called its child processes. A child inherits many of its attributes from the
parent process. A process ID number names each process. A unique process ID is allocated to
each process when it is created
Processes are created with the fork() system call (so the operation of creating a new process is
sometimes called forking a process). The child process created by fork is a copy of the original
parent process, except that it has its own process ID.
After forking a child process, both the parent and child processes continue to execute normally.
If you want your program to wait for a child process to finish executing before continuing, you
Must do this explicitly after the fork operation, by calling wait() or waitpid().

Some term/definition

Fork (): system call that is used to create a new child process identical to the parent(in Unix)

Example: Google chrome uses a fork to handle each page within a separate process.

Exec (): allows a child to run a new program

Wait (): allows a parent to wait for a child to terminate

You can see……

Zombie process: A process that is waiting for its parent to accept its return code is called a
zombie process

2.3.1.4) Process termination

There are many reasons for process termination.


• Batch job issues halt instruction
• User log off
• Error and fault condition
• Memory unavailable
• I/O failure
• Data misuse

38
2.3.1.5) Process scheduling
Def: In multiprogramming environment, OS decides which process gets the processor when and
how much time. This function is called process scheduling. OR The
process scheduling is the activity of the process manager that handles the removal of the
running process from the CPU and the selection of another process on the basis of a particular
strategy.
Scheduling Queues

Scheduling queues refers to queues of processes or devices. When the process enters into the
system, then this process is put into a job queue. This queue consists of all processes in the
system. This figure 2.3 shows the queuing diagram of process scheduling.

• Queue is represented by rectangular box.

• The circles represent the resources that serve the queues.

• The arrows indicate the process flow in the system.

figure 2.3

Queues are of There types

• Job queue : set of all processes in the system ready/waiting.


• Ready queue: set of all processes residing in memory r/w to exe.A newly arrived process
is put in the ready queue. Processes waits in ready queue for allocating the CPU. Once
the CPU is assigned to a process, then that process will execute. While executing the
process, any one of the following events can occur.

39
• Device queue: device queue is a queue for which multiple processes are waiting for a
particular I/O device each device has its own device queue.

Two State Process Model

Two state process models refer to running and non-running states which are described below.

S.N State & Description


1 Running
When new process is created by Operating System that process enters into the
system as in the running state.
2 Not Running
Processes that are not running are kept in queue, waiting for their turn to execute.
Each entry in the queue is a pointer to a particular process.

2.3.1.6) Schedulers

Schedulers are special system software’s which handles process scheduling in various ways. Their
main task is to select the jobs to be submitted into the system and to decide which process to
run. Schedulers are of three types

I. Long Term Scheduler


II. Short Term Scheduler
III. Medium Term Scheduler

i) Long Term Scheduler

Select which processes should be brought into the ready queue. It is also called job scheduler.

Long term scheduler determines which programs are admitted to the system for processing.
Job scheduler selects processes from the queue and loads them into memory for execution.
Process loads into the memory for CPU scheduling. The primary objective of the job scheduler is
to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the
degree of multiprogramming. Processes can be described as either:

I/O-bound process: spends more time doing I/O than computations; many short CPU burst

CPU-bound process: spends more time doing computation than I/O; few very long CPU burst

ii) Short Term Scheduler

Select which process should be executed next and allocates CPU. It is also called CPU scheduler.

40
Main objective is increasing system performance in accordance with the chosen set of criteria. It
is the change of ready state to running state of the process. CPU scheduler selects process among
the processes that are ready to execute and allocates CPU to one of them.

Short term scheduler also known as dispatcher, execute most frequently and makes the fine
grained decision of which process to execute next. Short term scheduler is faster than long term
scheduler.

iii) Medium Term Scheduler

Medium term scheduling is part of the swapping. It removes the processes from the
memory. It reduces the degree of multiprogramming. The medium term scheduler is
incharge of handling the swapped out-processes. Fig 2.4 show Medium Term Scheduler

Fig 2.4

Running process may become suspended if it makes an I/O request. Suspended processes cannot
make any progress towards completion. In this condition, to remove the process from memory
and make space for other process, the suspended process is moved to the secondary storage.
This process is called swapping.

Comparison between Scheduler


Long Term Scheduler Short Term Scheduler Medium Term Scheduler
S.N
It is a process swapping
1 It is a job scheduler It is a CPU scheduler
scheduler.
2 Speed is in between both
Speed is lesser than short term Speed is fastest among other
short and long term
scheduler two
scheduler.
It controls the degree of It provides lesser control over It reduces the degree of
3
multiprogramming degree of multiprogramming multiprogramming.
It is almost absent or minimal It is also minimal in time It is a part of Time sharing
4
in time sharing system sharing system systems.

41
5 It selects processes from pool It can re-introduce the
It selects those processes
and loads them into memory process into memory and
which are ready to execute
for execution execution can be continued.

2.3.1.7) Context Switch

A context switch is the mechanism to store and restore the state or context of a CPU in Process
Control block so that a process execution can be resumed from the same point at a later time.
Using this technique a context switcher enables multiple processes to share a single CPU.

Context switching is an essential part of a multitasking operating system features. When the
scheduler switches the CPU from executing one process to execute another, the context switcher
saves the content of all processor registers for the process being removed from the CPU, in its
process descriptor. The context of a process is represented in the process control
block of a process. Show in fig 2.5
Context switch time is pure overhead. Time dependent on hardware support like some
hardware provide multiple set of registers per CPU.

Note: Context switch time is overhead mean , the system does not useful work while switching.

fig
2.5

Some hardware systems employ two or more sets of processor registers to reduce the amount
of context switching time. When the process is switched, the following information is stored.

42
• Program Counter

• Scheduling Information

• Base and limit register value

• Currently used register Switching


in PCB

• Changed State

• I/O State

• Accounting

2.3.2) Memory Management

Memory management is the functionality of an operating system that tell how a process
managed in memory it also handles or manages primary memory

• Keeps tracks of primary or main memory i.e. what part of it use by whom, what part is are not
in use.
• In multiprogramming, OS decide which process will get memory when and how much Keep
track of what parts of memory are in use.
• Allocate memory to processes when needed. De allocate when processes are done.

Memory management provides protection by using two registers, a base register and a limit
register. The base register holds the smallest legal physical memory address and the limit register
specifies the size of the range. For example, if the base register holds 300000 and the limit register
is 1209000, then the program can legally access all addresses from 300000 through 411999. Show
in below Figure 2.6

43
Fig 2.6

Instructions and data to memory addresses can be done in following ways

• Compile time -- When it is known at compile time where the process will reside, compile time
binding is used to generate the absolute code.
• Load time -- When it is not known at compile time where the process will reside in memory,
then the compiler generates re-locatable code.
• Execution time -- If the process can be moved during its execution from one memory segment
to another, then binding must be delayed to be done at run time Logical versus Physical
Address Space
An address generated by the CPU is a logical address whereas address actually available on
memory unit is a physical address. Logical address is also known a Virtual address.

Virtual and physical addresses are the same in compile-time and load-time address-binding
schemes. Virtual and physical addresses differ in execution-time address-binding scheme.

The set of all logical addresses generated by a program is referred to as a logical address space.
The set of all physical addresses corresponding to these logical addresses is referred to as a
physical address space.

The run-time mapping from virtual to physical address is done by the memory management unit
(MMU) which is a hardware device. MMU uses following mechanism to convert virtual address
to physical address.

• The value in the base register is added to every address generated by a user process which is
treated as offset at the time it is sent to memory. For example, if the base register value is
10000, then an attempt by the user to use address location 100 will be dynamically reallocated
to location 10100.

• The user program deals with virtual addresses; it never sees the real physical addresses.

44
2.3.2.1) Virtual Memory

Virtual memory is a technique in which you transfer a data in hard disk from RAM, Means
specific part in hard disk use as a RAM. OR

Virtual memory is a feature of an Operating system that allows a computer to compensate for
shortages of physical memory by temporarily transferring pages or data from RAM to Hard disk

Fig 2.7 VM Fig 2.8 Internal working of VM

2.3.2.2) Swapping

Swapping is a mechanism in which a process can be swapped temporarily out of main memory
to a backing store, and then brought back into memory for continued execution. So, the process
of swap in and swap out of data is called swapping.show in Figure 2.9

To replace pages or segments of data in memory, Swapping is a useful technique that enables a
computer to execute programs and manipulate data files larger than main memory. The OS
copies as much data possible into main memory, and leaves the rest on the disk, when the OS
needs data from the disk; it exchanges a portion of data (called pages or segment) in a main
memory with a portion of data on disk

DOS does not perform swapping, but most other OS like OS/2, WINDOWS and Linux do.

Remember that swapping is only necessary when that data is not already in the RAM.

45
Fig2.9
2.3.2.3) Fragmentation

As processes are loaded and removed from memory, the free memory space is broken into little
pieces. It happens after sometimes that processes can not be allocated to memory blocks
considering their small size and memory blocks remains unused. This problem is known as
Fragmentation

As you use your computer daily files get written and deleted constantly from the disk, either by
yourself or by the operating system creating and removing temporary files. This process leave
the disk in no sort of order and when new file are written to the disk they start to get written in
the gaps on the disk, this is called Fragmentation.

The Defragmentation process gather data and remove gaps, making data into order is defrag
which makes disk performance faster.

2.3.2.4) Paging

External fragmentation is avoided by using paging technique. Paging is a technique in which


physical memory is broken into blocks of the same size called pages (size is power of 2, between
512 bytes and 8192 bytes). When a process is to be executed, it's corresponding pages are loaded
into any available memory frames.Show in Figure 2.10

Address generated by CPU is divided into

• Page number (p) -- page number is used as an index into a page table which contains base
address of each page in physical memory.
• Page offset (d) -- page offset is combined with base address to define the physical memory
address.

46
Fig 2.10

Following Figure 2.11 show the paging table architecture.

Fig 2.11

2.3.2.5) Segmentation

Segmentation is a technique to break memory into logical pieces where each piece represents a
group of related information. For example ,data segments or code segment for each process,
data segment for operating system and so on. Segmentation can be implemented using or
without using paging.Show in Fig 2.11

Unlike paging, segment are having varying sizes and thus eliminates internal fragmentation.
External fragmentation still exists but to lesser extent.

47
Fig 2.12

Address generated by CPU is divided into

• Segment number (s) -- segment number is used as an index into a segment table which
contains base address of each segment in physical memory and a limit of segment.
• Segment offset (o) -- segment offset is first checked against limit and then is combined with
base address to define the physical memory address.

Following Figure 2.12 show the segment architecture.

Fig 2.12

48
2.3.3) Device management

OS manages device communication via their respective drivers. Operating System does the
following activities for device management.

• Keeps tracks of all devices. Program responsible for this task is known as the I/O controller.

• Decides which process gets the device when and for how much time.

• Allocates the device in the efficient way.

• De-allocates devices.

Device management controls the peripheral device by sending them command to their own
properties language.

The software routine known how to deal each device is called “driver” (Device driver allow user
application to communicate with a system device).

The OS required driver for attached peripheral device in the computer. When a new device is
added drivers of this device is necessary to install in computer for communication.

To perform useful functions, processes need access to the peripherals connected to the
computer, which are controlled by the kernel through device drivers. For example, to show the
user something on the screen, an application would make a request to the kernel, which would
forward the request to its display driver, which is then responsible for actually plotting the
character/pixel.
OS

Graphics Card Driver Printer driver

Graphics Card Printer

2.3.4) Storage management

Since main memory (primary storage) is volatile and too small to accommodate all data and
programs permanently, the computer system must provide secondary storage to back up main
memory.
Generally speaking, system has several levels of storage, including primary storage, secondary
storage and cache storage. Instructions and data must be placed in primary storage or cache to
be referenced by a running program. Because main memory is too small to accommodate all
data and programs, and its data are lost when power is lost, the computer system must provide
secondary storage to back up main memory.

49
Secondary storage consists of tapes, disk, and other media designed to held information that
will eventually be accessed in primary storage (primary, secondary, cache) is ordinarily divided
into byte or words consisting of a fixed number of byte.

Responsibility

– Free space management


– Storage allocation
– Disk scheduling

All operating systems include support for a variety of file systems. Modern file systems
comprise a hierarchy of directories. While the idea is conceptually similar across all
generalpurpose file systems, some differences in implementation exist. The file system is of
particular interest. Obviously, programs need to read and write files and directories, create and
delete them, search them, list file Information, permission management. File systems may
provide journaling, which provides safe recovery in the event of a system crash. A journeyed file
system writes information twice: first to the journal, which is a log of file system operations,
then to its proper place in the ordinary file system. In the event of a crash, the system can
recover to a consistent state by replaying a portion of the journal. In contrast, non-journeyed
file systems typically need to be examined in their entirety by a utility such as fsck or chkdsk.

2.3.4) File Management

A file is a collection of related information defined by its creator. Commonly, files represent
programs (both source and object forms) and data. OR

The operating system is responsible for the following activities in connections with file
management:

Keeps track of information, location, uses, status etc. The collective facilities are often known as
file system.Decides who gets the resources.

Allocates the resources.

De-allocates the resources.

– File creation and deletion.


– Directory creation and deletion.
– Support of primitives for manipulating files and directories.
– Mapping files onto secondary storage.
– File backup on stable (nonvolatile) storage media.

2.3.4.1) File

50
A file is a named collection of related information that is recorded on secondary storage such as
magnetic disks, magnetic tapes and optical disks.In general, a file is a sequence of bits, bytes,
lines or records whose meaning is defined by the files creator and user.

Attributes of a File
▪ Name – only information kept in human-readable form

• Identifier – unique tag (number) identifies file within file system

• Type – needed for systems that support different types

• Location – pointer to file location on device

• Size – current file size

• Protection – controls who can do reading, writing, executing

• Time, date, and user identification – data for protection, security, and usage monitoring

• Information about files is kept in the directory structure, which is maintained on the
disk.

2.3.4.2) File Structure

File structure is a structure, which is according to a required format that operating system can
understand.

• A file has a certain defined structure according to its type.

• A text file is a sequence of characters organized into lines.

• A source file is a sequence of procedures and functions.

• An object file is a sequence of bytes organized into blocks that are understandable by the
machine.

• When operating system defines different file structures, it also contains the code to support
these file structure. UNIX, MS-DOS support minimum number of file structure.

2.3.4.3) File Type

File type refers to the ability of the operating system to distinguish different types of file such as
text files source files and binary files etc. Many operating systems support many types of files.
Operating systems like MS-DOS and UNIX have the following types of files:

I. ORDINARY FILES

• These are the files that contain user information.

51
• These may have text, databases or executable program.

• The user can apply various operations on such files like add, modify, delete or even remove the
entire file.

II. DIRECTORY FILES


• These files contain list of file names and other information related to these files.

III. SPECIAL FILES:

• These files are also known as device files.

• These files represent physical device like disks, terminals, printers, networks, tape drive etc.

These files are of two types

2.3.4.4) File Access Mechanisms

File access mechanism refers to the manner in which the records of a file may be accessed.
There are several ways to access files

I. Sequential access

II. Direct/Random access

III. Indexed sequential access

I) SEQUENTIAL ACCESS

A sequential access is that in which the records are accessed in some sequence i.e the information
in the file is processed in order, one record after the other. This access method is the most
primitive one. Example: Compilers usually access files in this fashion.

II) DIRECT/RANDOM ACCESS

• Random access file organization provides, accessing the records directly.

• Each record has its own address on the file with by the help of which it can be directly accessed
for reading or writing.

• The records need not be in any sequence within the file and they need not be in adjacent
locations on the storage medium.

III) INDEXED SEQUENTIAL ACCESS

• This mechanism is built up on base of sequential access.

• An index is created for each file which contains pointers to various blocks.

52
• Index is searched sequentially and its pointer is used to access the file directly.

2.3.4.5) Space Allocation

Files are allocated disk spaces by operating system. Operating systems deploy following three
main ways to allocate disk space to files.

I. Contiguous Allocation

II. Linked Allocation

III. Indexed Allocation

I) CONTIGUOUS ALLOCATION

• Each file occupy a contiguous address space on disk.

• Assigned disk address is in linear order.

• Easy to implement.

• External fragmentation is a major issue with this type of allocation technique.

II) LINKED ALLOCATION

• Each file carries a list of links to disk blocks.

• Directory contains link / pointer to first block of a file.

• No external fragmentation

• Effectively used in sequential access file.

• Inefficient in case of direct access file.

III) INDEXED ALLOCATION

• Provides solutions to problems of contigous and linked allocation.

• A index block is created having all pointers to files.

• Each file has its own index block which stores the addresses of disk space occupied by the file.

• Directory contains the addresses of index blocks of files.

2.3.4.6) File system

53
It is system software that takes commands from the operating system to read and write the disk
cluster( group of sectors). The file system manages a folder/directory structure, which provides
an Index to the files. OR
File system is used to control how data is stored and retrieved.

Basic File System Operations

• Create a file

• Write to a file

• Read from a file

• Seek to somewhere in a file

• Delete a file

• Truncate a file

2.3.4.7) Types of File system

File system types can be classified into disk/tape file system, network file system and
specialpurpose file system.

1) Disk File System

A disk file system is a file system designed for the storage of files on a data storage device, most
commonly a disk driver, which might be directly or indirectly connected to the computer
Examples include FAT (FAT12, FAT16, FAT32), exFAT, NTFS,HFS and HFS+, HPFS, UFS, ext2, ext3,
ext4, XFS, btrfs, ISO 9660, Files-11, Veritas File System, VMFS, ZFS, ReiserFS and UDF.

2) Flash File System

A Flash File System is a File System designed for storing files on flash memory device.

3) Tape File system

A tape file system is a file system and tape format designed to store files on tape in a
selfdescribing form. Magnetic tapes are sequential storage media with significantly longer
random data access times than disks, posing challenges to the creation and efficient
management of a general-purpose file system.

4) Database File system

54
A new concept for file management is the idea of a database-based file system. Instead of, or in
addition to, hierarchical structured management, files are identified by their characteristics, like
type of file, topic, author, or similar rich metadata.

5) Network File System

A network file system is a file system that acts as a client for a remote file access protocol,
providing access to files on a server.. Examples of network file systems include clients for the
NFS, AFS, SMB protocols, and file-system-like clients for FTP and WebDAV.

6) Device File System

A device file system represents I/O devices and pseudo-devices as files, called device files.
Examples in Unix-like systems include devfs and, in Linux 2.6 systems,udev.

7) Shared Disk File System

A shared disk file system is one in which a number of machines (usually servers) all have access
to the same external disk subsystem (usually a SAN). Examples include GFS2 from Red Hat,
GPFS from IBM, SFS from DataPlow, CXFS from SGIand StorNext from Quantum Corporation.

8) Special File System

A Special File System is basically any File System that is not a disk file system or not a network
File System. This includes system where the files are arranged dynamically by software,
intended for such purpose as communication between computer process or temporary file
space.

2.4) Services of Operating System

The Operating system provides some services to program and to the user of these programmers
in order to make programming task easier. Show Fig 2.13

Services provided by OS are:

1) Program Execution:

The operating system should be able to load a program into memory and execute it.

2) I/O Device or I/O Operation:

Normally, a user program cannot execute I/O operations directly. So when a running program
needs an i/o the operating system should be able to fulfill the need of that program.

55
3) File System Manipulation:

Programs need to read and write files. Similarly, new files can be created and unwanted existing
files are deleted. Operating system should be able to manage the activities related to files. OR
simply; Program capability to read, write, create and delete file.

4) Communication

Sometimes, programs need to exchange information with each other. Exchange of information
can be implemented using a shared memory (same machine) or message passing in the form of
packets (on a network). OS should be able to communicate between programs.

5) Error detection

The OS should always be aware of possible errors. Error due to hardware i.e. CPU, memory or
I/O devices etc or Due to Software i.e. user program etc. the OS should take necessary steps to
ensure correct and constant computing.

6) Resource Allocation

OS is the manager of resources and when resources are requested by different users at the
same time, then OS allocates and de allocates these resources to many user/programs in an
efficient manner.

7) Accounting

Accounting is used for two purposes.

i) To keep track of resources, i.e. which resources are used by which users so that they can be
billed?
ii) Usage statistics of resources may be a valuable tool for researchers in order to
reconfigure the system for improving computer services.

8) Protection and security

Protection: Any mechanism for controlling access of processes or users to resources defined by
OS.
Security: Defines the system against internal and external attacks.

Detail

Security refers to providing a protection system to computer system resources such as CPU,
memory, disk, software programs and most importantly data/information stored in the computer
system. If a computer program is run by unauthorized user then he/she may cause severe

56
damage to computer or data stored in it. So a computer system must be protected against
unauthorized access, malicious access to system memory, viruses, worms etc. We're going to
discuss following topics in this article.

• Authentication

• One Time passwords

• Program Threats

• System Threats

• Computer Security Classifications

Protection Considering a computer systems having multiple users the concurrent execution of
multiple processes, then the various processes must be protected from each another's activities.

Protection refers to mechanism or a way to control the access of programs, processes, or users
to the resources defined by computer systems. Following are the major activities of an operating
system with respect to protection.

• OS ensures that all access to system resources is controlled.

• OS ensures that external I/O devices are protected from invalid access attempts.

• OS provides authentication feature for each user by means of a password.

Operating System Services Diagram:

Fig 2.13

2.5) System call

In computing, a system call is how a program requests a service from an operating system kernel.
This may include hardware related services (for example accessing a hard disk drive).

57
User space Application

System Calls

Kernel
Fig 2.14 Sys call
2.5.1) Types of System Calls

1) Process control

Some System calls under process control:

end, abort load, execute create


process, terminate process get process
attributes, set process attributes wait for
time wait event, signal event
allocate and free memory
2) File management

Some System calls under File


management:
create file, delete file open,
close file read, write, reposition get and set
file attributes

3) Device management

Some System calls under Device


management:
request device,
release device read, write, reposition get
device attributes, set device attributes
logically attach or detach devices
4) Information maintenance
Some System calls under Information maintenance:
get
time or date, set time or date get system data, set
system data get and set process, file, or device
attributes
5) Communications
Some System calls under communication control:

create, delete communication connection send,

58
receive messages transfer status information
attach and detach remote devices

Example of windows AND UNIX system calls:

2.6) System Programs

• System programs provide OS functionality through separate applications, which are not
part of the kernel or command interpreters. They are also known as system utilities or
system applications.
• Most systems also ship with useful applications such as calculators and simple editors, (
e.g. Notepad ). Some debate arises as to the border between system and non-system
applications.
• System programs may be divided into these categories:
o File management - programs to create, delete, copy, rename, print, list, and
generally manipulate files and directories. o Status information - Utilities to
check on the date, time, number of users, processes running, data logging, etc.
System registries are used to store and recall configuration information for
particular applications.
o File modification - e.g. text editors and other tools which can change file
contents. o Programming-language support - E.g. Compilers, linkers,

59
debuggers, profilers, assemblers, library archive management, interpreters for
common languages, and support for make.

o Program loading and execution - loaders, dynamic loaders, overlay loaders,


etc., as well as interactive debuggers.
o Communications - Programs for providing connectivity between processes and
users, including mail, web browsers, remote logins, file transfers, and remote
command execution. o Background services - System daemons are commonly
started when the system is booted, and run for as long as the system is
running, handling necessary services. Examples include network daemons,
print servers, process schedulers, and system error monitoring services.
• Most operating systems today also come complete with a set of application programs
to provide additional services, such as copying files or checking the time and date.
• Most users' views of the system is determined by their command interpreter and the
application programs. Most never make system calls, even through the API, ( with the
exception of simple ( file ) I/O in user-written programs. )

2.7) Operating-System Structure

For efficient performance and implementation an OS should be partitioned into separate


subsystems, each with carefully defined tasks, inputs, outputs, and performance characteristics.
These subsystems can then be arranged in various architectural configurations:

2.7.1 Simple Structure

Many operating systems do not have well-de.ned structures. MS-DOS is an example of such a
system. When DOS was originally written its developers had no idea how big and important it
would eventually become. It was written by a few programmers in a relatively short amount of
time, without the benefit of modern software engineering techniques, and then gradually grew
over time to exceed its original expectations. It does not break the system into subsystems,
and has no distinction between user and kernel modes, allowing all programs direct access to
the underlying hardware.

You can see in this figure

60
Fig 2.15 - MS-DOS layer structure

The original UNIX OS used a simple layered approach, but almost all the OS was in one big layer,
not really breaking the OS down into layered subsystems:

Fig 2.16 - Traditional UNIX system structure

2.7.2 Layered Approach

• Another approach is to break the OS into a number of smaller layers, each of


which rests on the layer below it, and relies solely on the services provided by
the next lower layer.
• This approach allows each layer to be developed and debugged independently,
with the assumption that all lower layers have already been debugged and are
trusted to deliver proper services.
• The problem is deciding what order in which to place the layers, as no layer can
call upon the services of any higher layer.
• Layered approaches can also be less efficient, as a request for service from a
higher layer has to filter through all lower layers before it reaches the HW,
possibly with significant processing at each step.

61
Fig 2.17 - A layered operating system

2.7.3 Microkernels

• The basic idea behind micro kernels is to remove all non-essential services from
the kernel, and implement them as system applications instead, thereby making
the kernel as small and efficient as possible.
• Most microkernels provide basic process and memory management, and
message passing between other services, and not much more.
• Security and protection can be enhanced, as most services are performed in user
mode, not kernel mode.
• System expansion can also be easier, because it only involves adding more
system applications, not rebuilding a new kernel.
• Mach was the first and most widely known microkernel, and now forms a major
component of Mac OSX.
• Windows NT was originally microkernel, but suffered from performance
problems relative to Windows 95. NT 4.0 improved performance by moving
more services into the kernel, and now XP is back to being more monolithic.
• Another microkernel example is QNX, a real-time OS for embedded systems.

62
Figure 2.18 - Architecture of a typical microkernel

2.7.4 Modules

• Modern OS development is object-oriented, with a relatively small core kernel


and a set of modules which can be linked in dynamically. See for example the
Solaris structure, as shown in Figure 2.13 below.
• Modules are similar to layers in that each subsystem has clearly defined tasks
and interfaces, but any module is free to contact any other module, eliminating
the problems of going through multiple intermediary layers.
• The kernel is relatively small in this architecture, similar to microkernels, but the
kernel does not have to implement message passing since modules are free to
contact each other directly.

Figure 2.19 - Solaris loadable modules

63
2.7.5 Hybrid Systems

• Most OSes today do not strictly adhere to one architecture, but are hybrids of
several.

2.7.5.1 Mac OS X

• The Max OSX architecture relies on the Mach microkernel for basic system
management services, and the BSD kernel for additional services. Application
services and dynamically loadable modules ( kernel extensions ) provide the rest
of the OS functionality:

Figure 2.20 - The Mac OS X structure

2.7.5.2 iOS

• The iOS operating system was developed by Apple for iPhones and iPads. It runs
with less memory and computing power needs than Max OS X, and supports
touchscreen interface and graphics for small screens:

64
Figure 2.21 - Architecture of Apple's iOS.

2.7.5.3 Android

• The Android OS was developed for Android smartphones and tablets by the
Open Handset Alliance, primarily Google.
• Android is an open-source OS, as opposed to iOS, which has lead to its
popularity.
• Android includes versions of Linux and a Java virtual machine both optimized for
small platforms.
• Android apps are developed using a special Java-for-Android development
environment.

Figure 2.22 - Architecture of Google's Android

65
2.8 Operating-System Design and Implementation

2.8.1 Design Goals

• Requirements define properties which the finished system must have, and are a
necessary first step in designing any large complex system. o User
requirements are features that users care about and understand, and are
written in commonly understood vernacular. They generally do not include any
implementation details, and are written similar to the product description one
might find on a sales brochure or the outside of a shrink-wrapped box. o
System requirements are written for the developers, and include more details
about implementation specifics, performance requirements, compatibility
constraints, standards compliance, etc. These requirements serve as a "contract"
between the customer and the developers, ( and between developers and
subcontractors ), and can get quite detailed.
• Requirements for operating systems can vary greatly depending on the planned
scope and usage of the system. ( Single user / multi-user, specialized system /
general purpose, high/low security, performance needs, operating environment,
etc. )

2.8.2 Mechanisms and Policies

• Policies determine what is to be done. Mechanisms determine how it is to be


implemented.
• If properly separated and implemented, policy changes can be easily adjusted
without re-writing the code, just by adjusting parameters or possibly loading
new data / configuration files. For example the relative priority of background
versus foreground tasks.

2.8.3 Implementation

• Traditionally OSes were written in assembly language. This provided direct


control over hardware-related issues, but inextricably tied a particular OS to a
particular HW platform.
• Recent advances in compiler efficiencies mean that most modern OSes are
written in C, or more recently, C++. Critical sections of code are still written in
assembly language, ( or written in C, compiled to assembly, and then fine-tuned
and optimized by hand from there. )
• Operating systems may be developed using emulators of the target hardware,
particularly if the real hardware is unavailable ( e.g. not built yet ), or not a
suitable platform for development, ( e.g. smart phones, game consoles, or other
similar devices. )

66
Part#B. DOS, Commands and Directory
This chapter is not included in your course content but this is very important for learning
Operating system.

So don’t ignore this. Here only some terminology, definition, file system, and commands are
given

Disk Operation System (DOS)

DOS stands for DISK OPERATING SYSTEM and Like MS Windows, MS-DOS is operating system. DOS is the
software program, which controls the input and output of your computer. Unlike Microsoft Windows
DOS requires the user to type commands instead of using a mouse. DOS is a single-user, single-task
operating system

Brief History of DOS

MS-DOS is a non-graphical command line operating system created for IBM compatible computers. DOS
was first introduced by Microsoft in August 1981 and last updated in 1994 when MS-DOS 6.22 was
released.DOS operating system is not commonly used today.

DOS File SYSTEM


config.sys Loading OS & form kernel
msdos.sys System files Loading OS
io.sys Input/output Sys files of OS
command.com Command interpreter: It maintain C:\prompt & reads user commands.
auotexec.bat Create lists of commands to run in sequence once the batch file is executed.
Don’t erase these files. Kernel is central module; it first loads OS and then remains in main memory.

Command Prompt

Command Prompt is a native Windows program that lets you execute commands without using a GUI. To
open the Command Prompt. You can do this by going to Start> All Programs>Accessories> Command
Prompt. C:\Documents and Settings\username. This shows that what directory you are currently in.

Root & Sub Directories

Every disk you use under DOS has one main directory, called the root directory
C:\ Root Directory
C:\DOS Root with sub directory C:\DOS\RPI
Root with sub directory & another sub directory .
DOS providing solution by adding sub directories to manage data or files

DOS Commands
If you want know the version of DOS just write c:\>ver
in command line prompt then the following message appears on your screen:

67
MS-DOS version 6.22
the ver. command displays the version number of MS-DOS

View contents of directory

View the contents of a directory by using the dir command. The dir command stands for "directory."
C:\>dir
A directory list appears. This is a list of all the files and subdirectories that a directory contains. All the
files and directories on your drive are stored in the root directory.

Change Root directory to the DOS directory

Write cd dos in command prompt then it changes to C:\DOS>


Here command prompt shows which directory you are in.
In this case, you know you successfully changed to the DOS directory because the command prompt
displays the directory's name. Now the current directory is DOS. View the contents of a directory

c:\dir
c:\dir/p
the p actually stands for "page"
To view the contents on next screen of information, press any key on your keyboard. Repeat this step
until the command prompt appears at the bottom of your screen.
Another helpful switch you can use with the dir command is the /w, this could view the contents of a
directory in wide format
c:\dir/w
c:\dir/p/w

Changing Back to the Root Directory

The root directory is the directory you were in before you changed to the DOS directory and now you
want to go back on root directory
c:\DOS>
write cd\
No matter which directory you are in, this command always returns you to the root directory. Now it
simply look like this
c:\>
c:\DOS\EDIT.COM
If you want to come back on DOS sub directory then it will write cd..
then prompt can back it to c:\DOS

Creating a Directory

To create a directory, you will use the md command. The md command stands for "make directory."
C:\>md fruit
You have now created a directory named FRUIT and if you want to create another directory within the
FRUIT directory named GRAPES then again write md grapes then it will look like this

68
C:\FRUIT\GRAPES> To switch back to
the FRUIT directory, type cd .. The command prompt should now look like the
following: C:\FRUIT>

Deleting a Directory

If you delete a Fruit directory


C:\FRUIT
then use the rd command.
The rd command stands for "remove directory” just write and press enter now
C:\rd fruit fruit directory is removed and it will look like this
C:\

Changing Drives

If user writes a: then prompt will to Switch drive A (Floppy Drive) and look like this
A:\> and type c:
Your command prompt should return to the following:
C:\ You change to that drive, when you type a drive letter followed by a colon. If you want to view files
on drive A then type
dir a: A list of the files on the floppy disk will appears.
Now write D: or E: or F:

Copying Files

Here you will copy the Edit.hlp and Edit.com files from the RPI directory to the FRUIT directory, You will
specify
copy c:\rpi\edit.com c:\fruit
The following message appears: 1 file(s) copied
similarly copy
c:\rpi\edit.hlp c:\fruit The
following message appears:
1 file(s) copied

Copying a Group of Files

Wildcards is used to copy a group of files from the DOS directory to the FRUIT directory.
C:\DOS>dir*.txt
To list all files ending with the extension TXT type
C:\DOS>dir *.txt
MS-DOS lists all the files that end with a TXT extension. The wildcard ignores different beginnings of the
files and focus only on the extensions now
copy C:\DOS>dir*.txt c:\fruit

69
Renaming Files

Rename a file, you will use ren command. The first is the file you want to rename, and the second is the
new name for the file. You separate the two names with a space. ren oldname newname ren
readme.txt peach.txt write c:\dir to see renamed file
The name PEACH.TXT should appear instead of the name README.TXT.

Renaming a Group of Files

To rename the files that begin with EDIT to the new name PEAR, type the following command: ren
edit.* pear.*
dir pear.* When the files were renamed, their extensions remained the same. For example,
EDIT.COM became PEAR.COM, and EDIT.HLP became PEAR.HLP.
If you want to rename extensions of several files then use wildcards to rename the files. ren *.txt *.old
To confirm that you renamed the files successfully, type the following at the command prompt: C:\dir

Deleting Files

To delete a file, you will use the del command. If you want to delete the PEAR.COM & PEAR.HLP files
then type
del pear.com del
pear.hlp
Deleting a Group of Files
To delete files in the current directory that end with the extension TXT by using wildcard.
dir *.TXT
del *.TXT When directory is empty, you can delete it by using the rd (remove directory) command
rd directory name.

Formatting a Floppy Disk

If user wants to format a floppy disk then type


format a:
During formatting the disk, MS-DOS displays the percentage of the disk that has been formatted.

When the format is complete, the following message appears:


Volume label (11
characters, ENTER for none)?
A volume label is a name for your disk. You can give your disk any name to 11 characters.

DOS Commands
cd Change directory
dir See a content & detail of files in directory
copy copy a file from one location to another, don’t forget file extension.
md Make or create a new directory
rd Remove a directory & its’ contents
ren Rename a file
help To see a detailed list of many commands.

70
help /? Shows DOS help commands
chkdsk Cchecks a disk
scandisk Check a disk (only if running dos 6 or 6.2 or up versions)
mem Shows your memory usage consumption &know about remaining free space cls Clears the
screen
date Show and allows the date to be changed
time Show and allows the time to be changed
vol Show the volume label of a disk
comp compares two files diskcomp a: b: compares two disks by several means.
*.* It means any file name and any extension regardless of length.
*. Any file name ending with the extension dir*.bat
copy *.* copies all files copy a:*.* c:\games
dir/w
directory wide across the screen dir/p directory
pause a page at a time dir/w/p wide and pause
directory
dir/o directory in order of alphabetic
dir/w/o/p All the above commands together (directory, wide, order, paused)
dir *.exe directory of files ending .exe
dir *.bat directory of files ending .bat
dir *.COM directory of files ending .com
dir t*.* directory of files beginning with the letter t
dir ta*.* directory of files starting ta
dir /s directory show file size
dir /s *.txt Files with txt extension will be display in full size.

8 Format Commands

format would not format a disk


format a: format drive a:
format b: format drive b: format a: /u formats without
saving a mirror image/backup.
format a: /q supplies a quick format
format
a: /u /q Formats quick without backup format a: /s
makes a bootable system disk

9 Delete commands

del Delete a file (don’t forget to include the file extension) del *.* Removes all files but not
directory or sub directories.
RD Removes an empty sub directory
Deltree Removes a directory sub directories and all files within them.
UNDELETE: Accidentally erased file can be retrieved

71
10 most useable Commands

cd Chang directory
dir Contents of directory
copy Copy files/contents
del remove file(s)
edit change file(s)
move cut file(s)

ren rename file(s)


deltree remove directory and sub directories
cls clear screen forma clear and form a floppy or disk

72
Chapter#3

Unix/Linux Implementation
Topic to Learn
3.1 Describe UNIX/LINUX Development 3.6 Unix/Linux Help System
3.2 Design principle of UNIX/LINUX 3.7 Unix/Linux File System
3.3 Log in and Log out in system 3.8 Directory structure, Name and File sys
3.4 configure user own environment 3.9 Creating and deleting File and Directory
3.5 Change and manage password 3.10 Set permission on File and Directory

3.1) UNIX/LINUX Development

3.1.1) What is UNIX?


UNIX is an operating system which was first developed in the 1960s. By operating system, we
mean the suite of programs which make the computer work. It is a stable, multi-user,
multitasking system for servers, desktops and laptops. It is only command based.

3.1.2) History of UNIX

UNIX has been a popular OS for more than two decades because of its multi-user, multi-tasking
environment, stability, portability and powerful networking capabilities.

Fig. 3.1: Simplified UNIX Family Tree

In the late 1960s, researchers from General Electric, MIT and Bell Labs launched a joint project
to develop an ambitious multi-user, multi-tasking OS for mainframe computers known as
MULTICS (Multiplexed Information and Computing System). MULTICS failed (for some MULTICS

73
enthusiasts "failed" is perhaps too strong a word to use here), but Ken Thompson writing a
simpler operating system himself, known as UNICS (Uniplexed Information and Computing
System). Those days CPU power and memory is short, so command of this OS is suitable for
those computer, this OS use short command, less space, time etc. hence the tradition of short
UNIX commands we use today, e.g. ls, cp, rm, mv etc.

Ken Thompson the author of the first C compiler in 1973. They rewrote the UNIX kernel in C -
and released the Fifth Edition of UNIX to universities in 1974. UNIX development into two main
branches: SYSV (System 5) and BSD (Berkeley Software Distribution).

3.1.3) Architecture of the Linux OS

Linux has all of the components of a typical OS

1) Kernel

A 'kernel' is the central or Core component of most computer operating systems; it act as a
bridge between application and the data processing performed at the hardware level. The
kernel's responsibilities include managing the system's resources (the communication
between hardware and software components).
A computer kernel interfaces between the three major computer hardware components,
providing services between the application/user interface and the CPU, memory and other
hardware I/O devices. The kernel is responsible for:

• Process management for application execution


• Memory management, allocation and I/O
• Device management through the use of device
drivers
• System calls control, which is essential for the
execution of kernel services.

When an OS is loaded into memory, the kernel loads first and remains in memory until the OS is
shut down again.

2) Shells and GUIs

A shell is software that provides an interface for an operating system's users to provide access
to the kernel's services. OR
A shell is a user interface for access to an operating system services.
On Unix-based or Linux-based operating systems, a shell can be invoked through the shell
command in the command line interface (CLI), allowing users to direct operations through
computer commands, text or script.
UNIX shells are divided into four categories:
• Bourne-like shells
• C shell-like shells

74
• Nontraditional shells
• Historical shells
NOTE: diagram and more detail in chapter 6
3) System Utilities
A program that performs a very specific task, usually related to managing system resources.
Operating system contains a number of utilities for managing disk drivers, printers, and other
devices.
4) Application programs
An Application software or group of program that is designed for end user. It is used to perform
various applications on computer, also known as application package.
Ms Word, Access Photoshop is the example of Application software.

Fig 3.2 about Architecture of Unix/Linux OS

3.2) Design principle of UNIX/LINUX

Linux is a Multiuser Multitasking system with a full set of UNIX-compatible tools. Network

compatible

Main design goals are speed, efficiency, flexibility and standardization.

75
Fig 3.3 Desgin principle of unix/linux

3.3) Log in and Log out in system

3.3.1) Login UNIX


When you first connect to a UNIX system, you usually see a prompt such as the following −
login:

To log in
• Have your user id (user identification) and password ready. Contact your system
administrator if you don't have these yet.

• Type your user id at the login prompt, and then press ENTER. Your user id is
casesensitive, so be sure you type it exactly as your system administrator instructed.

• Type your password at the password prompt, then press ENTER. Your password is also
case-sensitive.

• If you provided correct user id and password then you would be allowed to enter into
the system. Read the information and messages that come up on the screen something
as below.
login : amrood amrood's
password:
Last login: Sun Jun 14 09:32:32 2009 from 62.61.164.73
$

You would be provided with a command prompt ( sometime called $ prompt ) where you would
type your all the commands. For example to check calendar you need to type calcommand as
follows −

76
$ cal
June 2009
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20 21
22 23 24 25 26 27
28 29 30
$
3.3.2) Logging Out
When you finish your session, you need to log out of the system to ensure that nobody else
accesses your files while masquerading as you.

To log out
Just type logout command at command prompt, and the system will clean up everything
and break the connection

3.4) Configure user own environment

It is lab… practical work…

3.5) Change and manage Password


All UNIX systems require passwords to help ensure that your files and data remain your own and
that the system itself is secure from hackers and crackers. Here are the steps to change your
password −

• To start, type passwd at command prompt as shown below.

• Enter your old password the one you're currently using.

• Type in your new password. Always keep your password complex enough so that no
body can guess it. But make sure, you remember it.

• You would need to verify the password by typing it again.

77
$ passwd
Changing password for amrood
(current) Unix password:******
New UNIX password:*******
Retype new UNIX password:*******
passwd: all authentication tokens updated successfully $

Note − I have put stars (*) just to show you the location where you would need to enter the
current and new passwords otherwise at your system, it would not show you any character when
you would type.

3.6) UNIX/Linux Help system

In LINUX/UNIX whenever you need help with a command type “man” followed by the command
name.
• The Syntax is man [options] command
• Common options are

-
matches.
• We can use help command also. Command - -help

3.7) UNIX/Linux File System

All data in UNIX is organized into files. All files are organized into directories. These directories
are organized into a tree-like structure called the file system.

When you work with UNIX, one way or another you spend most of your time working with files.
This tutorial would teach you how to create and remove files, copy and rename them, create links
to them etc.

In UNIX there are three basic types of files −

• Ordinary Files − an ordinary file is a file on the system that contains data, text, or
program instructions. In this tutorial, you look at working with ordinary files.

• Directories − Directories store both special and ordinary files. For users familiar with
Windows or Mac OS, UNIX directories are equivalent to folders.

78
• Special Files − some special files provide access to hardware such as hard drives,
CDROM drives, modems, and Ethernet adapters. Other special files are similar to aliases
or shortcuts and enable you to access a single file using different names.

3.8) Directory structure and Names

bin home lib etc dev usr proc root ver tmp

User 01 User 02 local X11R6 bin

Fig 3.4 Directory structure

bin

Important Directories

1) /: The root directory, the top-level directory in the FHS (File system Hierarchy) or Directory
structure. All other directories are sub directories of root. Every single file and directory start
from the root directory. Only root user has privilege under this directory. 2) /bin: user
binaries

This contains files that are essential for correct operation of the system.
These are available for use by all users.

• Contains binary executables.


• Common Linux commands you need to use in single-user mode are located under this
directory.
• Commands used by all user of the system are located here. For example: Ps, ls, ping,
grep, cp.

3) /sbin: system binaries

Sbin mean’s system binaries which are only expected to be used by the super user.

79
• Also Contains executables
• Linux commands located under this directory are used typically by system administrator.
• For example: iptable, reboot, fdisk, ipconfig etc..

4) /mnt: mount Directory

Provides a location for mounting devices such as remote file system and removable media.

5) /home: home directories

This is where user home directories are stored.

• Home directories for almost all user to store their personal files
• For example: /home/ABC

6) /var: Variable files

This directory is used to store files which change frequently, and must be available to be written
to:

• Var stand for variable file


• This include- system log file(/var/log);
• packages and database files(/var/lib);
• Email (/var/email); print queues (/var/spool).

7) /tmp: temporary files

Directory that contains temporary files created by system and users, files under this directory
are deleted when system is rebooted.

8) /etc: configuration filesss

Various system configuration files are stored here.

• This also contain startup and shutdown shell scripts used to start/stop individual
programs.
• For example: /ete/resotv.conf
/etc/logrotate.conf

9) /dev: device file

This contains various devices as file, e.g. hard disk, CD ROM drive etc.

• Contains device files


• These include terminal device, USB, or any device attached to the system

80
• For example: /dev/tty
/dev/usbmon0.

10) /boot: boot loader files

Includes Linux startup files, including the Linux kernel.

11) /usr: user programs

Contain user documentation, games, graphical files, libraries(lib) etc.

12) /proc: process information

This is a pseudo file system contains information about running process. (E.g. proc/pid) it
contains information about system process.

13) /lib: system libraries

Contains libraries files that supports the binaries located under /bin and /sbin. Library file name
are either id* or lib*.so*

14) /svr: service data

Contains server specific services related data,e.g. /srv/cvs

15) /opt: optional add-on applications

Opt stands for optional, contains add-on applications from individual vendors. Add-on
applications should be installed under either /opt or /opt/sub-directory.

16) /media: Removable media device

Temporary mount directory for removable device.

For example: media/cdrom for CDROM

Media/floppy for FLOPPY DRIVE

Media/cdrecoder for CDWriter

81
3.9) Creating and deleting File and Directory

3.9.1) Creating Files


You can use vi editor to create ordinary files on any Unix system. You simply need to give
following command −
$ vi filename
Above command would open a file with the given filename. You would need to press key I to
come into edit mode. Once you are in edit mode you can start writing your content in the file as
below −
This is unix file....I created it for the first time.....
I'm going to save this content in this file.
Once you are done, do the following steps −

Press key esc to come out of edit mode.

Press two keys Shift + ZZ together to come out of the file completely.

Now you would have a file created with filemame in the current directory.
$ vi filename
$
3.9.2) Deleting File

To delete an existing file use the rm command. Its basic syntax is −


$ rm filename

Caution: It may be dangerous to delete a file because it may contain useful information. So be
careful while using this command. It is recommended to use -i option along with rm command.

Following is the example which would completely remove existing file filename:
$ rm filename
$
You can remove multiple files at a tile as follows −

$ rm filename1 filename2 filename3


$

82
3.9.3) Creating Directories
Directories are created by the following command −
$mkdir dirname

Here, directory is the absolute or relative pathname of the directory you want to create. For
example, the command −
$mkdir mydir
$
Creates the directory mydir in the current directory. Here is another example −
$mkdir /tmp/test-dir
$
This command creates the directory test-dir in the /tmp directory. The mkdir command
produces no output if it successfully creates the requested directory.

If you give more than one directory on the command line, mkdir creates each of the directories.
For example −
$mkdir docs pub
$
Creates the directories docs and pub under the current directory.

3.9.4) Removing Directories


Directories can be deleted using the rmdir command as follows −
$rmdir dirname
$
Note − To remove a directory make sure it is empty which means there should not be any file or
sub-directory inside this directory.

You can create multiple directories at a time as follows −


$rmdir dirname1 dirname2 dirname3
$
Above command removes the directories dirname1, dirname2, and dirname2 if they are empty.
The rmdir command produces no output if it is successful.

3.9.5) Changing Directories


You can use the cd command to do more than change to a home directory: You can use it to
change to any directory by specifying a valid absolute or relative path. The syntax is as follows

83

$cd dirname
$

Here, dirname is the name of the directory that you want to change to. For example, the
command −
$cd /usr/local/bin
$
Changes to the directory /usr/local/bin. From this directory you can cd to the directory
/usr/home/amrood using the following relative path −
$cd ../../home/amrood
$
3.9.6) Renaming Directories
The mv (move) command can also be used to rename a directory. The syntax is as follows −
$mv olddir newdir
$

You can rename a directory mydir to yourdir as follows −


$mv mydir yourdir
$

3.10) Set permission on File and Directory

File ownership is an important component of UNIX that provides a secure method for storing
files. Every file in UNIX has the following attributes −

• Owner permissions − the owner's permissions determine what actions the owner of the
file can perform on the file.

• Group permissions − the group's permissions determine what actions a user, who is a
member of the group that a file belongs to, can perform on the file.

• Other (world) permissions − the permissions for others indicate what action all other
users can perform on the file.

3.10.1) The Permission Indicators


While using ls -l command it displays various information related to file permission as follows −

84
$ls -l /home/amrood
-rwxr-xr-- 1 amrood users 1024 Nov 2 00:10 myfile
drwxr-xr--- 1 amrood users 1024 Nov 2 00:10 mydir

Here first column represents different access mode ie. permission associated with a file or
directory.

The permissions are broken into groups of threes, and each position in the group denotes a
specific permission, in this order: read (r), write (w), execute (x) −

• The first three characters (2-4) represent the permissions for the file's owner. For example
-rwxr-xr-- represents that onwer has read (r), write (w) and execute (x) permission.

• The second group of three characters (5-7) consists of the permissions for the group to
which the file belongs. For example -rwxr-xr-- represents that group has read (r) and
execute (x) permission but no write permission.

• The last group of three characters (8-10) represents the permissions for everyone else.
For example -rwxr-xr-- represents that other world has read (r) only permission.
3.10.2) File Access Modes
The permissions of a file are the first line of defense in the security of a Unix system. The basic
building blocks of Unix permissions are the read, write, and execute permissions, which are
described below −

1. Read
Grants the capability to read ie. view the contents of the file.

2. Write
Grants the capability to modify, or remove the content of the file.

3. Execute
User with execute permissions can run a file as a program.

3.10.3) Directory Access Modes


Directory access modes are listed and organized in the same manner as any other file. There are
a few differences that need to be mentioned:

1. Read
Access to a directory means that the user can read the contents. The user can look at the
filenames inside the directory.

85
2. Write
Access means that the user can add or delete files to the contents of the directory.

3. Execute
Executing a directory doesn't really make a lot of sense so think of this as a traverse permission.

A user must have execute access to the bin directory in order to execute ls or cd command.

3.10.4) Changing Permissions


To change file or directory permissions, you use the chmod (change mode) command. There are
two ways to use chmod: symbolic mode and absolute mode.

Using chmod in Symbolic Mode


The easiest way for a beginner to modify file or directory permissions is to use the symbolic mode.
With symbolic permissions you can add, delete, or specify the permission set you want by using
the operators in the following table.

Chmod operator Description


+ Adds the designated permission(s) to a file or directory.
- Removes the designated permission(s) from a file or directory.
= Sets the designated permission(s).
Here's an example using testfile. Running ls -1 on testfile shows that the file's permissions are as
follows −
$ls -l testfile
-rwxrwxr-- 1 amrood users 1024 Nov 2 00:10 testfile
Then each example chmod command from the preceding table is run on testfile, followed by ls
-l so you can see the permission changes −
$chmod o+wx testfile
$ls -l testfile
-rwxrwxrwx 1 amrood users 1024 Nov 2 00:10 testfile
$chmod u-x testfile
$ls -l testfile
-rw-rwxrwx 1 amrood users 1024 Nov 2 00:10 testfile
$chmod g=rx testfile
$ls -l testfile
-rw-r-xrwx 1 amrood users 1024 Nov 2 00:10 testfile

86
Here's how you could combine these commands on a single line:
$chmod o+wx,u-x,g=rx testfile
$ls -l testfile
-rw-r-xrwx 1 amrood users 1024 Nov 2 00:10 testfile
Using chmod with Absolute Permissions
The second way to modify permissions with the chmod command is to use a number to specify
each set of permissions for the file.
Number Octal Permission Representation Ref
0 No permission ---
1 Execute permission --x
2 Write permission -w-
3 Execute and write permission: 1 (execute) + 2 (write) = 3 -wx
4 Read permission r--
5 Read and execute permission: 4 (read) + 1 (execute) = 5 r-x
6 Read and write permission: 4 (read) + 2 (write) = 6 rw-
7 All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 rwx

Each permission is assigned a value, as the following table shows, and the total of each set of
permissions provides a number for that set.

Here's an example using testfile. Running ls -1 on testfile shows that the file's permissions are as
follows −
$ls -l testfile
-rwxrwxr-- 1 amrood users 1024 Nov 2 00:10 testfile
Then each example chmod command from the preceding table is run on testfile, followed by ls -
l so you can see the permission changes −

87
$ chmod 755 testfile
$ls -l testfile
-rwxr-xr-x 1 amrood users 1024 Nov 2 00:10 testfile
$chmod 743 testfile
$ls -l testfile
-rwxr---wx 1 amrood users 1024 Nov 2 00:10 testfile
$chmod 043 testfile
$ls -l testfile
----r---wx 1 amrood users 1024 Nov 2 00:10 testfile
3.10.5) Changing Owners and Groups
While creating an account on Unix, it assigns a owner ID and a group ID to each user. All the
permissions mentioned above are also assigned based on Owner and Groups.

Two commands are available to change the owner and the group of files −

• chown − The chown command stands for "change owner" and is used to change the
owner of a file.

• chgrp − The chgrp command stands for "change group" and is used to change the group
of a file.

3.10.6) Changing Ownership


The chown command changes the ownership of a file. The basic syntax is as follows −
$ chown user filelist

The value of user can be either the name of a user on the system or the user id (uid) of a user
on the system.

Following example −
$ chown amrood testfile
$
Changes the owner of the given file to the user amrood.

NOTE: The super user, root, has the unrestricted capability to change the ownership of a any
file but normal users can change only the owner of files they own.

88
3.10.7) Changing Group Ownership
The chrgp command changes the group ownership of a file. The basic syntax is as follows −
$ chgrp group filelist

The value of group can be the name of a group on the system or the group ID (GID) of a group
on the system.

Following example −
$ chgrp special testfile
$

89
Chapter#4

Unix/Linux Command
Topic to Learn
4.1 Command related to user and file search 4.5 Print File using Linux/Unix commands
4.2 Process job related Command 4.6 Linux/Unix Scheduling Commands
4.3 Manipulates file and directories 4.7 Text Processing Commands
Commands 4.8 Storage and Status Commands
4.4 Search and view Content of File
Commands

NOTE: here maximum commands are given; this is responsibility of your teachers that they have
to prepare the students according to course content.

Command Description

a2p Command used to create a Perl script from an awk script.

ac Prints statistics about user connection time.

access The system function which checks a user's permissions to access a file.

addgroup Add a group to the system.

adduser Add a user to the system.

agrep Version of the grep utility which also matches approximate patterns.

alias Create an alternate name for a command.

apropos Search the manual pages for a keyword or regular expression.

apt-cache Search for information about software packages available through APT.

apt-get Command line tool for managing APT software packages.

aptitude Text-based front end for the APT package management system.

ar Create, modify, and extract files from archives.


arch Display the architecture of the system.

arp Manipulate the system ARP cache.

as An assembler.

aspell An interactive spell checker.

at Schedule a command to be run at a certain time.

awk Interpreter for the AWK text processing programming language.

basename Deletes any specified prefix from a string.

bash The Bourne Again shell command interpreter.

bc Command used for A calculator.

bdiff Identify the differences between two very big files.

bfs An editor which can load very large files.

87
bg Continues a program running in the background.

biff This command is used for enable or Display incoming main notification.

break Break out of a while, for, foreach, or until loop.

bs A Linux version of the popular game "Battleship."

bye This command most often used alias for exit command

cal This command is used for Display the system calendar.

calendar Display appointments and reminders.

cancel This command is used for cancel for print job.

cat Output or show the contents of a file.

cc Compiler of the C programming language.

cd Change the working directory.

cfdisk A more user-friendly version of the fdisk disk partitioning utility.

chdir This command is used for changing the working directory.

checkeq Language processor which assists in describing equations.

checknr Check nroff and troff files for errors.

chfn Change a user's finger information.

chgrp Change the group ownership of files and directories.

chkey Change the secure RPC key pair on SunOS.

chmod Change the permissions of files and directories.

chown Change the ownership of files and directories.

chroot Run a command or shell from another directory, and treat that directory as root.

chsh Change login shell.


cksum Calculate and display a CRC for files.

clear Clears the screen.

cmp Compare two files byte by byte.

col Filter reverse linefeeds.

comm Compare two sorted files line by line.

compress Compress a file or files.

continue Break out of a while, for, foreach, or until loop.

cp Copy files and directories.

cpio Copy files to or from archives.

crontab View and edit a list of jobs for the system to run at regular intervals.

crypt System function used to encrypt passwords.

csh The C shell command interpreter.

csplit Split files based on a defined context.

ctags Create tag files for source code.

cu Calls up another system.

curl Transfer data to or from a server.

cut Cut out selected fields of each line of a file or files.

date Output the current date and time.

dc An arbitrary-precision arithmetic package.

dd Copy and convert the encoding of files.

88
delgroup Remove a group from the system.

deluser Remove a user from the system.

depmod Generate a list of kernel module dependences and associated map files.

deroff Remove nroff/troff, tbl, and eqn constructs from files.

df Report the amount of available disk space on file systems.

dhclient Communicate with a DHCP server to obtain a dynamic IP address.

diff Identify the differences between two files.

dig DNS lookup utility.

dircmp Compare the contents of two directories, listing unique files.

dirname Strip the filename from a pathname, leaving only the directory component.

dmesg Print or control the kernel ring buffer.

dos2unix Convert text files between DOS and Unix formats.

dpkg Query, install, remove, and maintain Debian software packages and their dependencies.

dpost Translate files created by troff into PostScript under Solaris.

du Report the amount of disk space used by a file or files.

echo Display text after echo to the terminal.

ed Line oriented text editor.

edit A text editor.

egrep Filter text which matches an extended regular expression.

eject Eject removable media.

elm A mail client.

emacs A highly extensible text editor.


enable Enable and disable LP printers.

env Report the value of environment variables.

eqn Language processor for describing equations.

ex Line-editor mode of the vi text editor.

exit Exit the command shell.

expand Expand copies of files.

expr Evaluate arguments as an expression.

fc List, edit, or re-execute commands from the command history.

fdisk A disk portioning utility.

fg Continues a stopped job by running it in the foreground.

fgrep Filter text which matches a fixed-character string.

file Determine a file's type.

find Find files within a directory hierarchy.

findsmb List information about machines networked with the Samba protocol.

finger List information about a user.

fmt Simple text formatters.

fold Filter for folding lines.

for Execute a set of commands in a repeating loop.

foreach Execute a set of commands once for each of a given set of input items.

free Display the amount of free and used memory.

89
fsck Check and repair a Linux file system.

ftp Enable FTP access to another terminal.

fuser Identify processes using files or sockets.

gawk GNU's version of the AWK programming language.

getfacl Display file access control lists.

gethostname System call to get the hostname of the current processor.

gpasswd Administer /etc/group and /etc/gshadow.

gprof Display call graph profile data.

grep Find text within a file.

groupadd Add a group to the system.

groupdel Remove a group from the system.

groupmod Modify a group definition.

gunzip Uncompressed the specified files.

gview A programmer text editor

gvim A programmer text editor

gzip Compressed the specified files.

halt Stop the computer.

hash Access internal hash tables under Solaris.

hashstat Evaluate the effectiveness of internal hash tables under Solaris.

head Display the first lines of a file.

help Display help for built-in shell commands.

history Display the command history.


host Convert a host name to an IP address and vice versa.

hostid Print the numeric identifier for the current host.

hostname Set or print the hostname of system.

id Display real and effective user and group IDs.

ifconfig View or modify the configuration of network interfaces.

ifdown Disable a network interface.

ifquery Parse information about a network interface.

ifup Enable a network interface.

info Read Info documents.

init The parent of all processes on the system.

insmod Insert a module into the Linux kernel.

iostat Report CPU and I/O statistics for devices and partitions.

ip Display and manipulate information about routing, devices, policy routing and tunnels.

isalist Display the native instruction sets available on a Solaris system.

iwconfig Configure a wireless network interface.

jobs List the status of all running jobs.

join Join the lines of two files which share a common field of data.

keylogin Decrypt a user's secret key on SunOS.

kill Cancel a job.

killall Kill processes by name.

90
ksh The Korn shell command interpreter.

last Display a listing of the most recently logged-in users.

ld Link editor for object files.

ldd List dynamic dependencies of executable files or shared objects.

less Scrolling text viewer.

lex Generate programs for performing lexical tasks.

link Create a hard link to a regular file.

ln Create a link, or a symbolic link, to a file or directory.

lo Exit the command shell.

locate Search a local database to find files by name.

login Sign into a new system.

logname Return a user's login name.

logout Exit the command shell.

losetup Set up and control loop devices.

lp Print a file on the System V operating system.

lpadmin Configure LP print services.

lpc Control line printers.

lpq List the status of available printers.

lpr Submit print requests.

lprm Remove requests from the print queue.

lpstat List the status of the LP print services.

ls List the contents of a directory or directories.


lsmod Show the status of Linux kernel modules.

lsof List open files.

lzcat View compressed .lzma files.

lzma Compress files to .lzma file.

mach Display the processor of the current system.

mail Read, compose, and manage mail.

mailcompat Provide SunOS 4.x compatibility for the Solaris mailbox format.

mailx Process mail messages.

make Automatically build executable programs and libraries from source code.

man Display the manual page of a given command.

merge Performs a merge of the contents of three files.

mesg Control if (non-root) users can send messages to your terminal.

mii-tool View and manipulate the status of a media-independent interface.

mkdir Create a directory.

mkfs Build a Linux file system, usually a hard disk partition.

mkswap Set up a Linux swap area.

modinfo Show information about a Linux kernel module.

modprobe Add and remove modules from the Linux kernel.

more Display text one screen at a time.

mount Mount a file system so that its data may be accessed.

91
mt Control magnetic tapes.

mv Move files and directories from one location to another, and optionally rename them.

myisamchk Check, repair, optimize, or fetch information about a MySQL database.

mysql An open-source relational database management system.

mysqldump A tool for backing up or transferring MySQL databases.

nc

neqn Language processor for describing equations.

netstat Show network status.

newalias Install new elm aliases.

newform Change the format of a text file.

newgrp Log into a new group.

nice Invoke a command with an altered scheduling priority.

niscat Display NIS+ tables and objects.

nischmod Change access rights on a NIS+ object.

nischown Change the owner of a NIS+ object on a system running Solaris.

nischttl Change the time to live value of a NIS+ object.

nisdefaults Display NIS+ default values.

nisgrep Utilities for searching NIS+ tables.

nismatch Utilities for searching NIS+ tables.

nispasswd Change NIS+ password information.

nistbladm Administer NIS+ tables.

nl Number the lines in a file.


nmap Network exploration tool and security port scanner.

nohup Run a command even if the session is disconnected or the user logs out.

nroff Format documents for terminal display or line-printer.

nslookup Query a name server for information about a remote host.

od Dump files in octal and other formats.

on Execute a command on a remote system, but with the local environment.

onintr Built-in shell function which responds to hardware interrupts.

optisa Determine which instruction set is optimal to use on a Solaris system.

pack Compress files using a Huffman algorithm.

pagesize Display the size of a page of memory in bytes.

parted A disk partition manipulation program.

partprobe Inform the operating system about changes to the partition table.

passwd Change a user's password.

paste Merge corresponding lines of files.

pax Read and write file archives, and copy directory hierarchies.

pcat Print the uncompressed contents of a compressed file.

perl Interpreter for the Perl programming language.

pg Browse page by page through text files.

pgrep Examine the active processes on the system and reports the process IDs of the processes.

pico A simple text editor.

92
pine Command line program for internet news and email.

ping Send ICMP ECHO_REQUEST packets to network hosts.

pkill Send a signal to any process whose attributes match a regular expression.

poweroff Stop the computer.

pr Format a text file for printing.

printenv Print all or part of the environment.

printf Write formatted output.

priocntl Display or set scheduling parameters of a processes under Solaris.

ps Report the status of a process or processes.

pstree Display processes in a tree format.

pvs Display the internal version information of dynamic objects within an ELF file.

pwd Print the name of the working directory.

quit Exit the command shell.

rcp Copy files to or from a remote system.

readlink Print the value of a symbolic link or canonical file name.

reboot Stop the computer.

red Line oriented file editor.

rehash Recomputed internal hash tables under Solaris.

rename Rename files.

renice Alter the priority of running processes.

repeat Execute a set of commands in a repeating loop.

replace A string-replacement utility.


rgview A programming text editor.

rgvim A programming text editor.

rlogin Establish a remote connection from your terminal to a remote machine.

rm Delete files.

rmdir Remove a directory.

rmmod Remove a module from the Linux kernel.

rn A newsgroup reader.

route Display and manipulate the IP routing table.

rpcinfo Report information about Remote Procedure Calls.

rsh Execute a command on a remote shell.

rsync Faster, flexible replacement for rcp.

rview A programming text editor.

rvim A programming text editor

s2p Convert a sed script into a Perl script.

sag Graphically displays system activity data generated by sar.

sar Display CPU activity.

scp Copy files securely over a network connection.

screen Screen manager with VT100/ANSI terminal emulation.

script Record everything printed on your screen.

sdiff Compare two files, side-by-side.

93
sed A utility for filtering and transforming text.

sendmail Send mail.

service Run a System V init script.

set Set the value of an environment variable.

setenv Set the value of an environment variable.

setfacl Modify the access control list of a file or files.

sethostname System calls or set the hostname of the current processor.

sfdisk A low-level disk partitioning program.

sftp Secure file transfer protocol.

sh The Bourne shell command interpreter.

shred Delete a file securely, first overwriting it to hide its connection.

shutdown Turn off the computer.

sleep Wait a given number of seconds.

slogin Login to a remote system securely.

smbclient An ftp-like client for accessing SMB/CIFS resources on servers.

sort Sort the lines in a text file.

spell A spell checker.

split Split a file into pieces.

startx Start an X Window System session.

stat Display the status of a file or file system.

stop Stop a running job.

strftime Format strings that represent the system date and time.
strip Discard symbols from object files.

stty Set options for your terminal display.

su Become the super user or another user.

sudo Execute a command as the super user.

swapoff Disable a Linux swap area.

swapon Enable a Linux swap area.

sysinfo Get and set system information strings.

sysklogd Linux system logging utilities.

tabs Set tab stops on a terminal.

tac Output the contents of files in reverse order.

tail Print the last lines of a text file.

talk Talk with other logged in users.

tar Copy files to, or restore files, an archives.

tbl Preprocessor which formats tables for nroff or troff.

tcopy Copy a magnetic tape.

tcpdump Capture raw network traffic.

tcsh A command-line shell similar to csh, with some additional features.

tee Read from an input and write to a standard output or file.

telinit Process control initialization.

telnet Connect to a remote system using the telnet protocol.

94
test Check file types and compare values.

time Report how long it takes for a command to execute.

timex Report process data and system activity for a specified command.

todos Convert text files between DOS and Unix formats.

top Display Linux task.

touch Update the timestamp of a file or directory.

tput Initialize a terminal or query the terminfo database.

tr Translate one set of characters to another.

traceroute Print the route that packets take to a remote host.

trap A function which "traps" signals and interrupts, and reacts to them.

tree List the contents of a file hierarchy visually in a tree format.

troff Typeset or format documents.

tty Print the file name of the terminal connected to standard input.

ul Translate underscores to underlining.

umask Get or set the file mode creation mask.

umount Unmount a file system, making its data inaccessible.

unalias Remove an alias.

uname Print information about the current system.

uncompress Uncompressed from compressed files.

unhash Remove internal hash table.

uniq Identify, and optionally filter out, repeated lines in a file.

unlink Remove a file.


unlzma Decompress .lzma files.

unpack Expand a compressed file.

until Execute a set of commands until a certain condition is true.

unxz Decompress .xz files.

unzip List, test and extract compressed files in a zip archive.

uptime Display information about how long the system has been running.

useradd Add a user to the system.

userdel Remove a user from the system.

usermod Modify a user's account.

vacation Reply to mail automatically.

vgrind "Grind" nice program listings.

vi Text editor based on the visual mode of ex.

view A programming text editor.

vim A programming text editor.

vipw Safely edit the password file.

visudo Safely edit the sudoers file.

vmstat Report statistics about virtual memory usage.

w Show who is logged on and what they are doing.

wait Await process completion.

wall Send a message to all logged-in users.

95
wc Display a count of lines, words, and characters in a file.
wget Download files via HTTP or FTP.
whatis Display short manual page descriptions.
whereis Locate the binary, source, and manual page files for a command.
which Locate the binary executable of a command.
while Execute a set of actions while a certain condition is true.
who Report which users are logged in to the system.
whoami Print your effective userid.
whois An internet user name directory service.
write Send a message to another user.
X Executable of the X Window System.
Xorg The executable of the X Window System server.
xargs Build and execute complex commands, and execute them on
multiple files.
xfd Display all the characters in an X font.
xhost Server access control program for X.
xinit The initializer of the X Window System.
xlsfonts Display X font lists.
xrdb An X server resource database utility.
xset A user preference utility for X.
xterm A terminal emulator for X.
xz Compress files to .xz files.
xzcat View compressed .xz files.
yacc "Yet another compiler-compiler."
yes Repeatedly output a given string, or the letter "y".
yppasswd Change a network password in an NIS database.
yum An interactive rpm-based package manager.
zcat Print the uncompressed contents of compressed files.
zip A compression and archiving utility.
zipcloak Encrypt files within an existing zip archive.
zipinfo Display technical information about a zip file.
zipnote View, add, or modify a zip file's comments.
zipsplit Split a single zip archive into a set of smaller zip files.

108
Chapter#5

Text Processing
Topic to Learn
5.1 Invoke Vi editor
5.2 Compose Text using vi
5.3 Modes of vi editor

5.1) Invoke VI editor

VI is a screen display-oriented text editor. It works with current display screen, line,
character, graph etc… Detail

vi (pronounced "vee-eye", short for visual, or perhaps vile) is a display-oriented text editor based
on an underlying line editor called ex. Although beginners usually find vi somewhat awkward to
use, it is useful to learn because it is universally available (being supplied with all UNIX systems).
It also uses standard alphanumeric keys for commands, so it can be used on almost any terminal
or workstation without having to worry about unusual keyboard mappings.
System administrators like users to use vi because it uses very few system resources.

To start vi, enter:

$ vi filename

Where filename is the name of the file you want to edit. If the file doesn't exist, vi will create it for
you.

5.2) Compose Text using vi

5.2.1) Basic text input and Navigation in VI

The main feature that makes VI unique as an editor is its mode-based operation. VI has two
modes: command mode and input mode. In command mode, characters you type perform
actions (e.g. moving the cursor, cutting or copying text, etc.) In input mode, characters you type
are inserted or overwrite existing text.

When you begin vi, it is in command mode. To put vi into input mode, press i (insert). You can then
type text which is inserted at the current cursor location; you can correct mistakes with the

109
backspace key as you type. To get back into command mode, press ESC (the escape key). Another
way of inserting text, especially useful when you are at the end of a line is to press a (append).

In command mode, you are able to move the cursor around your document. h, j, k and l move
the cursor left, down, up and right respectively (if you are lucky the arrow keys may also
work). Other useful keys are ^ and $ which move you to the beginning and end of a line
respectively. w skips to the beginning of the next word and b skips back to the beginning of the
previous word. To go right to the top of the document, press 1 and then G. To go the bottom of
the document, pressG. To skip forward a page, press ^F, and to go back a page, press ^B. To go
to a particular line number, type the line number and press G, e.g. 55G takes you to line 55.

To delete text, move the cursor over the first character of the group you want to delete and
make sure you are in command mode. Press x to delete the current character, dw to delete the
next word, d4w to delete the next 4 words, dd to delete the next line, 4dd to delete the next 4
lines, d$ to delete to the end of the line or even dG to delete to the end of the document. If you
accidentally delete too much, pressing u will undo the last change.

Occasionally you will want to join two lines together. Press J to do this (trying to press backspace
on the beginning of the second line does not have the intuitive effect!)

5.2.2) Moving and copying text in vi

vi uses buffers to store text that is deleted. There are nine numbered buffers (1-9) as well as
the undo buffer. Usually buffer 1 contains the most recent deletion, buffer 2 the next recent,
etc.

To cut and paste in vi, delete the text (using e.g. 5dd to delete 5 lines). Then move to the line
where you want the text to appear and press p. If you delete something else before you paste,
you can still retrieve the delete text by pasting the contents of the delete buffers. You can do
this by typing "1p, "2p, etc.

To copy and paste, "yank" the text (using e.g. 5yy to copy 5 lines). Then move to the line where you
want the text to appear and press p.

5.2.3) Searching and replacing text in vi

In command mode, you can search for text by specifying regular expressions. To search
forward, type / and then a regular expression and press . To search backwards, begin with a
? instead of a /. To find the next text that matches your regular expression press n.

To search and replace all occurences of pattern1 with pattern2, type :%s/pattern1/pattern2/g
. To be asked to confirm each replacement, add a c to this substitution command. Instead
of the % you can also give a range of lines (e.g. 1,17) over which you want the substitution to
apply.

110
5.2.4) Other useful vi commands

Programmers might like the :set number command which displays line numbers (:set
nonumber turns them off).

To save a file, type :w . To save and quit, type :wq or press ZZ. To force a quit without saving
type :q! .

To start editing another file, type :e filename .

To execute shell commands from within vi, and then return to vi afterwards, type :!shell command
. You can use the letter % as a substitute for the name of the file that you are editing (so :!echo
% prints the name of the current file).

Repeats the last command.

5.2.5) Quick reference for vi

Inserting and typing text:


i insert text (and enter input mode)
$a append text (to end of line)
ESC re-enter command mode
J join lines

Cursor movement:
h left j
down k
up
l right
^ beginning of line
$ end of line
1G top of document
G end of document
<n> G go to line <n>
^F page forward ^B
page backward w
word forwards b
word backwards

Deleting and moving text:


Backspace delete character before cursor
(only works in insert mode) x delete
character under cursor dw delete
word
dd delete line (restore with p or P)

111
<n> dd delete n lines

d$ delete to end of line dG


delete to end of file
yy yank/copy line (restore with p or P) <n>
yy yank/copy <n> lines

Search and replace:


%s/<search string>/<replace string>/g

Miscellaneous:
u undo :w
save file
:wq save file and quit
ZZ save file and quit
:q! Quit without saving

5.2.6) Short note on some other editor

1) “Ed” editor

Ed – A line-oriented text editor. It operates in the line mode. You can give commands to the
editor to perform various operations on a line. Including:

• Line can be printed(display)


• Line can be changed
• Line can be inserted
• Line can be deleted
• Line can be copy etc…

Mean’s ed editor only working with lines. It is most basic UNIX editor, and is found in every
UNIX system.

Using “ED”

The ed text editor works by using a buffer an in memory storage area where the actual text resides
until you explicitly store the text in a file.

Modes

Command mode: is what you get by default. In this mode, ed interprets anything that type as a
command.

Text-input mode: enables you to enter text into the buffer. You can enter input mode by using the
commands a (append), c (change), i (insert).

112
2) GNU emacs

• GNU is an extensible, customizable text editor.

• It is self documenting real time display editor.


• 2000 built in command.
• Developed in MIT AL LAB in 1970.
• It is full screen editor.
• It work with full file. Redefine keystroke.

Emacs is design to manipulating pieces of text, although it is capable of formatting and printing
document like a word processor.

3) Text editor

• Text editor is simple, open source word processing and text editor.
• It also has capability to check spell.
• It is work with line, paragraph, file, etc... As you wish. It is GUI.

4) JOT

• Jot is a displayed-oriented cut and-paste style ASCII Text editor.


• It is made by silicon
• It runs on silicon graphic machine.
• Jot written pure graphic library code.
• Not work on x terminal.
• It is full screen window editor with point and click option for cutting, pasting, deleting etc…
• You can setup things like fonts, text size, page size etc… DRAWBACK is time limit for
editing text.

5) Vueped

• It is GUI
• Provide point and cursor facility
• Developed by HP

6) Nuepad

• It is Public domain, means it is easily available for public


• It is better and efficient than vueped

7) pico

• It is GUI

113
• Point and cursor facility.

• File, line, paragraph, editing facility.

5.3) vi Modes

5.3.1) Command Mode

• Command mode is the mode you are in when you start (default mode)
• Command mode is the mode in which commands are given to move around in the
file, to make changes, and to leave the file
• Commands are case sensitive: j not the same as J
• Most commands do not appear on the screen as you type them. Some commands
will appear on the last line: : / ?

5.3.2) Insert (or Text) Mode

• The mode in which text is created. (You must press <Return> at the end of each line
unless you've set wrap margin.)
• There is more than one way to get into insert mode but only one way to leave:
return to command mode by pressing <Esc>

When in doubt about which mode you are in, press <Esc>

114
Chapter#6

Unix/Linux Shells
Topic to Learn
6.1 Define Unix Linux shell 6.3 Describe bourn shell
6.2 Explain the Function of Shell 6.4 Use bourn shell in Unix/Linux

6.1) Define UNIX Linux shell

A shell is software that provides an interface for an operating system's users to provide access to
the kernel's services. OR
A shell is a user interface for access to an operating system services.

Detail
A shell is a program that provides the traditional, text-only user interface for Linux and other
Unix-like operating systems. Its primary function is to readcommands that are typed into a
console (i.e., an all-text display mode) or terminal window (an all-text window) in a GUI
(graphical user interface) and then execute (i.e., run) them.

A user is in a shell (i.e., interacting with the shell) as soon as that user has logged into the system.
A shell is the most fundamental way that a user can interact with the system, and the shell hides
the details of the underlying operating system from the user.

The term shell derives its name from the fact that it is an outer layer of an operating system. A
shell is an interface between the user and the internal parts of the operating system (at the
very core of which is the kernel).

Fig 6.1 & 6.2 OS Shell

115
6.2) Explain the Function of Shell

Computers understand the language of zeros and ones known as binary language. In the early
days of computing, instructions were provided using binary language, which is difficult for all of
us to read and write. Therefore, in an operating system there is a special program called the
shell. The shell accepts human readable commands and translates them into something the
kernel can read and process. The most generic sense of the term shell means any program that
users employ to type commands. A shell hides the details of the underlying operating system
and manages the technical details of the operating system kernel interface, which is the
lowestlevel, or "inner-most" component of most operating systems.

• Major and core function of shell is binary converstion.(fig 6.3)


• The shell is a user program or it is an environment provided for user interaction.
• It is a command language interpreter that executes commands read from the standard
input device such as keyboard or from a file.
• When a user gives his Command for Performing Any Operation, then the Request Will goes
to the Shell Parts, The Shell Parts is also called as the Interpreter which translate the
Human Program into the Machine Language and then the Request will be transferred to
the Kernel. So that Shell is just called as the interpreter of the Commands which Converts
the Request of the User into the Machine Language.
• When the Kernel Receives the Request from the Shell then this will Process the Request
and Display the Results on the Screen.
• Assembler/compiler is used for convert english language to binary or machine language
that can computer understand.

user

Shell Kernal OS

Converstion

binary

fig 6.3

116
6.3) Describe bourne shell

A number of different shells have been developed for Unix-like operating systems. They share
many similarities, but there are also some differences with regard to commands, syntax and
functions that are important mainly for advanced users. Every Unix-like operating system has
at least one built-in shell, and most have several. Sh (Bourne shell)

sh (the Bourne Shell) is the original UNIX shell, and it is still in widespread use today. Written by
Stephen Bourne at Bell Labs in 1974, it is a simple shell with a small size and few features,
perhaps the fewest of any shell for a Unix-like operating system. Bell Labs was the research and
development arm of AT&T (The American Telephone and Telegraph Company), the former U.S.
telecommunications monopoly. The first version of UNIX was developed at Bell Labs in 1969.

Among the functions that most users have come to expect in a shell but which are missing in sh
are file name completion, command editing, command history and ease of executing multiple
background processes (also referred to as jobs). A process is an instance of an executing
program; a background process operates generally unnoticed while users are working with
foreground processes. File name completion is the completion by the system of the names of
files that have only partially typed in by a user. Command history allows users to conveniently
find and reissue previously issued commands. Every Unix-like system contains sh or another
shell which incorporates its commands.

Feature

• Command History Feature: NO( the ability to store commands in a buffer, than modify
and reuse)
• Line Editing Feature: NO(Ability to current or previous command line with a text editor
Restricted shell: No( security limitation)

Summary or quick reference of Bourne shell

1. Oldest shell use in all Unix system


2. It is default shell in Unix
3. Developed in 1977 at AT & T lab by Stephen bourne

117
4. It has limited functionality
5. It cannot re-edit previous command commands or to control background jobs
6. It’s function is sufficient and cannot convinces the user
7. It is also used for programming script, bourne shell script also under BASH
8. Bourne shell is located at /bin/sh
9. Default prompts is $
10. Limited security

6.3.1) Some other Shell types

1) bash (Bourne-again shell) is the default shell on Linux. It also runs on nearly every other
Unix-like operating system as well, and versions are also available for other operating systems
including the Microsoft Windows systems. Bash is a superset of sh (i.e., commands that work in
sh also work in bash, but the reverse is not always true), and it has many more commands than
sh, making it a powerful tool for advanced users. But it is also intuitive and flexible, and thus it is
probably the most suitable shell for beginners. bash was written for the GNU project (whose goal
is to develop a complete, Unix-compatible, high performance and entirely free operating
system), primarily by Brian Fox and Chet Ramey. Its name is a pun on the name of Steve Bourne.

Summary or quick reference of Bourne shell

1. It is default shell of Linux


2. It also found in Unix like and Microsoft windows system
3. It has ability to re-edit or re-call command
4. It is CLI based editor by using courser key
5. Most important: it is also have ability in command line that you type some few word and
then it give you full command following by ‘TAB’ key (like mobile phone when you search
any contact but here we not use TAB key).
6. Default prompts is $

2) csh (the C shell) has a syntax that resembles that of the highly popular C programming
language (also developed at Bell Labs), and thus it is sometimes preferred by programmers. It
was created in 1978 by Bill Joy. It is more compatible for c programming languages. It has ability
to re-edit the command. The default prompt for c shell is the % sign.

3) ksh (the Korn shell) is a superset of sh developed by David Korn at Bell Labs in 1983. It
contains many features of the C shell as well. It is based on bourne shell most command and
login style, prompt style are same. One enhancement that is particularly useful is it’s
commandline editing facility. It is possible using either vi or emacs keys to recall and edit
previous commands. There are also more powerful programming constructs than the bourne
shell. Default Location os (/bin/ksh).

118
4) tcsh (the TENEX C shell) is based on csh but also has programmable file name completion,
command line editing, a command history mechanism and other features lacking in csh. It is
named after the TENEX operating system, which inspired the author of tcsh. tcsh replaced the
csh as the default shell on some BSD operating systems (i.e., FreeBSD and Darwin).

6.3.2) The Shell Prompt

When logged into the shell you will normal see one of the following prompts: $, % or #.
This is an indication that the shell is waiting for an input from the user. The prompts
can be customised but generally the last character should be left as the default
prompt character as it helps to indicate which shell you are running and whether or
not you are logged in as root.

The Bourne, Korn, and Bash shells all accept a similar syntax. Unless you are using one of
the advanced features you do not necessarily need to know which one of them you are
in. If however you are in the C or tcsh shells this uses a completely different syntax and
can require commands to be entered differently. To make it a little easier these have
two different prompts depending upon the shell.

The default prompts are:

$ - Bourne, Korn and Bash Shells


% - C Shell

When logged into the computer as root, the user should take great care over the
commands that are entered (further information about the root user is included in
the System Administrator book). If you enter something incorrectly you could end up
damaging the Linux installation files or even delete all the data from a disk. For this
reason the prompt is different when logged in as a root user as a constant reminder
of the risks.

The default prompt for root is the hash sign # this is regardless of the shell being used.

6.3.3) Shell scripting

Using the shell to run command you can use it’s built-in programming languages to write your own
commands or program. You put command into file known as shell script OR

In simplest term, a shell script is a file containing a series of commands.


The file reads this file and carries out the command as through have been entered directly on
the command line

To successful write shell script you have must

1. Write a script
2. Give the shell permission to execute it

119
3. Put it somewhere the shell can find it

For writing a script using text editor

6.4) Use bourn shell in Unix/Linux

It is lab …. Practical

Chapter#7

System Administration
Red Hat 6 RHEL Installation
1. Select Install or upgrade an existing system option on Grub Menu
2. Choose a language
3. Choose a keyboard type
4. Choose a installation media
5. Skip DVD media test (or select media test, if you want to test installation media before
installation)
6. Red Hat 6 graphical installer starts, select next
7. Accepct Pre-Release Installation
8. Select storage devices
9. Insert computer name
10. Select time zone
11. Enter a password for root user
12. Select type of installation
Read every options info carefully. And select encrypting if needed and option to review and
modify partition layout.
13. Review partition layout
Modify if needed. Default setup with ext4 and LVM looks good for desktop machine.
14. Accept write changes to disc
15. Writing changes (creating partitions) to disc
16. Configure boot loader options
Select device to install bootloader and check/create boot loader operating system list.
17. Select softwares to install and enable repositoriesThis case we select Software Development
Workstation and enable Red Hat Enterprise Linux 6.0 Beta Repository and select Customize
now.
18. Customize package selection Select PHP and Web Server to installation.

120
Select MySQL and PostgreSQL Databases.
Select set of Development tools like
Eclipse IDE.
19. Checking dependencies for installation
20. Starting installation process
21. Installing packages
22. Installation is complete
Click reboot computer and remove installation media.
Red Hat 6 RHEL Finishing Installation
23. Selecting RHEL 6 from grub
24. Booting Red Hat 6
25. Red Hat 6 Welcome screen
26. Create normal user
27. Setup date and time and keep up-to-date with NTP
28. Login Red Hat 6 Gnome Desktop
29. Red Hat (RHEL) 6 Gnome Desktop, empty and default look

Note : chapter 7 is almost practical, you can understand chapter 7 better with practical. So don’t
ignore this.

121
Please visit for more notes
https://dae-note.blogspot.com/

122
Past paper

123
124

You might also like