SNO. TOPIC DATE SIGNATURE

wrackbaaΚινητά – Ασύρματες Τεχνολογίες

10 Δεκ 2013 (πριν από 3 χρόνια και 6 μήνες)

64 εμφανίσεις





SNO.


TOPIC



DATE


SIGNATURE

1.

INTRODUCTION TO WINDOWS

2000




2.

INTRODUCTION TO LINUX




3.

U
N
I
X COMMANDS




I.


WAP TO CALCULATE THE GRADE OF
A STUDENT




II.


WAP TO CALCULATE SIMPLE
INTEREST





III.


WAP TO PRINT NUMBERS FROM 1 TO
15




IV.


WAP TO SHOW
BASIC ARITHMATIC
OPERATIONS




V.


WAP TO CALCULATE THE SALARY
BY USING BASIC SALARY




VI.


WAP TO FING THE GREATEST
NUMBER AMONG THE THREE




VII.


WAP TO SHOW AN EXAMPLE OF
CASE STATEMENT




1


WINDOWS 2000

Windows 2000

(also referred to as
Win2K

or
W2K
) is a
preemptible

and interruptible, graphical,
business
-
oriented
operating syste
m

that was designed to work with either
uniprocessor

or
symmetric
multi
-
proces
sor

(SMP) 32
-
bit
Intel

x86

computers. It is part of the
Microsoft

Windows NT

line of
operating systems and was released on
February 17
,
2000
. Windows 2000 comes in four versions:
Professional, Server, Advanced Server, and Datacenter Server. Additionally, Microsoft offers Windows
2000 Advanced Server
-

Limited Edition, which was released in 2001 and runs on 64
-
bit Intel
Itanium

microprocessors
. Windows 2000 is classified as a
hybrid kernel

operating system
, and its
architecture

is
divided into two modes:
user mode

and
kernel mod
e
. The kernel mode provides unrestricted access to
system resources and facilitates the user mode, which is heavily restricted and designed for most
applications.


All versions of Windows 2000 have common functionality, including many system utilities suc
h as the
Microsoft Management Console

(MMC) and standard system management applications such as a disk
defragmentation utility. Support for people w
ith disabilities has also been improved by Microsoft
across their Windows 2000 line, and they have included increased support for different languages and
locale information. All versions of the operating system support the Windows NT filesystem,
NTFS

5,
the
Encrypting File System

(EFS), as well as basic and dynamic disk storage. Dynamic disk storage
allo
ws different types of volumes to be used. The Windows 2000 Server family has enhanced
functionality, including the ability to provide
Active Directory

services (a hierarchi
cal framework of
resources),
Distributed File System

(a file system that supports sharing of files) and fault
-
redundant
storage vo
lumes.

Windows 2000 can be installed and deployed to an enterprise through either an attended or unattended
installation. Unattended installations rely on the use of answer files to fill in installation information,
and can be performed through a bootable

CD using Microsoft
Systems Management Server

(SMS), by
the
System Preparation Tool

(Sys
prep).








2


Architecture


The Windows 2000 operating system architecture consists of two layers (user mod
e and kernel mode),
with many different modules within both of these layers.

Windows 2000 is a highly modular system that consists of two main layers: a
user mode

and a
kernel
mode
. The user mode refers to the mode in which user programs are run. Such programs are limited in
terms of what system resources they have access to, while the kernel mode has unrestricted a
ccess to
the system memory and external devices. All user mode applications access system resources through
the executive which runs in kernel mode.

User mode

User mode in Windows 2000 is made of subsystems capable of passing
I/O

requests to the appropriate
kernel mode drivers by using the I/O manager. Two subsystems make up the user mode layer of
Windows 2000: the environment subsystem and the integral subsystem.

The environment subsystem was design
ed to run applications written for many different types of
operating systems. These applications, however, run at a lower priority than kernel mode processes.
There are three main environment subsystems:

3


1.

Win32

subsystem runs 32
-
bit Windows applications and also supports
Virtual DOS Machines

(VDMs), which allows
MS
-
DOS

and
16
-
bit

Windows 3.x

(
Win16
) a
pplications to run on
Windows.

2.

OS/2

