Вы находитесь на странице: 1из 16

STUDY OF UNIX OS

OPERATING SYSTEM :

An operating system (commonly abbreviated to either OS


or O/S) is an interface between hardware and applications;
it is responsible for the management and coordination of
activities and the sharing of the limited resources of the
computer. The operating system acts as a host for
applications that are run on the machine. Common
contemporary operating systems include Microsoft Windows,
Mac OS, Linux, BSD and Solaris.

Operating systems perform basic tasks, such as recognizing


input from the keyboard, sending output to the display
screen, keeping track of files and directories on the disk,
and controlling peripheral devices such as disk drives and
printers.
An operating system creates the ability to:
• serve a variety of purposes
• interact with users in more complicated ways
• keep up with needs that change over time

Operating System Functions:


1. It manages the hardware and software resources
of the system. In a desktop computer, these resources
include such things as the processor, memory, disk
space.

2. The operating system's tasks, in the most


general sense, fall into six categories Processor
management, Memory management , Device management ,
Storage management , Application interface , User
interface
3. It provides a stable, consistent way for
applications to deal with the hardware without having
to know all the details of the hardware.

Types of Operating Systems


Some of the important categories of os :
Single-User : Allows only one user to work on a single task.
multi-user : Allows two or more users to run programs at
the same time. Some operating systems permit hundreds or
even thousands of concurrent users.
multiprocessing : Supports running a program on more than
one CPU.
multitasking : Allows more than one program to run
concurrently.
multithreading : Allows different parts of a single program
to run concurrently.
Within the broad family of operating systems, there are
generally four types, categorized based on the types of
computers they control and the sort of applications they
support. The categories are:
 Real-time operating system (RTOS) - Real-time
operating systems are used to control machinery,
scientific instruments and industrial systems. A very
important part of an RTOS is managing the resources of
the computer so that a particular operation executes in
precisely the same amount of time, every time it occurs.
 Single-user, single task - As the name implies, this
operating system is designed to manage the computer so
that one user can effectively do one thing at a time. The
Palm OS for Palm handheld computers is a good example of
a modern single-user, single-task operating system.
 Single-user, multi-tasking - This is the type of
operating system most people use on their desktop and
laptop computers today. Microsoft's Windows and Apple's
MacOS platforms are both examples of operating systems
that will let a single user have several programs in
operation at the same time. For example, it's entirely
possible for a Windows user to be writing a note in a
word processor while downloading a file from the Internet
while printing the text of an e-mail message.
 Multi-user - A multi-user operating system allows
many different users to take advantage of the computer's
resources simultaneously. The operating system must make
sure that the requirements of the various users are
balanced, and that each of the programs they are using
has sufficient and separate resources so that a problem
with one user doesn't affect the entire community of
users. Unix, VMS and mainframe operating systems, such as
MVS, are examples of multi-user operating systems.
STUDY OF UNIX

Unix is a computer operating system originally


developed in 1969 by a group of AT&T employees at Bell
Labs, including Ken Thompson, Dennis Ritchie, Douglas
McIlroy, and Joe Ossanna. .

Unix operating systems are widely used in both servers


and workstations. Unix was designed to be portable, multi-
tasking and multi-user in a time-sharing configuration.
Unix systems are characterized by various concepts: the use
of plain text for storing data; a hierarchical file system;
treating devices and certain types of inter-process
communication (IPC) as files; Under Unix, the "operating
system" consists of many of these utilities along with the
master control program, the kernel. The kernel provides
services to start and stop programs, handle the file system
and other common "low level" tasks . The microkernel
concept was introduced in an effort to reverse the trend
towards larger kernels and return to a system in which most
tasks were completed by smaller utilities.

History

In the 1960s, the Massachusetts Institute of Technology,


AT&T Bell Labs, and General Electric worked on an
experimental operating system called Multics (Multiplexed
Information and Computing Service), Thompson thus re-wrote
the game in assembly language for Digital Equipment
Corporation's PDP-7 with help from Dennis Ritchie. This
experience, combined with his work on the Multics project,
led Thompson to start a new operating system for the PDP-7.
Thompson and Ritchie led a team of developers, including
Rudd Canaday, at Bell Labs developing a file system as well
as the new multi-tasking operating system itself. They
included a command line interpreter and some small utility
programs.

1970s
In the 1970s the project was named Unics, and eventually
could support two simultaneous users. Brian Kernighan
invented this name as a contrast to Multics; In 1973, Unix
was rewritten in the C programming language, contrary to
the general notion at the time "that something as complex
as an operating system, which must deal with time-critical
events, had to be written exclusively in assembly Language"

