os_file_YO_YO by srishtisethi2102


UNIX OS had a very humble beginning AT&T Bell Lab. The aim was to develop an
OS that could serve a large community of users and allow them to share data if need be.
This enterprise was called Multics for multiplex information and computing service.
This system was named UNIX by Brian Kernighan as a very reminder of ifflated
Multics. All the assembly code of unix was machine dependent and was not portable.
To remedy this KEN THOMSON created a new language B and said on the task of re-
writing the whole unix in this high level language. Dennis Ritchie shifted the
inadequacies of ‘B’ nd modified it to a new language which he named as ‘C’. The whole
code of unix is written in ‘C’.

80 MB Hard Disk
4 MB RAM on a 16 Bit Microprocessor

We connect terminals to the host machine through 4/8/16 port controller card install in
the expansion slot on the motherboard of the host machine. One end of the cable is
plugged to the port on the controller card and other end to the serial port of the
terminal. Any DOS based machine with the serial port can act as a terminal. We can
say that per terminal to be supported 0.75 to 1 MB should be present in the host
machine. Out of 80 MB disk space all mist 40 MB is eaten away by actual UNIX-OS
Files. Whereas another 10 – 20 MB is used as a Swap space. The swap space is used
when unix falls short of memory. Unix also requires a considerable amount of human
support. This comes in the form of system administrator who supervises the working of
Unix on any installation.

1) MULTIUSER CAPABILITY -: In a multiuser system the same computer resources
   hard disk, memory are accessible to many users but they are given different terminals
   to operate from. A terminal is a keyboard & the monitor which are input & output
   devices for that user. All terminals are connected to the main computer whose
   resources are availed by all users. At the heart of unix installation is the host
   machine known as the SERVER. The number of terminals that can be connected to
   the host machine depends on the number of ports that are present in its controller
   card. For eg- A 4 – port controller card in the host machine can support 4 terminals
   that cab be attached to the host.

 a) Dumb Terminal – It consists of the keyboard and displays units with no memory
    or disks of its own. These can never act as independent machines.

 b) Terminal Emulation - A PC has its own micro processor memory and disk drives.
    By attaching this PC to the host through a cable and running a software, we can
    make its work as if it is a dumb terminal. The software makes the PC work like a
    dumb terminal emulation software VTERM are 2 such popularly used softwares.

 c) Dial – In Terminals - used telephone lines to connect with the host machine. It is
    necessary to attach modem to terminal as well as to the host.

2) MULTITASKING -: Unix is multitasking implying that it is capable of carrying
   out more than one job at the same time. This is managed by dividing the time
   interval intelligently between all processes being carried out. Depending upon the
   priority of the task OS appropriately allots small time slots to each foreground &
   background tasks. Programs which are more important are given high priority,
   programmes which have same priority are scheduled on round robbin basis.

3) COMMUNICATION -: Unix has excellent provision for communicating with
   fellow users. The communication may be within the network of a single main
   computer or between 2 or more such computer network. Users can easily exchange
   mail, data, programs through such network. Distance poses no barriers.

4) SECURITY -: Unix has 3 provisions for protecting data. The first is provided by
   assigning passwords & login names to individuals users. At the file level there are
   read, write and execute permissions to each file which decide who can access a
   particular file, who can modify it and who can execute it. Lastly there is a file
   inscription code. This utility incods your into an unreadable format so that even if
   someone succeeds in opening it he can not see.

5) PORTABILITY -: One of the major reasons for universal popularity of unix is that
   it it can be ported to almost any computer system with only the bear minimum of
   adaptations to suit the given computer architecture. Unix is almost entirely written
   in C.

Unix treats everything, it knows & understands as a file. All utilites, applications ,
data in unix are stored as a file even a directory is treated as a file which contains
their files. The unix file system resembles an upside down tree. The file system begins
with the directory called root (/) branching from the roor are several other directories
called bin, user, etc, temp, dev, lib/usr/bin. The root directory also conatin a file
called UNIX which is the UNIX KERNEL itself. The main reason behind the
certainty of directories is to keep related files together and separate them from other
groups of related files.

1. Bin directory contains all executable files for most of unix commands. Unix
   commands can be either C program or Shell programs. These programs are
   collection of several unix.

2. User directory has several directories each associated with the particular user.
   These directories are created by system administrator when he creates accounts
   for different users.

3. etc. directory contains system related files.

4. tmp directoty contains temporary files created by unix or by users. These files get
   automatically deleted when system is shut down & re – started.

5. Dev. Directory contains device related files i.e. files that control input / output
   devices like terminals, pointers etc. Each device has a separate file.

6. Lib directory contains all library functions.

7. / usr / bin contains additional unix commands.


The functioning of Unix is divided into 3 levels. On the outer crust reside the
application program & other utility. At the heart of UNIX is the Kernel which
interacts with the actual hardware in machine language. The stream linning of these
two modes of communication is done by middle layer called shell. Shell interpret the
command that we give & conveys them to the kernel which ultimately executes them.
Shell is also known as command interprator. Kernel has various functions it manages
file, memory, transfer of data between file system & hardware. It also handles any
interrupts issued. The kernel program is usually stored in file called ‘sh’. Thus at a
particular movement of timer there may be several shells running in memory but only 1


1. BOURNE SHELL - This is STEVE BOURNE’s creation and is the most
   popular. The prompt sign is $ form for bourne shell.

2. C SHELL - It was created by BILL JOY. It has 2 advantages over Boune shell.
   First it allows aliasing of commands instead of typing The entire command we can
   use short alias at the command line. C
  Shell has a command history features. Previously typed commands can be recalled.
Prompt sign is ‘%’.