environment subsystem supports 16
-
bit character
-
based OS/2 applications and emulates
OS/2 1.3 and 1.x, but not 2.x or later OS/2 applications.

3.

POSIX

environment subsystem supports applications that are strictly written to either the
POSIX.1 standard or the related
ISO
/
IEC

standards.

The integral subsystem looks after operating system specific functions on behalf of the environment
subsystem. It consist
s of a
security subsystem

(grants/denies access and handles logons),
workstation
service

(helps the computer gain network access) and a
server service

(lets the computer provide
network services).

Kernel mode

Kernel mode

in Windows 2000 has full access to the hardware and system resources of the computer.
The kernel mode stops user mode services and applications from accessing critical areas of the
operating system that they should no
t have access to.


Each object in Windows 2000 exists in its own
namespace
. This is a screenshot from
SysInternal's

WinObj

The executive interfaces with all the user mode subsystems. It deals with I/O, object management,
security and process management. It contains various

components, including:



Object manager
: a special executive subsystem that all other executive subsystems must pass
through to gain access to Windows 2000 resources. This essentially is a resource management
infrastructure service that allows Windows 2000
to be an
object oriented

operating system.



I/O Manager:

allows devices to communicate with user
-
mode subsystems by translating user
-
mode read and write commands and passing
them to
device drivers
.



Security Reference Monitor (SRM):

the primary authority for enforcing the security rules of
the security integral subsystem.



IPC Manager:

short for
Interprocess Communication

Manager, manages the communication
between clients (the environment subsystem) and servers (components of the executive).



Virtua
l Memory Manager:

manages
virtual memory
, allowing Windows 2000 to use the
hard
disk

as a
primary storage

device (although strictly speaking it is
secondary storage
).



Process Manager:

handles
process

and
thread

creation and termination



PnP Manager:

handles
Plug and Play

and supports device detection and installation at boot
time.



Power Manager:

the power manager coordinates power events and generates power
IRPs
.

4




The display system is handled by a device driver contained in
Win32k.sys
. The
Window
Manager

component of this driver is responsible for drawing windows and menus while the
GDI

(
graphical device interface
) component is responsible for tasks such as drawing
lines

and

curves
, rendering
fonts

and handling
pal
ettes
.

The Windows 2000
Hardware Abstraction Layer
, or HAL, is a layer between the physical hardware of
the computer and the rest of the operating sys
tem. It was designed to hide differences in hardware and
therefore provide a consistent platform to run applications on. The HAL includes hardware specific
code that controls I/O interfaces,
interrupt controllers

and multiple processors.

The
hybrid kernel

sits between the HAL and the executive and provides multiprocessor
synchronization, th
read and interrupt scheduling and dispatching, trap handling and exception
dispatching. The hybrid kernel often interfaces with the process manager and is responsible for
initializing device drivers at bootup that are necessary to get the operating system
up and running.

Common functionality


Certain fea
tures are common across all versions of Windows 2000 (both Professional and the Server
versions), among them being NTFS 5, the
Microsoft Management C
onsole

(MMC), the
Encrypting File
System

(EFS), dynamic and basic disk storage, usability enhancements and multi
-
language and locale
support. Windows 2000 also

has several standard system utilities included as standard. As well as these
features, Microsoft introduced a new feature to protect critical system files, called Windows File
Protection (WFP). This prevents programs (with the exception of Microsoft's upd
ate programs) from
replacing critical Windows system files and thus making the system inoperable. Microsoft recognized
that the infamous
Blue Screen of Death

(or st
op error) could cause serious problems for servers that
needed to be constantly running and so provided a system setting that would allow the server to
automatically reboot when a stop error occurred. Users have the option of dumping the first 64
KB

of
memory to disk (the smallest amount of memory that is useful for
debugging

purposes, also known as a
minidump), a dump of
only the kernel's memory or a dump of the entire contents of memory to disk, as
well as write that this event happened to the Windows 2000 event log. In order to improve performance
on computers running Windows 2000 as a server operating system, Microsoft
gave administrators the
choice of optimizing the operating system for background services or for applications.




5


NTFS 5


