Upload
achutha795830
View
15
Download
1
Embed Size (px)
Citation preview
Introduction to UNIX [11MCA14]
(Preview Version)
Notes
~ Ganesh Hegde
/hegde.ganesh7
/GaneshSirsi
facebook.com/hegde.ganesh7 [email protected] .
2 Introduction to UNIX [11MCA14]
INTRODUCTION TO UNIX
What Is UNIX?
UNIX is a computer operating system.
An operating system is the program that controls all the other parts of a computer system,
both the hardware and the software.
It allocates the computer's resources and schedules tasks. It allows you to make use of the
facilities provided by the system. Every computer requires an operating system.
UNIX is a multi-user, multi-tasking operating system. Multiple users may have multiple tasks
running simultaneously. This is very different than PC operating systems.
UNIX is a machine independent operating system. Not specific to just one type of computer
hardware.
Designed from the beginning to be independent of the computer hardware.
UNIX is a software development environment. Was born in and designed to function within
this type of environment.
The "UNIX" trademark, previously owned by AT&T and then deeded to UNIX Systems
Laboratories (USL), an AT&T subsidiary, passed to Novell when it acquired USL.
After a brief period of negotiations with rival Unix vendors Sun Microsystems, Santa Cruz
Operation, International Business Machines, and Hewlett-Packard, Novell granted exclusive
licensing rights to the UNIX trademark to X/Open Co. Ltd., an Open Systems industry
standards branding agent based in the United Kingdom.
History of UNIX
1969: Developed at AT&T Bell Labs in Murray Hill, New Jersey, one of the largest research
facilities in the world. Created in an environment when most computer jobs were fed into a
batch system.
Developed by researchers who needed a set of computing tools to help them with their
projects and their collaborators. Allowed a group of people working together on a project to
share selected data and programs.
1975: AT&T makes UNIX widely available - offered to educational institutions at minimal
cost. Becomes popular with university computer science programs. AT&T distributes
standard versions in source form: Version 6 (1975), Version 7 (1978), System III (1981).
1984 to date: University of California, Berkeley adds major enhancements, creates Berkeley
Standard Distribution (BSD)
1984 to date: Many Berkeley features incorporated into new AT&T version: System V
UNIX has become the operating system of choice for engineering and scientific workstations.
Two variations maintain popularity today, AT&T System V based and the Berkeley Standard
facebook.com/hegde.ganesh7 [email protected] .
3 Introduction to UNIX [11MCA14]
Distribution.
Current versions (1/95)are System V release 4.2 .and 4.4 BSD
Work is in progress to develop a Portable Operating System specification based on UNIX
(IEEE POSIX committee).
POSIX Portable Operating System Interface for Computer Environments
In 2001 IEEE and X/OPEN joined to form UNIX Specification Version 3(SUSV3) the approach
being WRITE ONCE AND ADOPT EVERYWHERE
System V vs. BSD
AT&T distributes System V for their computers. System V is also the basis for several
commercial implementations including:
Hewlett-Packard HP-UX
Apple AUX
Amdahl UTS
Cray UNICOS
IBM AIX.
BSD, from the University of California Berkeley, has undergone extensive modification and
enhancement in the university environment.
BSD is available directly from UCB and in a number of commercial versions including: Sun,
Apollo, DEC Ultrix, Gould UTX/32.
System V and BSD contain a large set of commands in common. Some of these commands,
however, support different options and have different default behaviors and output
formats. ex: ls, stty, mail, grep
Each version also has its own unique utilities. Some very common tasks, such as browsing a
file, are performed by totally different utilities: System V uses "pg" whereas BSD uses
"more".
UNIX or LINUX
Though we are studying UNIX.
For all Practical Purpose we will be using LINUX.
Files and processes
Everything in UNIX is either a file or a process.
A process is an executing program identified by a unique PID (process identifier).
facebook.com/hegde.ganesh7 [email protected] .
4 Introduction to UNIX [11MCA14]
A file is a collection of data. They are created by users using text editors, running compilers
etc.
Examples of files:
a document (report, essay etc.)
the text of a program written in some high-level programming language
instructions comprehensible directly to the machine and incomprehensible to a casual user,
for example, a collection of binary digits (an executable or binary file);
a directory, containing information about its contents, which may be a mixture of other
directories (subdirectories) and ordinary files.
The uniqueness or Features of UNIX
The features that made UNIX a hit from the start are:
Multitasking capability
Multiuser capability
Portability
Programming Facility
Pattern Matching
Documentation
Multitasking
Many computers do just one thing at a time, as anyone who uses a PC or laptop can attest.
Try logging onto network while opening your browser while opening a word processing
program.
Chances are the processor will freeze for a few seconds while it sorts out the multiple
instructions.
UNIX, on the other hand, lets a computer do several things at once, such as printing out one
file while the user edits another file.
This is a major feature for users, since users don't have to wait for one application to end
before starting another one.
Multiuser
The same design that permits multitasking permits multiple users to use the computer.
facebook.com/hegde.ganesh7 [email protected] .
5 Introduction to UNIX [11MCA14]
The computer can take the commands of a number of users determined by the design of the
computer to run programs, access files, and print documents at the same time.
The computer can't tell the printer to print all the requests at once, but it does prioritize the
requests to keep everything orderly.
It also lets several users access the same document by compartmentalizing the document so
that the changes of one user don't override the changes of another user.
System portability
A major contribution of the UNIX system was its portability, permitting it to move from one
brand of computer to another with a minimum of code changes.
At a time when different computer lines of the same vendor didn't talk to each other yet
alone machines of multiple vendors that meant a great savings in both hardware and
software upgrades.
It also meant that the operating system could be upgraded without having all the customer's
data inputted again.
And new versions of UNIX were backward compatible with older versions, making it easier
for companies to upgrade in an orderly manner.
Programming Facility
A Unix Shell is also programming language
It has all necessary ingredients of a language
These features are used to design shell Scripts Programs that can invoke Unix Commands
System functions can be controlled by scripts.
This is called Shell Programming
Documentation
Unix has very good documentation in form man i.e. Online Manual
Apart from Online there is Vast resources on Internet
In form of FAQs, How-to's and Tutorials
Wealth of Information can be downloaded from Internet
UNIX tool Kit
UNIX comes with hundreds of programs that can divided into two classes:
Integral utilities that are absolutely necessary for the operation of the computer, such as the
facebook.com/hegde.ganesh7 [email protected] .
6 Introduction to UNIX [11MCA14]
command interpreter, and
Tools that aren't necessary for the operation of UNIX but provide the user with additional
capabilities, such as typesetting capabilities and e-mail.
Pattern Matching
Unix features very sophisticated pattern matching
* known as metacharacter but there are many
We have regular expressions
Grep
Sed
Awk
UNIX Architecture
The UNIX system is functionally organized at three levels:
The kernel, which schedules tasks and manages storage;
The shell, which connects and interprets users' commands, calls programs from memory,
and executes them; and
The tools and applications that offer additional functionality to the operating system
Kernel-Shell Diagram
facebook.com/hegde.ganesh7 [email protected] .
7 Introduction to UNIX [11MCA14]
The three levels of the UNIX system:
The kernel
The heart of the operating system, the kernel controls the hardware and turns part of the
system on and off at the programmer's command.
If you ask the computer to list (ls) all the files in a directory, the kernel tells the computer to
read all the files in that directory from the disk and display them on your screen.
The shell
There are several types of shell, most notably the command driven Bourne Shell and the C Shell
(no pun intended), and menu-driven shells that make it easier for beginners to use.
Whatever shell is used, its purpose remains the same to act as an interpreter between the
user and the computer.
The shell also provides the functionality of "pipes," whereby a number of commands can be
linked together by a user, permitting the output of one program to become the input to
another program.
Tools and applications
There are hundreds of tools available to UNIX users, although some have been written by
third party vendors for specific applications.
Typically, tools are grouped into categories for certain functions, such as word processing,
business applications, or programming.
Command Structure
Commands can be
i) Internal and ii) external
A command has two parts
Ex: tput clear
Command arguments
Unix argument range from simple to complex. They consists of options,
expressions,instructions,filenames etc
Commands
$ date - Displaying both date and Time
$ Cal - The Calendar
facebook.com/hegde.ganesh7 [email protected] .
8 Introduction to UNIX [11MCA14]
$ Who - who are user
$ ps - Viewing process
$ ls - listing files
$ wc - Counting number of Lines in file
$ ls | wc - pipeing one command to other
$ exit - Signing off
$ man - to browse manual pages
$ passwd - Password change
$ cat filename display contents
$ echo - Displaying a message
$ printf - Alternative to echo
$ bc - The calculator
$ script - Recording a session
$ uname - knowing machine basics
$ tty - Knowing your terminal
$ stty - Displaying the settings & Terminal characteristics
(Note: Examples of these commands are covered in Next Sections)
facebook.com/hegde.ganesh7 [email protected] .
9 Introduction to UNIX [11MCA14]
Get the Complete
Introduction to UNIX [11MCA14]
Notes
Mail me to:
(Please Mention Notes Name in the
Subject Line
And
Your Name ,College Name in the mail
body else mail will be ignored)