1980s
An early-1990s style Unix desktop running the X Window
System graphical user interface. Shown are a number of
client applications common to the MIT X Consortium's
distribution, including Tom's Window Manager, an X
Terminal, Xbiff, xload, and a graphical manual page
browser.1990s

In 1990, the Open Software Foundation released OSF/1, their


standard Unix implementation, based on Mach and BSD,
AT&T and another group of licensees formed the group
"UNIX International" in order to counteract OSF. This
escalation of conflict between competing vendors gave
rise again to the phrase "Unix wars".

2000 to present

In 2005, Sun Microsystems released the bulk of its Solaris


system code (based on UNIX System V Release 4) into an open
source project called OpenSolaris.

Components

The Unix system is composed of several components that are


normally packaged together. By including — in addition to
the kernel of an operating system — the development
environment, libraries, documents, and the portable,
modifiable source-code for all of these components, Unix
was a self-contained software system.The inclusion of these
components did not make the system large — the original V7
UNIX distribution, consisting of copies of all of the
compiled binaries plus all of the source code and
documentation occupied less than 10MB, and arrived on a
single 9-track magnetic tape. The printed documentation,
typeset from the on-line sources, was contained in two
volumes.

The names and filesystem locations of the Unix components


have changed substantially across the history of the
system. Nonetheless, the V7 implementation is considered by
many to have the canonical early structure:
• Kernel — source code in /usr/sys, composed of several
sub-components:
o conf — configuration and machine-dependent parts,
including boot code
o dev — device drivers for control of hardware (and
some pseudo-hardware)
o sys — operating system "kernel", handling memory
management, process scheduling, system calls,
etc.
o h — header files, defining key structures within
the system and important system-specific
invariables
• Development Environment — Early versions of Unix
contained a development environment sufficient to
recreate the entire system from source code:
o cc — C language compiler (first appeared in V3
Unix)
o as — machine-language assembler for the machine
o ld — linker, for combining object files
o lib — object-code libraries (installed in /lib or
/usr/lib) libc, the system library with C run-
time support, was the primary library, but there
have always been additional libraries for such
things as mathematical functions (libm) or
database access. V7 Unix introduced the first
version of the modern "Standard I/O" library
stdio as part of the system library.
o make - build manager for effectively automating
the build process
o include — header files for software development,
defining standard interfaces and system
invariants
o Other tools — including an object-code archive
manager (ar), symbol-table lister (nm), compiler-
development tools (e.g. lex & yacc), and
debugging tools.
• Commands — Unix makes little distinction between
commands (user-level programs) for system operation
and maintenance (e.g. cron), commands of general
utility (e.g. grep), and more general-purpose
applications such as the text formatting and
typesetting package. Nonetheless, some major
categories are:
o sh — The "shell" programmable command line
interpreter, the primary user interface on Unix
before window systems appeared, and even
afterward (within a "command window").
o Utilities — the core tool kit of the Unix command
set, including cp, ls, grep, find and many
others. Subcategories include:
 System utilities — administrative tools such
as mkfs, fsck, and many others
 User utilities — environment management
tools such as passwd, kill, and others.
o Communications — Early Unix systems contained no
inter-system communication, but did include the
inter-user communication programs mail and write.
V7 introduced the early inter-system
communication system UUCP, and systems beginning
with BSD release 4.1c included TCP/IP utilities.

The 'man' command can display a manual page for every


command on the system, including itself.

• Documentation — Unix was the first operating system to


include all of its documentation online in machine-
readable form. The documentation included:
o man — manual pages for each command, library
component, system call, header file, etc.
o doc — longer documents detailing major
subsystems, such as the C language and troff

Unix impact

The Unix system had significant impact on other operating


systems.

• It was written in high level language as opposed to


assembly language.
• Unix had a drastically simplified file model compared
to many contemporary operating systems, treating all
kinds of files as simple byte arrays.
• Making the command interpreter an ordinary user-level
program, with additional commands provided as separate
programs, was another Multics innovation popularized
by Unix.
• The Unix shell used the same language for interactive
commands as for. Since the shell and OS commands were
"just another program", the user could choose (or even
write) his own shell. New commands could be added
without changing the shell itself.
• Unix popularized a syntax for regular expressions that
found widespread use
• The C programming language soon spread beyond Unix,
and is now ubiquitous in systems and applications
programming.
• Unix provided the TCP/IP networking protocol on relatively inexpensive
computers,

Free Unix-like operating systems

In 1983, Richard Stallman announced the GNU project, an