Windows 2000 supports disk quotas, which c
an be set via the "Quotas" tab found in the hard disk
properties
dialog box
.

Microsoft released the third version of the
NT F
ile System

(NTFS)


also known as version 5.0


in
Windows 2000; this introduced
quotas
, file
-
system
-
level
encry
ption

(called
EFS
),
sparse files

and
reparse points
. Sparse files allow for the efficient storage of data sets that are very large yet contain
many areas that only have
zeroes
. Reparse points allow the object manag
er to reset a file namespace
lookup and let file system drivers implement changed functionality in a transparent manner. Reparse
points are used to implement
Volume Mount Points
,
Directory Junctions
,
Hierarchical Storage
Management
,
Native Structured Storage

and
Single Instance Storage
. Volume mount points and
directory junctions allow for a file to be transparently referred from one file or directory location to
another.

Encr
ypting File System

The Encrypting File System (EFS) introduced strong
encryption

into the Windows file world. It
allowed any folder or drive on an
NTFS

volume to be encrypted transparently to the end user. EFS
works in conjunction with the EFS service, Microsoft's
CryptoAPI

and the EFS File System Run
-
Time
Li
brary (FSRTL). As of
February 2004
, its encryption has not been compromised.

EFS works by encrypting a file with a bulk
symmetric key

(also known as the
File Encryption Key
, or
FEK), which is used because it takes a relatively smaller amount of ti
me to encrypt and decrypt large
amounts of data than if an
asymmetric key

cipher is used. The symmetric key that is used to encrypt the
file is then encrypted with a
public key

that is associated with the user who encrypted the file, and this
encrypted data is stored in the header of the encrypted file. To decrypt the file, the file system uses the
private k
ey of the user to decrypt the symmetric key that is stored in the file header. It then uses the
symmetric key to decrypt the file. Because this is done at the file system level, it is transparent to the
user. Also, in case of a user losing access to their
key, support for recovery agents that can decrypt files
has been built in to the EFS system.


6


Basic and dynamic disk storage

Windows 2000 introduced the
Logical Disk

Manager

for dynamic storage. All versions of Windows
2000 support three types of dynamic disk volumes (along with basic storage):
simple volumes
,
spanned
volumes

and
striped volumes
:



Simple volume:

this is a volume with disk space from one disk.



Spanned

volumes:

multiple disks spanning up to 32 disks. If one disk fails, all data in the
volume is lost.



Striped volumes:

also known as
RAID
-
0
, a striped volume stores all its data across several
disks in
stripes
. This allows better performance because disk read and writes are balanced
across multiple disks.

Windows 2000 also added support for
iSCSI

protocol.

Server family functionality


The Windows 2000 server family consists of Windows 2000 Server, Windows 2000 Advanced Server
and Windows 2000 Datacenter Server.

All editions of Windows 2000 Server have the following services and functionality built
-
in:



Routing and Remote Access Ser
vice (RRAS) support, facilitating dial
-
up and
VPN

connections,
support for
RADIUS

authenticati
on, network connection sharing,
Network Address Translation
,
unicast and multicast routing



DNS

server, including support for
Dynamic DNS
.
Active Directory

reli
es heavily on DNS.



Microsoft Connection Manager Administration Kit and Connection Point Services



Support for
distributed file sys
tems

(DFS))



Hierarchical Storage Management

support, a service that runs in conjunction with
NTFS

that
automatically transfers files that are not used for some period of time to less expensive storage
media



Fault tolerant volumes, namely it supports
Mirrored

and
RAID
-
5




Group policy

(part of Active Directory)



IntelliMirror
, a collection of technologies for fine
-
grained management of Windows 2000
Professional desktops (roaming profiles, software installation, settings management).



Kerberos

authentication

7




Public Key Infrastructure

(PKI) support



Terminal Services

and support for the
Remote Desktop Protocol

(RDP)



Internet Information Server

(IIS) 5

Distributed File System

The Distributed File System, or DFS, allows
shares

in multiple different locations to be logically
grouped under one folder, or
DFS root
. When users try to access a share that exists off the DFS root,
the user is really looking at a
DFS link

and the DFS server transparently redirects them to the

