You are on page 1of 15

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 from PC operating
systems such as MS-DOS or MS-Windows (which allows multiple tasks to be
carried out simultaneously but not multiple users).
• 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,
namely, Sun Microsystems, Santa Cruz Operation, International Business
Machines, and Hewlett-Packard, Novell granted exclusive licensing rights of 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 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).

UNIX Philosophy
• Make each program do one thing well. Reusable software tools: 1 tool = 1
function
• Expect the output of every program to become the input of another, yet unknown,
program to combine simple tools to perform complex tasks
• Prototyping: get something small working as soon as possible and modify it
incrementally until it is finished
• Use terse commands and messages: reduces typing and screen output

Why UNIX?
• Hardware independence
o operating system code is written in C language rather than a specific
assembly language
o operating system software can be easily moved from one hardware system
to another
o UNIX applications can be easily moved to other UNIX machines. Porting
is usually as simple as transfer of the source and a recompile
• Productive environment for software development
o rich set of tools
o versatile command language
• Distributed processing and multi-tasking

UNIX Components
• Kernel
o The core of the UNIX system. Loaded at system start up (boot). Memory-
resident control program.
o Manages the entire resources of the system, presenting them to you and
every other user as a coherent system. Provides service to user
applications such as device management, process scheduling, etc.
o Example functions performed by the kernel are:
 managing the machine's memory and allocating it to each process.
 scheduling the work done by the CPU so that the work of each user
is carried out as efficiently as is possible.
 accomplishing the transfer of data from one part of the machine to
another
 interpreting and executing instructions from the shell
 enforcing file access permissions
o You do not need to know anything about the kernel in order to use a
UNIX system. These details are provided for your information only.
• Shell
o Whenever you login to a Unix system you are placed in a shell program.
The shell's prompt is usually visible at the cursor's position on your screen.
To get your work done, you enter commands at this prompt.
o The shell is a command interpreter; it takes each command and passes it to
the operating system kernel to be acted upon. It then displays the results of
this operation on your screen.
o Several shells are usually available on any UNIX system, each with its
own strengths and weaknesses.
o Different users may use different shells. Initially, your system
adminstrator will supply a default shell, which can be overridden or
changed. The most commonly available shells are:
 Bourne shell (sh)
 C shell (csh)
 Korn shell (ksh)
 TC Shell (tcsh)
 Bourne Again Shell (bash)
o Each shell also includes its own programming language. Command files,
called "shell scripts" are used to accomplish a series of tasks.
• Utilities
o UNIX provides several hundred utility programs, often referred to as
commands.
o Accomplish universal functions
 editing
 file maintenance
 printing
 sorting
 programming support
 online info
 etc.
o Modular: single functions can be grouped to perform more complex tasks

System V vs. BSD


• AT&T distributes System V for their computers. System V is also the basis for
several commercial implementations including:
o Hewlett-Packard HP-UX
o Apple AUX
o Amdahl UTS
o Cray UNICOS
o 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".

Pronounced yoo-niks, a popular multi-user, multitasking operating system developed at


Bell Labs in the early 1970s. Created by just a handful of programmers, UNIX was
designed to be a small, flexible system used exclusively by programmers.

UNIX was one of the first operating systems to be written in a high-level programming
language, namely C. This meant that it could be installed on virtually any computer for
which a C compiler existed. This natural portability combined with its low price made it a
popular choice among universities. (It was inexpensive because antitrust regulations
prohibited Bell Labs from marketing it as a full-scale product.)

Bell Labs distributed the operating system in its source language form, so anyone who
obtained a copy could modify and customize it for his own purposes. By the end of the
1970s, dozens of different versions of UNIX were running at various sites.

After its breakup in 1982, AT&T began to market UNIX in earnest. It also began the long
and difficult process of defining a standard version of UNIX.

Due to its portability, flexibility, and power, UNIX has become a leading operating
system for workstations. Historically, it has been less popular in the personal computer
market.

Today, the trademarked "Unix" and the "Single UNIX Specification" interface are owned
by The Open Group. An operating system that is certified by The Open Group to use the
UNIX trademark conforms to the Single UNIX Specification.

According to The Open Group's Web site, "As the owner of the UNIX trademark, The
Open Group has separated the UNIX trademark from any actual code stream itself, thus
allowing multiple implementations. Since the introduction of the Single UNIX
Specification, there has been a single, open, consensus specification that defines the
requirements for a conformant UNIX system. There is also a mark, or brand, that is used
to identify those products that have been certified as conforming to the Single UNIX
Specification, initially UNIX 93, followed subsequently by UNIX 95, UNIX 98 and now
UNIX 03. Both the specification and the UNIX trade mark are managed and held in trust
for the industry by The Open Group."

An Overview of the UNIX* Operating System

The UNIX* operating system was designed to let a number of


programmers access the computer at the same time and share its
resources.

The operating system coordinates the use of the computer's resources,


allowing one person, for example, to run a spell check program while
another creates a document, lets another edit a document while
another creates graphics, and lets another user format a document --
all at the same time, with each user oblivious to the activities of the
others.

The operating system controls all of the commands from all of the
keyboards and all of the data being generated, and permits each user
to believe he or she is the only person working on the computer.

This real-time sharing of resources make UNIX one of the most


powerful operating systems ever.

Although UNIX was developed by programmers for programmers, it


provides an environment so powerful and flexible that it is found in
businesses, sciences, academia, and industry. Many
telecommunications switches and transmission systems also are
controlled by administration and maintenance systems based on UNIX.

While initially designed for medium-sized minicomputers, the operating


system was soon moved to larger, more powerful mainframe
computers. As personal computers grew in popularity, versions of
UNIX found their way into these boxes, and a number of companies
produce UNIX-based machines for the scientific and programming
communities.