ambitious effort to create a free software Unix-like
system; "free" in that everyone who received a copy would
be free to use, study, modify, and redistribute it. In
addition to their use in the Linux operating system, many
GNU packages — such as the GNU Compiler Collection, the GNU
C library and the GNU core utilities — have gone on to play
central roles in other free Unix systems as well.

Linux distributions, Popular distributions include Red Hat


Enterprise Linux, Fedora, SUSE Linux Enterprise, openSUSE,
Debian GNU/Linux, Ubuntu, Mandriva Linux, Slackware Linux
and Gentoo.

Summary on Unix commands

• Directory and file creation and navigation: ls, cd, pwd,


mkdir, rm, rmdir, cp , find, touch, mv.
• File viewing and editing: more, less, ed, vi, emacs,
head, tail.
• Text processing: echo, cat, grep, sort, uniq, sed,
awk, cut, tr, split, printf.
• File comparison: comm, cmp, diff, patch .
• Miscellaneous shell tools: yes, test, xargs, tee.
• System administration: chmod, chown, ps, su, w ,who.
• Communication: mail, telnet, ftp, finger, ssh.
• Authentication: su, login, passwd.
BASIC SHELL COMMANDS

GENERAL PURPOSE COMMANDS:

 Command : Date

 Command : cal

 Command : echo

 Command : who am i

 Command : who

 Command : clear

1. TASK : To display the system date and time.


COMMAND : date.
SYNTAX : date.
EXPLANATION : This command displays the current system
date and time on the screen.

2. TASK : To display the current month.


COMMAND : date.
SYNTAX : date +%m.
EXPLANATION : This command displays the current month on
the screen.

3. TASK : To display the name of the current month.


COMMAND : date.
SYNTAX : date +%h.
EXPLANATION : This command displays the name of the
current month on the screen.

4. TASK : To display the current system date.


COMMAND : date.
SYNTAX : date +%d.
EXPLANATION : This command displays the current system
date on the screen.

5. TASK : To display the current system date (year).


COMMAND : date.
SYNTAX : date +%y.
EXPLANATION : This command displays the current year on
the screen.

6. TASK : To display the current system time.


COMMAND : date.
SYNTAX : date +%H.
EXPLANATION : This command displays the current system
time (in hours) on the screen.

7. TASK : To display the current system time.


COMMAND : date.
SYNTAX : date +%M.
EXPLANATION : This command displays the current system
time (in minutes) on the screen.

8. TASK : To display the current system time.


COMMAND : date.
SYNTAX : date +%S.
EXPLANATION : This command displays the current system
time (in seconds) on the screen.

9. TASK : To display the calendar of the current


month.
COMMAND : calendar.
SYNTAX : cal.
EXPLANATION : This command displays the calendar of the
current month on the screen.
10. TASK : To display user-defined message.
COMMAND : echo.
SYNTAX : echo “message”.
EXPLANATION : This command displays on the screen the
argument of the echo command.

11. TASK : To display the details of all users.


COMMAND : who.
SYNTAX : who.
EXPLANATION : This command lists the information about
all the users who have logged on to that
system.

12. TASK : To display the user detail.


COMMAND : who.
SYNTAX : whoami.
EXPLANATION : This command displays information about
the current user of the system on the
screen.

13. TASK : To clear the working terminal.


COMMAND : clear.
SYNTAX : clear.
EXPLANATION : This command clears the contents in the
working terminal.

FILE AND DIRECTORY COMMANDS

 Command : mkdir

 Command : rmdir

 Command : cat

 Command : pwd

 Command : cd
 Command : cp

 Command : mv

 Command : rm

 Command : ls

 Command : wc

1. TASK : To create a directory.


COMMAND : make directory.
SYNTAX : mkdir.
EXPLANATION : This command is used to create a new
directory with the specified name.

2. TASK : To change directory.


COMMAND : change directory.
SYNTAX : cd directory name.
EXPLANATION : This command is used to switch from one
directory to another.

3. TASK : To delete a directory.


COMMAND : remove directory.
SYNTAX : rmdir directory name
EXPLANATION : This command is used to delete the
specified directory.

4. TASK : To come out of a sub-directory.


COMMAND : change directory.
SYNTAX : cd ..
EXPLANATION : This command helps in switching to the
main directory.

5. TASK : To list all the files and directories.


COMMAND : list.
SYNTAX : ls.
EXPLANATION : This command displays all the files and
directories of the system.

6. TASK : To create a file.


COMMAND : cat.
SYNTAX : cat> file name.
EXPLANATION : This command leads to the creation of
a new file with the specified file
name and contents.

7. TASK : To view a file.