correct
file server and share. A DFS root can only exist on a Windows 2000 version that is part of the server
family, and only one DFS root can exist on that server.

There can be two ways of implementing DFS on Windows 2000: through standalone DFS, or thr
ough
domain
-
based DFS. Standalone DFS allows for only DFS roots that exist on the local computer, and
thus does not use Active Directory. Domain
-
based DFS roots exist within Active Directory and can
have their information distributed to other domain contro
llers within the domain


this provides fault
tolerance to DFS. DFS roots that exist on a domain must be hosted on a domain controller or on a
domain member server. The file and root information is replicated via the Microsoft File Replication
Service (FRS
).

Active Directory

Active Directory allows administrators to assign enterprise wide policies, deploy programs to many
computers, and apply critical updates to an entire organization, and is one of the main reasons why
many corporations have moved to Wind
ows 2000. Active Directory stores information about its users
and can act in a similar manner to a phone book. This allows all of the information and computer
settings about an organization to be stored in a central, organized database. Active Directory Ne
tworks
can vary from a small installation with a few hundred objects, to a large installation with millions of
objects. Active Directory can organise groups of resources into a single
domain

and can link domains
into a contiguous
domain name

space together to form
trees
. Groups of trees that do not exist within
the same namespace can be linked together to form
forests
.

Active Directory can only be installed on a Windows
2000 Server, Advanced Server or Datacenter
Server computer, and cannot be installed on a Windows 2000 Professional computer. It requires that a
DNS service that supports
SRV resource records

be installed, or that an existing DNS infrastructure be
upgraded to support this functionality. It also requires that one or more domain controllers exist to hold
the Active Directory database and provide Active Directory
directory services
.





8


Versions

Microsoft released various versions of Windows 2000 to cater to different markets and business needs.
It released Windows 2000 Professional, Win
dows 2000 Server, Windows 2000 Advanced Server and
Windows 2000 Datacenter Server:



Windows 2000 Professional

was designed as the desktop operating system for businesses and
power users. It is the basic unit of Windows 2000, and the most common. It offers g
reater
security and stability than many of the previous Windows desktop operating systems. It
supports up to two
processors
, and can address up to 4
GBs

of
RAM
.



Windows 2000 Server

products share the same
user interface

with Windows 2000
Professional, but contain additional components for running infrastructure and application
software. A significant component of the server products is
Active Directory
, which is an
enterprise
-
wide directory service based on
LDAP
. Additio
nally, Microsoft integrated
Kerberos

network authentication, replacing the often
-
criticized
NTLM

authe
ntication system used in
previous versions. This also provided a purely transitive
-
trust relationship between Windows
2000
domains

in a
forest

(a collection of on
e or more Windows 2000 domains that share a
common schema, configuration, and global catalogue, being linked with two
-
way transitive
trusts). Furthermore, Windows 2000 introduced a
DNS

server which allows dynamic
registration of
IP

addresses.



Windows 2000 Advanced Server

is a variant of Windows 2000 Server operating system
designed for

medium
-
to
-
large businesses. It offers
clustering

infrastructure for high availability
and scalability of applications and services, including main memory support of up to 8
gigabytes
(GB) on
Page Address Extension

(PAE) systems and the ability to do 8
-
way SMP. It
has support for
TCP/IP

load balancing

and enhanced two
-
node server clusters based on the
Microsoft Cluster Server

(MSCS) in the Windows NT Server 4.0 Enterprise Edition.

A limited
edition
64 bit

version of Windows 2000 Advanced Server was made available via
the OEM
Channel. It also supports failover and load balancing.



Windows 2000 Datacenter Server

is a variant of the Windows 2000 Server that is designed
for large businesses that move large quantities of confidential or sensitive data frequently via a
centr
al
server
. As with Advanced Server, it supports clustering, failover and load balancing. Its
system requirements are normal, but are compatible with vast amounts of

power:

o

A
Pentium
-
class CPU at 400
MHz

or higher
-

up to 32 are supported in one machine

o

256 MB of RAM
-

up to 64 GB i
s supported in one machine

o

Approximately 1 GB of available disk space



9


Linux

Introduction

Linux

is a
Unix
-
like

