Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Theory:

UNIX is a computer operating system. An operating system is the software that provides the
interface between the hardware of a computer system and the applications programs that are used
on it Popular operating systems include DOS (used on PCs), Windows XP, Windows 2003 sever,
Linux, Solaris, Apple Mac, IBM AIX, UNIX, etc. UNIX is available on a wide variety of
computer systems, including personal computers, workstations, mainframes and supercomputers.
It was developed for, and is particularly well-suited to, multi-user systems, but is now also run
on 'stand-alone' machines.

The UNIX operating system is made up of three parts; the kernel, the shell and the
programs.

The kernel:
The kernel of UNIX is the hub of the operating system: it allocates time and memory to
programs and handles the filestore and communications in response to system calls.
As an illustration of the way that the shell and the kernel work together, suppose a user
types rm myfile (which has the effect of removing the file myfile). The shell searches the
filestore for the file containing the program rm, and then requests the kernel, through system
calls, to execute the program rm on myfile. When the process rm myfile has finished running,
the shell then returns the UNIX prompt “[root@servername root]#” to the user, indicating that it
is waiting for further commands.

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 ([root@servername root]# on our systems).
The adept user can customize his/her own shell, and users can use different shells on the
same machine.
There are a number of different common shells on various UNIX operating systems. The
most common are as follows:
s The Bourne shell is the most common of all the shells. (May be
h installed as bsh.)
k The Korn shell is a derivative of the Bourne shell, which adds
sh history and command-line editing. (Sometimes installed as sh.)
s The POSIX shell is much like the Korn shell. The POSIX standard
h requires it to be installed as sh. Some vendors install it as /bin/sh. Some put
it in a special directory and call it sh, leaving the Bourne shell as /bin/sh.
c The C shell is based on the popular C language.
sh
b The Born Again shell is less common.
ash
t This is a version of the C shell with interactive command-line
csh editing.

Different UNIX systems


They are many different versions of Unix, as well as some Unix 'lookalikes'. The most
widely used are:
1. System V (distributed by the original developers, AT&T)
2. AIX (IBM)
3. Berkeley BSD (from the University of California, Berkeley)
4. SunOS, now known as Solaris (from the makers of Sun workstations)
5. Xenix (a PC version of UNIX).

The UNIX operating system consists basically of the kernel and the shell. The kernel is the part
carries out basic operating system functions such as accessing files, allocating memory and
handling communications.
A shell provides the user interface to the kernel. A number of shells are available on the
UNIX operating system including the Bourne shell and the C shell. The shell is basically an
extensive program that runs all the time that you are logged on to the computer, and provides an
interactive interface between the user and the computer functions. The C shell is the default shell
for interactive work on many UNIX systems

UNIX has following types of files:


1. Simple file
2. Directory
3. Symbolic (soft) link
4. Special file (device)
5. Pipe (FIFO)

Simple File:
All files treated the same – extension means nothing.
Application interprets the contents of a file

Directory = Folder
File that contains the names/inodes of other files in the directory.

Link File:
Pointer to another file in a distant directory
Software link: created using the ln –s command

Special File:
Interfaces with devices:
Character special files or character-oriented devices: terminal, mouse, keyboard
Block special files or block-oriented devices: floppy or CD drive
fd0: floppy drive 0
hda: hard drive A
lp0: line printer 0
tty: teletype terminal

Pipe or FIFO
Enables two processes to send & receive data.
IPC: Used for InterProcess Communication
One process writes to the buffer; the other process reads
E.g.: ls –l | more
Two types:
Named Pipe or FIFO: Between unrelated processes
Pipe: Between related processes: e.g. parent & child

UNIX Commands

Simple commands:

1. Cal :
Syntax – cal year
Use – Print the calendar for the mentioned year.
2. rm:
Syntax- rm filename
Use- To remove a file.
3. Syntax – rm filename

Use – This command is used to delete one or more files from the directory

4. Who:
Syntax - who
Use – List of current users who are logged in ,is displayed.
5. Tty:
Syntax - tty
Use – It tells us to filename of terminal we are using.

6. echo:
Syntax - echo
Use – use to display the message.
7. Ls
Syntax - ls
Use – Displays all the files and directories of the current directory

8. Mkdir
Syntax – mkdir name
Use – Creates a new directory
9. Rmdir
Syntax – rmdir name
Use – Removes mentioned directory.
10. Grep
Syntax – grep “string” filename
Use – Searches for a specific string in the specified file and displays
whole line.

11. Wc
Syntax – wc filename
Use – Displays a count of characters, words and lines of a specified file.

You might also like