Professional Documents
Culture Documents
Introduction to Unix
➢ UNIX is an operating system that is a software that acts as an interface between the user
and computer h/w.
➢ An operating system acts as a resource manager.
➢ Here resources mean hardware resources like the processor, the main memory, the
hard disk, i/o devices and other peripherals.
➢ In addition to being a multi-user operating system UNIX gives its users, the feeling of
working an independent computer system.
➢ UNIX also provides communication facility with other users who are connected to the system
either directly or indirectly via certain sort of networking.
➢ UNIX is an Operating System that is truly the base of all Operating Systems like Ubuntu,
Solaris, POSIX, etc. It was developed in the 1970s by Ken Thompson, Dennis Ritchie, and
others in the AT&T Laboratories. It was originally meant for programmers developing
software rather than non-programmers.
UNIX components
The kernel:
➢ The kernel is the only component that can communicate with all hardware directly.
➢ Kernel manages all the system resources like memory and i/o devices on the
hardware, allocated time between users and processes in the case of multi-user
environment, decides process priorities, manages inter process communication and
performs many other such tasks.
Monolithic kernels
➢ Earlier, all the programs that were part of a kernel , were integrated,
together and moved onto the memory during booting. Such integrated
kernels are referred to as,' monolithic kernels'.
➢ Micro kernel: Now -a-days, all the programs are grouped into different
modules and only the just necessary module is moved on to the
memory during boating. This just necessary and sufficient module
consisting of a small set of kernel program is called a "micro kernel"
Shell
➢ Every UNIX system has atleast one shell. A shell is a program that
sites on kernel and acts as an agent or interface between the users and
the kernel and hence the hardware. A shell is a command interpreter or
processor at which the user can type in any UNIX command.
➢ Types of shells: There are different types of shells available. Some of
them are. v/ The bourne shell (sh):
➢ This is the first major shell to be developed and is named after its author,
Stephen bourne.
➢ This is the most common shell and is distributed as the standard shell on
almost all unix systems. v/ C shell(csh):
➢ Bill joy , developed this shell at VCB as a part of the BSD r
➢ It is called c shell because is syntax and usuage is very similar to the 'c'
programming language . v/ Korn shell(ksh):
➢ This shell was developed by david korn at AT &T bell labs.
➢ It has the both features of bourne shell and c shell and is one of the
widely used shells. Bourne-again shell (bash):
➢ A file system is another major component of a Unix system. Unix treats
everything including hardware devices as a file.
➢ When the user completes the session with system the comes out of unix
environment . The process of coming out of unix environment is
known as logging out.
External commands:
Internal commands:
pwd :
SYNTAX: pwd
Exmaple:
Mkdir:
Creates one or more new directories.
Syntax : cd g
2. Execute the following list of basic commands in Unix :
Syntax
who [ -a I -b -d -i -l -m -p -q -r -s -t -u-w-A-H-T-X][
File ] who am { i | l }
Rm:
Removes (unlinks) files or directories
Example: rm myfile1
Example:
OUTPUT:
Cp: Copies file
Example:
If you want to copy a file named file.txt from the current directory to a
directory named destination.
Output:
4. Execute the basic file attribute with all possible options.
Ls: Displays the content of a directory
Example: ls -l *.txt
Example:
date "+%m/%d/%y"
date "+%Y%m%d"
date +'%-4.4h %2.1d %H:%M'
5. Execute basic commands using vi editor.
Vi editor:
The default editor that comes with the UNIX operating system is called vi
(visual editor). Using vi editor, we can edit an existing file or create a new file
from scratch. we can also use this editor to just read a text file.
Syntax: vi Filename.extension
Creation:
Texting in file:
Quit:
Esc+:q = for
quit Esc+.•q! =
for quit
Esc+wq —for write and quit
6.Execute the basic commands using Vi editor.
Navigation
To move left, press h
o To move right, print I
o To move down, press J
o To move up, press k.
Moving one word
w, to move the cursor right to one
word b, to move the cursor left one
word
W& B to move the cursor past the adjacent to next or previous blank space e to
move the cursor to last character of current word.
Deleting :
Character text —
r — for replacing single character
under cursor c — change the character
in the current line Cut/copy/paste
for copy p — for paste
Matching pattern :-
7.Execute the following filters using regular expression with all
possible options.
Grep :
Syntax : grep[-E[-F]][-i][h][-L[-H]