The uniqueness of UNIX

The features that made UNIX a hit from the start are:

• Multitasking capability
• Multiuser capability
• Portability
• UNIX programs
• Library of application software

Multitasking

Many computers do just one thing at a time, as anyone who uses a PC


or laptop can attest. Try logging onto your company's 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.

Multiusers

The same design that permits multitasking permits multiple users to


use the computer. 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.
UNIX tools

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 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.

Tools can be added or removed from a UNIX system, depending


upon the applications required.

UNIX Communications

E-mail is commonplace today, but it has only come into its own in the
business community within the last 10 years. Not so with UNIX users,
who have been enjoying e-mail for several decades.

UNIX e-mail at first permitted users on the same computer to


communicate with each other via their terminals. Then users on
different machines, even made by different vendors, were connected
to support e-mail. And finally, UNIX systems around the world were
linked into a world wide web decades before the development of
today's World Wide Web.

Applications libraries
UNIX as it is known today didn't just develop overnight. Nor were just
a few people responsible for it's growth. As soon as it moved from Bell
Labs into the universities, every computer programmer worth his or
her own salt started developing programs for UNIX.

Today there are hundreds of UNIX applications that can be purchased


from third-party vendors, in addition to the applications that come
with UNIX.

How UNIX is organized

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

The three levels of the UNIX system: kernel, shell, and tools
and applications.

The kernel

The heart of the operating system, the kernel controls the hardware
and turns part of the system on and off at the programer'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.

Date commands

Format specifiers (format string starts starts with +)

Specifier Description Values/Example

Day

%a weekday, abbreviated Wed

%A weekday, full Wednesday

day of the month (dd), zero


%d 10
padded
%e day of the month (dd) 10

%j day of year, zero padded 000-366

day of week starting with


%u 3
Monday (1), i.e. mtwtfss

day of week starting with


%w 3
Sunday (0), i.e. smtwtfs

Week

week number Sunday as first


%U 01–53
day of week

week number Monday as first


%W 01–53
day of week

%V week of the year 01–53

Month

%m mm month 02

%h Mon Feb

%b Mon, locale's abbreviated Feb

locale's full month, variable


%B February
length
Year

%y yy two digit year 00–99

%Y ccyy year 2010

2-digit year corresponding to


%g
the %V week number

4-digit year corresponding to


%G
the %V week number

Century

%C cc century 00–99

Date

%D mm/dd/yy 02/10/10

locale's date representation


%x 02/10/2010
(mm/dd/yy)

%F %Y-%m-%d 2010-02-10

Hours

%l
(Lowercase hour (12 hour clock) 8
L)
%I
hour (12 hour clock) zero
(Uppercase 08
padded
I)

%k hour (24 hour clock) 8

hour (24 hour clock) zero


%H 08
padded

locale's upper case AM or PM


%p AM
(blank in many locales)

locale's lower case am or pm


%P am
(really!)

Minutes

%M MM minutes 03

Seconds

seconds since 00:00:00 1970-


%s 1265789036
01-01 UTC (Unix epoch)

%S SS second 00–60
(The 60 is necessary to accommodate a leap second)

%N nanoseconds 000000000–999999999

Time

%r hours, minutes, seconds (12- 08:03:56 AM


hour clock)

%R hours, minutes (24 hour clock) hh:mm e.g. 08:03

hours, minutes, seconds (24-


%T 08:03:56
hour clock)

locale's time representation


%X
(%H:%M:%S)

Date and Time

%c locale's date and time Sat Nov 04 12:02:33 EST 1989

Time zone

-zzzz RFC-822 style numeric


%z -0500
timezone

time zone (e.g., EDT) nothing


%Z EST
if no time zone is determinable

literals: %n newline %% percent %t horizontal tab

By default, date pads numeric fields with zeroes.

GNU date, but not BSD date, recognizes - (hyphen) do not pad the field and _
(underscore) pad the field with spaces between % and a numeric directive.

TZ Specifies the timezone, unless overridden by command line parameters. If neither is


specified, the setting from /etc/localtime is used.

[edit] Options

-d, -de=string display time described by string, not now.


-e=datefile like de once for each line of datefile

-s, --set=string set time described by string

-n don't synchronize the clocks on groups of machines using the utility timed(8). By
default, if timed is running, date will set the time on all of the machines in the local
group. -n inhibites that.

-u Display or set the date in UTC (universal) time.

date [-u|--utc|--universal] [mmddHHMM[[cc]yy].SS The only valid option for the this
form specifies Coordinated Universal Time.

-u GMT ex: Sat Feb 5 14:49:42 GMT 2005

--utc, --universal Coordinated Universal Time local TZ Sat Feb 5 09:49:59 EST 2005

-ITIMESPEC, --iso-8601[=TIMESPEC] output date/time in ISO 8601 format.


TIMESPEC=date for date only, hours, minutes, or seconds for date and time to the
indicated precision.

--iso-8601 without TIMESPEC defaults to `date'.

-R, --rfc-822 output RFC-822 compliant date string, example: Wed, 16 Dec 2009
15:18:11 +0100

--help

The Single Unix Specification (SUS) mandates only one option: -u, where the date and
time is printed as if the timezone was UTC+0. Other Unix and Unix-like systems provide
extra options.

[edit] Examples

date "+%m/%d/%y"
7/4/06
date "+%Y%m%d"
20060704

To assign the time to a variable

START=`date '+%r'`
echo $START
03:06:02 PM
sleep 5
echo $START
03:06:02 PM
N.B. the variable has the time when it was assigned.

Yesterday assigned to variable

DATE=$(date -d yesterday +"%Y%m%d")


echo $DATE
20060704

You might also like