16-02-2013, 09:32 AM
Introduction to Unix
Introduction to Unix.pdf (Size: 933.02 KB / Downloads: 14)
History of Unix
1965 Bell Laboratories joins with MIT and General Electric in the development effort for the new
operating system, Multics, which would provide multi-user, multi-processor, and multi-level
(hierarchical) file system, among its many forward-looking features.
1969 AT&T was unhappy with the progress and drops out of the Multics project. Some of the Bell
Labs programmers who had worked on this project, Ken Thompson, Dennis Ritchie, Rudd Canaday,
and Doug McIlroy designed and implemented the first version of the Unix File System on a PDP-7
along with a few utilities. It was given the name UNIX by Brian Kernighan as a pun on Multics.
The Operating System
Unix is a layered operating system. The innermost layer is the hardware that provides the services for
the OS. The operating system, referred to in Unix as the kernel, interacts directly with the hardware
and provides the services to the user programs. These user programs don’t need to know anything
about the hardware. They just need to know how to interact with the kernel and it’s up to the kernel
to provide the desired service. One of the big appeals of Unix to programmers has been that most
well written user programs are independent of the underlying hardware, making them readily portable
to new systems.
User programs interact with the kernel through a set of standard system calls. These system calls
request services to be provided by the kernel. Such services would include accessing a file: open
close, read, write, link, or execute a file; starting or updating accounting records; changing ownership
of a file or directory; changing to a new directory; creating, suspending, or killing a process; enabling
access to hardware devices; and setting limits on system resources.
Unix is a multi-user, multi-tasking operating system. You can have many users logged into a
system simultaneously, each running many programs. It’s the kernel’s job to keep each process and
user separate and to regulate access to system hardware, including cpu, memory, disk and other I/O
devices.
Unix Directories, Files and Inodes
Every directory and file is listed in its parent directory. In the case of the root directory, that parent
is itself. A directory is a file that contains a table listing the files contained within it, giving file
names to the inode numbers in the list. An inode is a special file designed to be read by the kernel to
learn the information about each file. It specifies the permissions on the file, ownership, date of
creation and of last access and change, and the physical location of the data blocks on the disk
containing the file.
The system does not require any particular structure for the data in the file itself. The file can be
ASCII or binary or a combination, and may represent text data, a shell script, compiled object code
for a program, directory table, junk, or anything you would like.
There’s no header, trailer, label information or EOF character as part of the file.
Unix Programs
A program, or command, interacts with the kernel to provide the environment and perform the
functions called for by the user. A program can be: an executable shell file, known as a shell script; a
built-in shell command; or a source compiled, object code file.
The shell is a command line interpreter. The user interacts with the kernel through the shell. You can
write ASCII (text) scripts to be acted upon by a shell.
System programs are usually binary, having been compiled from C source code. These are located in
places like /bin, /usr/bin, /usr/local/bin, /usr/ucb, etc. They provide the functions that you normally
think of when you think of Unix. Some of these are sh, csh, date, who, more, and there are many
others.
Passwords
When your account is issued, you will be given an initial password. It is important for system and
personal security that the password for your account be changed to something of your choosing. The
command for changing a password is "passwd". You will be asked both for your old password and to
type your new selected password twice. If you mistype your old password or do not type your new
password the same way twice, the system will indicate that the password has not been changed.
Some system administrators have installed programs that check for appropriateness of password (is it
cryptic enough for reasonable system security). A password change may be rejected by this program.
When choosing a password, it is important that it be something that could not be guessed -- either by
somebody unknown to you trying to break in, or by an acquaintance who knows you.
Identity
The system identifies you by the user and group numbers (userid and groupid, respectively)
assigned to you by your system administrator. You don’t normally need to know your userid or
groupid as the system translates username userid, and groupname groupid automatically. You
probably already know your username; it’s the name you logon with. The groupname is not as
obvious, and indeed, you may belong to more than one group. Your primary group is the one
associated with your username in the password database file, as set up by your system administrator.
Similarly, there is a group database file where the system administrator can assign you rights to
additional groups on the system.
Directory Navigation and Control
The Unix file system is set up like a tree branching out from the root. The the root directory of the
system is symbolized by the forward slash (/). System and user directories are organized under the
root. The user does not have a root directory in Unix; users generally log into their own home
directory. Users can then create other directories under their home. The following table summarizes
some directory navigation commands.