3. KORN SHELL – It is not so widely used. It is very powerful & a
   Superset of Bourne shell. It offers a lot more capabilities & is more efficient than
   the others. Designed by DAVID KORN of AT&T Bell Lab.

                         ASSIGNMENT -1


 Go to start option in task bar.
 Click on run option
 Then type Tel Net
 Enter your login i.e iimt01
 Enter the password i.e. iimt001

START                      RUN          TELNET

                   Commands at the UNIX Prompt

1. $ echo hello world <enter>

 echo command will used to display on screen. It will
 display hello world on screen.


   This command is used to clear the screen


  This command will display the current date and along with time

4. $ who <enter>

This command displays data about the entire user who have logged into the system
currently. In this the first entity is the users login name followed by the terminal line
and the login date and time.

5. $ ls –l <enter>

This command gives detail of all the files and directories. This command will used to see
the login list view of all the files and directories present.

This command “ls” is used with several options

Syntax -:
$ ls –[option]

Options used with ls:

a. ls –x<enter>

       it is used for multicolumn output.

b. ls –a <enter>
        this will show all hidden files beginning with ‘.’ Includind all files.

   c. ls –i <enter>

       this will displays i node number.

6.) $ cal 4 2007 <enter>

 This command will display the calendar of April 2007 cal command can be used with
several options. If only ‘cal’ is written it will display the calendar

7. $ who am I <enter>

This command shows that who is logged on to the system. This command is the special
case of the “who” command.
 Here “user1” is the user’s login name, ‘pts/1’ signifies the terminal number or serial
port line by which the user’s terminal is connected to host machine.

8.) $ finger <enter>

This command displays all the users list who have logged on to system . this command is
similar to ‘who’ command, but this command also display the heading of entities like
first entity is for login followed by ‘name’ and so on.

9. $ pwd <enter>

This command displays the path in which we are presently working. pwd stands for
present working directory

10.) $ who am I <enter>

It prints effective user id.

11. $ ls <enter>

This command displays the listing of contents of file and directories. It only print the
name of files and directories without giving its detail

12.) $ mkdir dirname <enter>

This commands is used to create a new directory
          Mkdir [directory name] <enter>
          Mkdir operating <enter>
It will make directory named ‘operating’. Among the option available with mkdir is –p
which allows to create multiple generation of directories.
          Mkdir –p mohit1/geetika2/ridhima3/poonam4/babita5
This –p option tells unix to create ‘mohit1’ , ‘geetika2’ , ‘ridhima3’ , ‘poonam4’ ,

13. cd dirname <enter>

This command is used to go inside the created directory. cd stands for change directory.
Syntax :

Cd kernel <enter>

This command will take you inside the directory named ‘kernel’

14 $ cat > os01 <enter>

This command is used to create a file .

(b).) $ cat os01 <enter>

This command is used to display the contents of file.

14(c). $ cat file os01 os02 > os03 <enter>

This will join (combine) the contents of file ‘os01’ and ‘os02’ , in new file ‘os03’.

14(d) $ cat >> os03 <enter>

To add new content in os03 file.

15.) $ man ls <enter>

This command used for manual listing.

16)$ who <enter>

This command is also used for manual listing. It will display the use of “who command
the description of several option that can used with their command”.

17) $ cd<enter>

Come out from present working directory, first the user will come out from the last
entered directory

18) $ cal 2012<enter>
This will display the whole calendar of year of 2012

19) $ cal 9 1792<enter>

This command wil display calendar of September 1752
Note-here the number from 3 to 13 are missing.

20) $ echo 5+4 | bc

This command is used for calculation. Here echo command is used for displaying
| is piping symbol bc stands for binary calculation

21)$ cat filename <enter>
 It is used to view the contents of a file.
Eg: cat os01
 It will display the contents of file os01

                                  Assignment 2

1. Make directories called Vodafone and create sub directories schemes and recharges.

$ mkdir Vodafone
‘vodafone is created

Now to make its sub directories type


  SCHEMES                                            RECHARGES

2. delete the sub directory called Vodafone?
$ rmdir Vodafone

Rmdir command is used to delete the directory. For this there shouldn’t be any file
inside the directory.

3. copy the file /etc/passwd into your home directory?

‘cp’ command is used to copy the contents of one file into another file.

Syntax:- $ cp <source name> <target name>

4. move the file into the sub directory.

‘mv’ command is used to move a file.

Syntax:- $ mv <source name> <target name>

Now the total contents of file one are removed with another.

5. how would you create and then delete a file called friend?

Creating file:- ‘cat’ command is used to create a file.
Syntax:- $ cat>filename
Ex.:- $ cat>friend
To save file: ctrl+z
Deleting file:- ‘rm’ command is used to remove a file.
Syntax:- $ rm friend

Assignment -3

1. Program to find whether the number is even or odd.

2.Program to copy a source file to target file.

 3. In a company an employ is paid as under
If the basic salary is less then rs. 8000then hra = 15% of the basic salary and da =45%
of the basic. If the salary is either equal to or above 8000, then hra = rs 500 and da =
55% of basic salary. If the employ salary is input through the key board , write a
programto find his gross salary.

4. Write a menu driven program which has the following options.

    1. contents of \etc\passwd
    2. list of users who currently logged in.
    3. present working directory
    4. exit
make the case statement , the menu should be placed approximately in the center of the
screen and should be displayed in bold using the tput statement.

5. Write a shell script to generate the Fibonacci series?

6. Program to find area and circumference of circle

7.Program to find simple interest

8.Program to find factorial

9.Program to read from file

10.Program to show case


11. Program to show for loop


12. Program To show use of until loop

Output of until loop

13. Program for leap year


14. Program to add digits of a num


15. To find area of rectangle and area and perimeter of circle



To top