computer
operating system
. Linux is one of the most prominent examples of
free
software

and
open source

development; its underlying
source code

can be freely modified, used, and
redistributed by anyone.

The
Linux kernel

was first released to the public on
17 September

1991
, for the
Intel x86

PC
architecture. The kernel was augmented with
system utilities

and
libraries

from the
GNU

project to
create a usable operating system, which later led to the alternate term
GNU/Linux
. Linux is now
packaged

for different uses in
Linux distributions
, which contain the sometimes modified kernel along
with a variety of other software packages tailored to different requiremen
ts.

Predominantly known for its use in
servers
, Linux has gained the support of corporations such as
IBM
,
Sun Microsystems
,
Dell
,
Hewlett
-
Packard

and
Novell
. It is used as an operating system for a wide
variety of computer
hardware
, including
desktop computers
,
supercomputers

, video game systems
(
PlayStation 2

and
3

for example) and
embedded devices

such as
mobile phones

and
routers
.

Programming on Linux

Most Linux distributions support dozens of
programming languages
. The most common collection of
utilities for building both Linux applications and operating system programs is found within the
GNU
toolchain
, which includes the
GNU Compiler Collection

(GCC) and the
GNU build system
. Amongst
others, GCC provides compilers for
C
,
C++
,
Java
,
Ada

and
Fortran
. The Linux kernel itself is written
to be compiled with GCC.

Most also include support for
Perl
,
Ruby
,
Python

and other dynamic languages. Examples of languages
that are less common,
but still well
-
supported, are
C#

via the
Mono

project, and
Scheme
. A number of
Java Virtual Machines

and development kits run on Linux, including the original Sun

Microsystems
JVM (
HotSpot
), and IBM's J2SE RE, as well as many open
-
source projects like
Kaffe
. The two main
frameworks for dev
eloping graphical applications are those of
GNOME

and
KDE
. These projects are
based on the
GTK+

and
Qt

widget toolkits
, respectively, which can also be used independently

of the
larger framework. Both support a wide variety of languages. There are a number of
Integrated
development environments

available
including
Anjuta
,
Code::Blocks
,
Eclipse
,
KDevelop
,
MonoDevelop
,
NetBe
ans
, and
Omnis Studio

while the traditional editors
Vim

and
Emacs

remain
popular.

Although free and open source compilers and tools are widely used under Linux, there are also
proprietary solutions available from a range of companies, including the
Intel C++ Compiler
,
PathScale, Micro Focus COBOL,
Franz Inc

and the Portland Group.

10


User interface



A command line session using
bash

Linux is coupled to a text
-
based
command line interface

(CLI), though this is usually hidden on

desktop computers by a
graphical user interface

(GUI). On small devices, input may be handled
through controls on the device itself, and direct input to Li
nux might be hidden entirely.

The
X Window System

(X) is the predominant graphical subsystem used in Linux. X provides
network
transparency
, enabling graphical output to be displayed on machines other than that which a program
runs on. For desktop machines X runs locally.

Early GUIs for Linux were based on a stand
-
alone
X window manager

such as
FVWM
,
Enlightenment
,
or
Window Maker
, and a suite of diverse applications running under it. The window manager provides
a means to control the placement and appearance

of individual application windows, and interacts with
the
X window system
. Because the X window managers only manage the placement of windows, their
decoration, and some
inter
-
process communication
, the look and feel of individual applications may
vary widely, especially if they use different graphical user interface tool
kits.

This model contrasts with that of platforms such as
Mac OS
, where a single toolkit provides support for
GUI widgets and window decorations, manages window placement, and otherwise provid
es a
consistent
look and feel

to the user. For this reason, the use of window managers by themselves
declined with the rise of Linux
desktop environments
. They combine a window manager with a suite of
standard applications that adhere to
h
uman interface guidelines
. While a window manager is analogous
to the
Aqua

user interface for Mac OS X, a desktop environment is analogous to Aqua with all o
f the
default Mac OS X graphical applications and configuration utilities.
KDE
, which was announced in
1996, along with
GNOME

and
Xfce

which were both announced in
1997
, are the most popular desktop
environments.


GNO
ME 2.16, showing the
Nautilus