COMMAND : cat.
SYNTAX : cat file name.
EXPLANATION : This command displays the contents of
the specified file.

8. TASK : To copy a file.


COMMAND : copy.
SYNTAX : cp sourcefile destinationfile.
EXPLANATION : This command produces a copy of the
source file and is stored in the
specified destination file by
overwriting its previous contents.

9. TASK : To move a file.


COMMAND : move.
SYNTAX : mv sourcefile destinationfile.
EXPLANATION : After moving the contents of the
source file into destination file, the
source file is deleted.

10. TASK : To delete a file.


COMMAND : remove.
SYNTAX : rm file name.
EXPLANATION : This command deletes the specified
file from the directory.

11. TASK : To count the file content


COMMAND : word count
SYNTAX : wc [-l –w –c] filename.
EXPLANATION : This command displays the number of
lines,words,characters in a file.

12. TASK : To print the current working directory.


COMMAND : print working directory.
SYNTAX : pwd.
EXPLANATION : This command prints the current
working directory.
FILTERS AND PIPES

 Command : head

 Command : tail

 Command : more

 Command : grep

 Command : sort

 Command : cut

 Command : paste

 Command : tr

1. TASK : To retrieve a part of a file.


COMMAND : head.
SYNTAX : head -no. of rows file name.
EXPLANATION: This command displays the specified no. of
rows form the top of the specified file.

2. TASK : To retrieve a file.


COMMAND : tail.
SYNTAX : tail -no. of rows file name.
EXPLANATION: This command displays the specified no. of
rows form the bottom of the specified file.

3. TASK : To sort the contents of a file.


COMMAND : sort.
SYNTAX : sort file name.
EXPLANATION : This command helps in sorting the
contents of a file in ascending order.

4. TASK : To display / cut a column from a file.


COMMAND : cut.
SYNTAX : cut –c no. file name.
EXPLANATION : This command displays the characters of a
particular column in the specified file.

5. TASK : To search the particular sting in a file.


COMMAND : grep.
SYNTAX : grep “string to find”. file name.
EXPLANATION : This command finds the particular string
and displays if found in the specified file.

6 . TASK : To read a text file.


COMMAND : more
SYNTAX : more text-filename.
EXPLANATION : More is a command used to read text files.

COMMUNICATION THROUGH UNIX COMMANDS:

 Command : mesg

 Command : write

 Command : wall

 Command : mail

 Command : reply
Text Editors
Text editors are similar to word processors, providing
various features for writing documents. Several text
editors are available on Linux.

Vi: Vi is often the default editor that pops


up when you're ready to write an e-mail message or when
you're posting a News message .It is often the default for
Unix and Linux systems.

Pico: Pico is a fairly simple text editor that


provides straight-forward options and easy-to-use
commands. Although some programmers have frowned at Pico's
simplicity and limited options, most folks find that it
provides everything necessary to write long documents with
minimal hassles. However, Pico is not very good when
manipulating certain types of files such as making changes
to .cgi files etc.

Emacs: Emacs falls somewhere between the


straightforward Pico and the complicated Vi. Unlike Vi,
you don't need to switch between modes to perform basic
text editing functions.The vast set of powerful commands
themselves are difficult to remember.

Vi Editor
Start the Vi editor by typing vi at the prompt. Typing vi
followed by a file name will automatically name the file so
you don't have to worry about it later.

Vi has two modes: Command mode that lets you use commands
to edit, save, or quit; and Text mode that lets you type.
If you attempt to do something in the wrong mode, the
system beeps furiously at you until you either stop
pressing keys or scream. Use the Esc key to change from one
mode to the other.

Text Writing Mode

The Vi editor starts in the Command mode. To switch to the


Text mode and begin typing, press i.If you hear several
beeps and you're unable to type, then press i twice.
Command Mode

Press the Esc key to switch from Text mode to Command mode.
Moving Around

Saving and Exiting

:q! quit Vi without saving anything


:w save/write the file you're working on without
filename exiting type:
:wq save/write your file and quit the vi editor in
one step by typing

Text Insertion :

i/I Invokes insertion mode


O Allows insertion by creating blank line above
current line.
o Allows insertion by creating blank line below
current line.
A Appends text at end of line
a Appends text at cursor position

Deleting Data :

dd Deletes line in which cursor is positioned


dw Deletes the word from cursor positioned to end
of word (Stops at punctuation)
dW Deletes the word from cursor positioned to end
of word (Ignores punctuation)
x Deletes character at cursor position
X Deletes character before cursor position
D Deletes line in which cursor is positioned to
end of line.

Вам также может понравиться