R4R provide basic UNIX Tutorials concept with
UNIX Examples .
Through R4R you can develop UNIX programming concept. R4R provide
UNIX Interview Questions with answers.R4R provide UNIX Languages study materials in easy way.
Introduction of Unix:
UNIX is an operating system which was first developed in the 1960s, and has
been under constant development ever since. It is a stable, multi-user,
multi-tasking system for servers, desktops and laptops. The philosophy behind
the design of UNIX was to provide simple, yet powerful utilities that could be
pieced together in a flexible manner to perform a wide variety of tasks .UNIX
systems also have a graphical user interface (GUI) similar to Microsoft Windows
which provides an easy to use environment. However, knowledge of UNIX is
required for operations which aren't covered by a graphical program, or for when
there is no windows interface available, for example, in a telnet session.
The UNIX operating system comprises three parts:
- The kernel
- The standard utility programs
- The system configuration files.

The kernel
The kernel is the core of the UNIX operating system. Basically, the
kernel is a large program that is loaded into memory when the machine is turned
on, and it controls the allocation of hardware resources from that point
forward. The kernel knows what hardware resources are available (like the
processor's), the on-board memory, the disk drives, network interfaces, etc.),
and it has the necessary programs to talk to all the devices connected to it.
The Shell
The shell acts as an interface between the user and the kernel. When a user logs
in, the login program checks the username and password, and then starts another
program called the shell. The shell is a command line interpreter (CLI). It
interprets the commands the user types in and arranges for them to be carried
out. The commands are themselves programs: when they terminate, the shell gives
the user another prompt (% on our systems)
The system configuration files:
The system configuration files are read by the kernel, and some of
the standard utilities. The UNIX kernel and the utilities are flexible programs,
and certain aspects of their behavior can be controlled by changing the standard
configuration files. One example of a system configuration file is the
filesystem table "fstab" , which tells the kernel where to find all the files on
the disk drives. Another example is the system log configuration file "syslog.conf",
which tells the kernel how to record the various kinds of events and errors it
may encounter.
History Of Unix:
The UNIX story start in 1969, when AT&T Bell Labs dropped out of a joint
project between themselves, General Electric, and the Massachusetts Institute of
Technology. Multics, the project in question, was an experimental operating
system on the GE 645 .
Ken Thompson and Dennis Ritchie, both from Bell Labs, had been exposed to the
Multics project. They ported a game, called `Space Travel', from the GE 645
running Multics, onto a PDP-7. To help them do the porting, Thompson wrote a
``simple file system and some utilities for the PDP-7" [8, p. 3]. This was the
birth of UNIX, in 1970 (``UNIX" was meant to be a pun on ``Multics").
Late in 1970, a PDP-11/20 was purchased, and UNIX became an official Bell Labs
project. The first UNIX edition ``was documented in a manual authored by
Thompson and Ritchie dated November 1971" [1, p. 2]. Most of the ideas found in
today's UNIX systems were incorporated in this edition.
The second edition, 1972, incorporated the piping concept.
In 1973, UNIX was re-written in C, by Thompson and Ritchie. Note that Ritchie
developed the C language (derived from the B language by Thompson) at
approximately the same time.
UNIX was first distributed in May 1975 for a nominal fee. This was UNIX Version
6.
In 1979, a more portable version of UNIX (Version 7) was released for general
use; from here, three major UNIX versions emerged: BSD (Berkeley System
Distribution), XENIX, and AT&T's System V.
Unix Architecture:

a typical Unix system running in a high-end PC or low- to midrange
workstation will consist of a single monolithic kernel, perhaps augmented with
dynamically loadable drivers or shared libraries (see chart, p. 12A). The Unix
system call interface is implemented directly by the operating system kernel.
Microkernel-based Unix-like operating systems, such as Mach and others, lie
somewhere between a conventional BSD Unix implementation and Windows NT's
executive/protected subsystem model. The Unix run-time environment consists of
library calls, operating-system service calls, and remote procedure calls (RPCs).
Library calls typically are linked into an application's user space either
statically or via a dynamically loaded or shared library. Operating-system
service calls are entry points into the Unix kernel and provide relatively
low-level system services such as file I/O, TCP/IP sockets I/O, and RPCs. Unix
variants provide a variety of other services to applications, such as shared
memory, threads, and hardware-specific features.
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).
A file is a collection of data. They are created by users using text editors,
running compilers etc.
Examples of files:
- The text of a program written in some high-level programming language.
- A document (report, essay etc.)
- 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.
Some Important Command in Unix:
| Command |
Meaning |
| ls |
list files and directories |
| ls -a |
list all files and directories |
| mkdir |
make a directory |
| cd directory |
change to named directory |
| cd |
change to home-directory |
| cd ~ |
change to home-directory |
| cd .. |
change to parent directory |
| pwd |
display the path of the current directory |
Advantage of Unix:
- Full multitasking with protected memory.
- Very efficient virtual memory, so many programs can run with a modest
amount of physical memory.
- Access controls and security. All users must
be authenticated by a valid account and password to use the system at all.
- The traditional command line shell interface is user hostile -- designed
for the programmer, not the casual user.
- Available on a wide variety of machines - the most truly portable
operating system.
- Optimized for program development, and thus for the unusual circumstances
that are the rule in research.
Disadvantage of Unix
- The traditional command line shell interface is user hostile -- designed
for the programmer, not the casual user.
- Commands often have cryptic names and give
very little response to tell the user what they are doing. Much use of special
keyboard characters - little typos have unexpected results.
- To use Unix well, you need to understand
some of the main design features. Its power comes from knowing how to make
commands and programs interact with each other, not just from treating each as
a fixed black box.
- Richness of utilities (over 400 standard
ones) often overwhelms novices. Documentation is short on examples and
tutorials to help you figure out how to use the many tools provided to
accomplish various kinds of tasks.
Tolal:0 Click:
Show All Comments