file manager and the
gedit

text editor.

11


Linux systems usually
provide a CLI of some sort through a
shell
, the traditional way of interacting
with Unix systems. Even on modern desktop machines, some form of CLI is almost always a
ccessible.
Linux distributions specialized for servers may use the CLI as their only interface, and Linux machines
can run without a monitor attached. Such “headless systems” may be controlled by command line via a
protocol such as
SSH

or
telnet
.

Why use Linux?

Why use Linux, instead of a well known, well tested, and well documented commercial operating
system? We could

give you a thousand reasons. One of the most important, however, is that Linux is an
excellent choice for personal UNIX computing. If you're a UNIX software developer, why use MS
-
DOS at home? Linux allows you to develop and test UNIX software on your PC,
including database
and X

Window System applications. If you're a student, chances are that your university computing
systems run UNIX. You can run your own UNIX system and tailor it to your needs. Installing and
running Linux is also an excellent way to le
arn UNIX if you don't have access to other UNIX
machines.

But let's not lose sight. Linux isn't only for personal UNIX users. It is robust and complete enough to
handle large tasks, as well as distributed computing needs. Many businesses
--
especially small

ones
--
have moved their systems to Linux in lieu of other UNIX based, workstation environments.
Universities have found that Linux is perfect for teaching courses in operating systems design. Large,
commercial software vendors have started to realize the o
pportunities which a free operating system
can provide.

Linux vs. MS
-
DOS.

It's not uncommon to run both Linux and MS
-
DOS on the same system. Many Linux users rely on MS
-
DOS for applications like word processing. Linux provides its own analogs for these ap
plications, but
you might have a good reason to run MS
-
DOS as well as Linux. If your dissertation is written using
WordPerfect for MS
-
DOS, you may not be able to convert it easily to TeX or some other format. Many
commercial applications for MS
-
DOS aren't
available for Linux yet, but there's no reason that you can't
use both.

MS
-
DOS does not fully utilize the functionality of 80386 and 80486 processors. On the other hand,
Linux runs completely in the processor's protected mode, and utilizes all of its feat
ures. You can
directly access all of your available memory (and beyond, with virtual RAM). Linux provides a
complete UNIX interface which is not available under MS
-
DOS. You can easily develop and port
UNIX applications to Linux, but under MS
-
DOS you are li
mited to a subset of UNIX functionality.

Linux and MS
-
DOS are different entities. MS
-
DOS is inexpensive compared to other commercial
operating systems and has a strong foothold in the personal computer world. No other operating system
for the personal com
puter has reached the level of popularity of MS
-
DOS, because justifying spending
$1,000 for other operating systems alone is unrealistic for many users. Linux, however, is free, and you
may finally have the chance to decide for yourself.


12


UNIX
COMMANDS

Di
rectory Contains

Bin





binary executable files

Lib





library function

Dev





device related file

Etc






binary executable file required for system administration

Tmp






temporary files created by uni
x or users

Usr





home directories of all users

/usr/bin




additional binary executable file


Creating file

To create file there are two commands
touch
and
cat.

Eg:
-

$ touch sample

Here,the size of the would be zero bytes touch doesn’t allow to stor
e anything in the file. Purpose of
touch is if we want to create several empty files quickly.

Cat command allows one to store lines in a file.

$ cat > test

create a file test where one can write lines in this files.


Ctrl d

Indicates the end of file or end

of file character.



cat

$ Cat sample1 sample2>new sample

It can concatenate the contents of two files and store them in the third film’>>’operator

It’s the append output redirection operator. That is if we want that content of sample1 and sample2
should g
et appended we use this operator.

$ cat sample1 sample2>>new sample




cp

To copy a file we use cp command eg.


$ cp letter.a letter.b

copies the content of letter.a into a file letter.b if letter.b does not exist it will be created.



$ cp letter.d letter.b letters

copies the indicated files into the directory letters.

13





rm

Rm command removes the given file or files supplies to it.


$ rm
-
I file

this command removes files interactively.


$ rm
-
r dir1

this command recurs
ively (
-
r) removes all contents of dir1 and also dir1 itself.




mv

$ mv test sample

this command rename the file test to sample.

This command can also be used to rename directories.

$ mv olddir newdir

$ mv file1 file2 newdir

file1 and file2 are moved to the

new directory.



LISTING FILES AND DIRECTORIES

Ls command is used for directory listing or lists the contents of the current or specified directory.

Syntax:
-

$ ls.

$ ls
-
a

This commands lists even the hidden files

$ ls p*

This command list all files whose
names begin with p.

To list all files in directory my dir which end in x.

Syntax:
-

$ ls/mydir/*x.

$ ls

l

This command is used to obtain a long listing.




PERMISSIONS

The permission signify who all can access the file and for what purpose. This is decided
by file
permission. A set of characters decide there permissions. These are three types of permission.

r

read

w

write

x

execute

there are three entities to which any combination of these permission are assigned. These entities are
the owner the grou
p and the rest.

14


Out of nine characters, the first three characters decide the permission held by the owner of the file.
The next set of three characters specify the permission for the other users in the group, while the last set
decides the permissions for

the users outside the group.

Permission

weight

read(r)


4

write(w)

2

execute(e)

1

the existing file permission can be changed by the owner of the file.

$ chmod >00 myfile

This way of changing file permission is specified to as absolute mode.

$ chmod +w ca
rribeans

gives write permission to users.

$ chmod go
-
x myfile.

This command take away execute permission from others as well as group.

Eg:
-

$ chmod >44 file1

(read=4,write=2,execute=1)

this would assign the permission

rwx r
--

r
--
tofile1




MASKING file permi
ssion

umask

umask stands for user file creation mask the term mask implying which permissions to mask or hide.
The umask value tells unix which of the three permission are to be denied rather than granted. The
current value of umask can be easily determine
d by just typing umask.

$ umask

0022

The first 0 indicates that what follows is an octal number.

The first zero means for owner no permission is denied, whereas for both the group and others a write
permission(2) is denied.

Whenever a file is created unix
assumes that the permissions for this file should be 666.

But since our umask value is 022. unix subtracts this value from default system wide permission
resulting in a value 644.

15


Similarly system
-
wide
-
default permission for directory are 777. this means t
hat when we create a
directory its permission would be 777
-
022 i.e 755.


Cd

Cd command stand for change in directory.

$ cd newdir


ls
-
s

ls
-
s lists the files along with their sizes.


ls
-
i

Lists the files along with their mode numbers.


Pwd

Pwd stands for ‘p
resent working directory’. The current working directory is displayed as /usr/user1. (/)
backlash is used to specify the path.


Mkdir

This mkdir command is used to create the directory.

Eg:
-
$ mkdir book

Creates the directory named book.


Mkdir
-
p

Command h
elp to create multiple generations of directories at one go.

$ mkdir

p works/bnp/unix/book.


Rm dir

16


This command is used to remove directories.


Rm dir

p

This remove not only the specified directory but also the parent directory.


Cal

Cal command is capa
ble of printing calender for any year in the range 1 to 9999.


Wc

A simple and useful command ,it counts no. of lines, words and characters in the specified file or files.

$ wc

lc file1 file2

say file1 20 571

i.e file1 has 20 lines and 571 character.


Sor
t

The sort command can be used for sorting the contents of a file.

It can merge multiple sorted files and store the result in the specified output file.

Eg:
-

$ sort myfile

This would sort the content of myfile and display the sorted output on the screen.

$

sort

m file1 file2

This command sorts the file and merges it.

$ sort

r

this command reverse the sort.




GREP

Grep is an acronym for globally search a regular expression and print it.

The command searches the specified input fully for a match with the sup
plied pattern and displays it.

17


Eg:
-


$ grep picture newfile

This command searches the word ‘picture’ in the file newfile and if found the lines containing it would
be displayed on the screen.


$ grep picture
-
n newfile

It print the number of lines in which
the word ‘picture’ was found.


Vi
-
Editor

Vi(short for visual editor)

The Vi is a screen editor, can show as much as file it can fit on the screen. It allows the user to view
and edit the entire document at the same time. Creating and editing files becomes
lot easier. Vi can
handle file that contain text.



Mode of operation

The Vi program has three modes of operation.

(a)

Command Mode:
-

In this mode all the keys pressed by the user are interpreted to be editor
commands. If we press h, the cursor is moved one p
osition to the left. In command mode the
key that are hit are not displayed on the screen.

(b)

Insert Mode:
-

This mode permits insertion of new text, editing of existing text or replacement
of existing text. This insertion mode is also known as input_text mode
.

(c)

The ex command mode:
-
This mode permits us to give command at the command line. The
bottom line of the vi screen is called the command line. vi use the command line to display
message and command.

18



Command For Insertion Text


Command


Function

a



Enters

text input mode and appends text after the cursor.

i



Enters text input mode and inserts text at the cursor.

A



Enters text input mode and appends text at the end of current line.

I



Enters text input mode and inserts text at beginning of current line.

R

Enters text input mode and overwrites from current cursor position own wards.


Command For Deleting Text


nCommand

Function

x

deletes the character at current cursor position.

X

deletes the character to the left of the cursor.

dw

deletes a word from the

cursor to the next space.

dd

deletes the current line.


Command for quiting Vi

Command

Function

:wq

writes the buffer to the file and quits vi.

:w filename

writes the buffer to the file filename and quits vi.

and :q

:w! filename

overwrites the existing fi
le filename with the content of the buffer

and :q


and quits vi.

:q!



quits vi

:q



quits vi if changes made to the buffer were written to a file.

:w



save the file.



19


SHELL PROGRAMMING

Q. I) WAP
TO CALCULATE GRADE OBTAINED BY STUDENT

echo Enter the ma
rks

read m1

readm2

read m3

read m4

read m5

let per=(m1+m2+m3+m4+m5)/5

if[$per

ge 75]

echo pass with honours

if[$per

ge 60

a $per

l]

echo pass with first division.


OUTPUT:

Enter the marks

50

60

80

70

90

pass with first division


Q. II)WAP TO CALCULATE
SIMPLE INTEREST


COUNT=1;

while [$COUNT

le 3]

do


echo enter P


read P


echo enter rate


read r


echo enter time


read t


let si =(Pxrxt)/100

echo Simple Interest is:$si

let count = count + 1

done


OUTPUT:

enter P

100

enter rate

20


25

en
ter time

4

Simple Interest is:100

enter P

200

enter rate

25

enter time

4

Simple Interest is:200

enter P

400

enter rate

25

enter time

4

Simple Interest is:400


Q.III) PROGRAM TO PRINT NUMBERS FROM 1 TO 15


i=1

until [ $i

le 15]

do

echo $i

let i=i+1;

done


OUTPUT:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15



21



Q.IV) PROGRAM TO SHOW ARITHMETIC OPERATIONS

echo Enter two numbers

read a

read b

let c=(a+b)

let d=(a
-
b)

let e=(a*b )

let f=(a/b)

let g=(a%b)

echo Addition is $c

echo Subtraction is $d

echo Product is $e

ech
o Division is $f

echo Modulus is $g


Q.V) PROGRAM TO CALCULATE THE SALARY FROM GIVEN BASIC
SALARY


echo Enter basic salary

read bs

if [ $bs

lt 1500]

then

let hra=(bs*10)/100

let da=(bs*90)/100

else


let da=(bs*98)/100

hra=500

fi

let gs=(bs+da+hra)

echo
Gross Salary is $gs






22


Q.VI) PROGRAM TO FIND GREATEST BETWEEN THREE NUMBERS


echo Enter three numbers

read a

read b

read c

if [ $a

ge $b

a $a

ge $c ]

then


echo $a is greatest


if [ $b

ge $c

a $b

ge $c ]



then



echo $b is greatest



else



echo $c is greatest


fi

fi

Q.VII)
PROGRAM FOR CASE STATEMENT

echo menu

echo 1.who

echo 2.who am i

echo 3.pwd

echo 4. ls

echo 5.other than 1 to 4

echo Enter the choice

read choice

case $ choice in

who;;

who am I;;

pwd;;

ls;;

*) echo wrong choice entered

esa
c


OUTPUT:

menu

who

who am i

pwd

ls

other than 1 to 4

Enter the choice

2

who am i