Operating Sysytem

Embed Size (px)

Citation preview

  • 7/30/2019 Operating Sysytem

    1/42

    IDEAL INSTITUTE OF MANAGEMENT ANDTECHNOLOGY

    Practical file of Operating System-LINUX

    Submitted To: Submitted By:Mr. Mahesh Sharma Gagan Mohta(Asstt. Prof, IIMT) BBA (CAM)

    4th sem00521001910

  • 7/30/2019 Operating Sysytem

    2/42

    ACKNOWLEDGEMENT

    I would like to convey my heartfelt thanks to Mr. MaheshSharma who always gave valuable suggestions and guidance for completion of my practical file. He helped me to understand andremember important details of the practical that I would haveotherwise lost. My practical has been a success only because of hisguidance.

    Name: Gagan MohtaRoll. No.: 00521001910

    Course: BBA (CAM)- (Eve)- 4 th Sem

  • 7/30/2019 Operating Sysytem

    3/42

    CERTIFICATE

    This is to certify that MR.SANDEEP YADAV pursuing BBA

    CAM- IV semester from Ideal Institute of Management and

    Technology has completed his practical file under my supervision

    and guidance. He has taken care of all necessary aspects and shown

    interest and sincerity during the completion of this file to my fullsatisfaction.

    I certify that the file is up to the expectations as per the

    guidelines laid by the Guru Gobind Singh Indraprastha University.

    Mr. Mahesh Sharma(Asstt. Prof, IT)

  • 7/30/2019 Operating Sysytem

    4/42

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

    HARDWARE REQUIREMENTS FOR UNIX

    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 cardinstall in the expansion slot on the motherboard of the host machine. One endof the cable is plugged to the port on the controller card and other end to theserial port of the terminal. Any DOS based machine with the serial port canact as a terminal. We can say that per terminal to be supported 0.75 to 1 MBshould be present in the host machine. Out of 80 MB disk space all mist 40MB is eaten away by actual UNIX-OS Files. Whereas another 10 20 MB isused as a Swap space. The swap space is used when unix falls short of memory. Unix also requires a considerable amount of human support. Thiscomes in the form of system administrator who supervises the working of Unix on any installation.

  • 7/30/2019 Operating Sysytem

    5/42

    SALIENT FEATURES OFUNIX

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

    a) Dumb Terminal It consists of the keyboard and displays units withno memory or disks of its own. These can never act as independentmachines.

    b) Terminal Emulation - A PC has its own micro processor memory anddisk drives. By attaching this PC to the host through a cable and runninga software, we can make its work as if it is a dumb terminal. The

    software makes the PC work like a dumb terminal emulation softwareVTERM are 2 such popularly used softwares.

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

    2) MULTITASKING -: Unix is multitasking implying that it is capable of carrying out more than one job at the same time. This is managed bydividing the time interval intelligently between all processes being carriedout. Depending upon the priority of the task OS appropriately allotssmall time slots to each foreground & background tasks. Programs whichare more important are given high priority, programmes which have same

    priority are scheduled on round robbin basis.

  • 7/30/2019 Operating Sysytem

    6/42

    3) COMMUNICATION -: Unix has excellent provision for communicatingwith fellow users. The communication may be within the network of asingle 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. Atthe file level there are read, write and execute permissions to each filewhich decide who can access a particular file, who can modify it and whocan execute it. Lastly there is a file inscription code. This utility incodsyour 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 onlythe bear minimum of adaptations to suit the given computer architecture.Unix is almost entirely written in C.

  • 7/30/2019 Operating Sysytem

    7/42

    UNIX FILE SYSTEMUnix 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 upsidedown 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 UNIXwhich is the UNIX KERNEL itself. The main reason behind the certaintyof directories is to keep related files together and separate them fromother 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 controlinput / output devices like terminals, pointers etc. Each device has aseparate file.

    6. Lib directory contains all library functions.

    7. / usr / bin contains additional unix commands.

  • 7/30/2019 Operating Sysytem

    8/42

    UNIX SYSTEM ORGANISATION

    The functioning of Unix is divided into 3 levels. On the outer crust reside theapplication program & other utility. At the heart of UNIX is the Kernelwhich interacts with the actual hardware in machine language. The streamlinning of these two modes of communication is done by middle layer calledshell. Shell interpret the command that we give & conveys them to the kernelwhich 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. Thekernel 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 1kernel.

    TYPES OF SHELL

    1. BOURNE SHELL - This is STEVE BOURNEs creation and is themost popular. The prompt sign is $ form for bourne shell.

  • 7/30/2019 Operating Sysytem

    9/42

    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 Theentire command we can use short alias at the command line. CShell 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 & aSuperset of Bourne shell. It offers a lot more capabilities & is moreefficient than the others. Designed by DAVID KORN of AT&T BellLab.

  • 7/30/2019 Operating Sysytem

    10/42

    ASSIGNMENT -1

    For Working in UNIX OPERATING SYSYTEM

    Go to start option in task bar.

    Click on run optionThen type Tel Net 192.168.0.3Enter your login i.e iimt01Enter the password i.e. iimt001

    START RUN TELNET 192.168.0.3

  • 7/30/2019 Operating Sysytem

    11/42

    Commands at the UNIX Prompt

    1. $ echo hello world

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

  • 7/30/2019 Operating Sysytem

    12/42

    2. CLEAR

    This command is used to clear the screen

  • 7/30/2019 Operating Sysytem

    13/42

    3.DATE

    This command will display the current date and along with time

    4. $ who

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

  • 7/30/2019 Operating Sysytem

    14/42

    5. $ ls l

    This command gives detail of all the files and directories. This commandwill 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

    it is used for multicolumn output.

  • 7/30/2019 Operating Sysytem

    15/42

    b. ls a this will show all hidden files beginning with . Includind all files.

  • 7/30/2019 Operating Sysytem

    16/42

    c. ls i

    this will displays i node number.

    6.) $ cal 4 2007 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/30/2019 Operating Sysytem

    17/42

    7. $ who am I

    This command shows that who is logged on to the system. This command isthe special case of the who command.Here user1 is the users login name, pts/1 signifies the terminal number

    or serial port line by which the users terminal is connected to host machine.

  • 7/30/2019 Operating Sysytem

    18/42

    8.) $ finger

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

    9. $ pwd

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

  • 7/30/2019 Operating Sysytem

    19/42

    10.) $ who am I

    It prints effective user id.

  • 7/30/2019 Operating Sysytem

    20/42

    11. $ ls

    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

    This commands is used to create a new directorySyntax:-Mkdir [directory name] Mkdir operating

    It will make directory named operating. Among the option available withmkdir is p which allows to create multiple generation of directories.Syntax:-

    Mkdir p mohit1/geetika2/ridhima3/poonam4/babita5This p option tells unix to create mohit1 , geetika2 , ridhima3 ,poonam4 , babita5..

  • 7/30/2019 Operating Sysytem

    21/42

  • 7/30/2019 Operating Sysytem

    22/42

    13. cd dirname

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

    Cd kernel

    This command will take you inside the directory named kernel

    14 $ cat > os01

    This command is used to create a file .

    (b).) $ cat os01

    This command is used to display the contents of file.

  • 7/30/2019 Operating Sysytem

    23/42

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

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

    14(d) $ cat >> os03

    To add new content in os03 file.

  • 7/30/2019 Operating Sysytem

    24/42

    15.) $ man ls

    This command used for manual listing.

  • 7/30/2019 Operating Sysytem

    25/42

    16)$ who

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

    17) $ cd

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

  • 7/30/2019 Operating Sysytem

    26/42

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

    19) $ cal 9 1792

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

  • 7/30/2019 Operating Sysytem

    27/42

    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 It is used to view the contents of a file.

    Eg: cat os01It will display the contents of file os01

  • 7/30/2019 Operating Sysytem

    28/42

    Assignment 2

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

    $ mkdir Vodafonevodafone is created

    Now to make its sub directories type

  • 7/30/2019 Operating Sysytem

    29/42

    2. delete the sub directory called Vodafone?

    $ rmdir Vodafone

    Rmdir command is used to delete the directory. For this there shouldnt beany 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

    VODAFONE

    SCHEMES RECHARGES

  • 7/30/2019 Operating Sysytem

    30/42

    4. move the file into the sub directory.

    mv command is used to move a file.

    Syntax:- $ mv

  • 7/30/2019 Operating Sysytem

    31/42

    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>filenameEx.:- $ cat>friendTo save file: ctrl+zDeleting file:- rm command is used to remove a file.Syntax:- $ rm friend

  • 7/30/2019 Operating Sysytem

    32/42

    Assignment -3

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

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

  • 7/30/2019 Operating Sysytem

    33/42

    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 andda =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 throughthe key board , write a programto find his gross salary.

  • 7/30/2019 Operating Sysytem

    34/42

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

    1. contents of \etc\passwd2. list of users who currently logged in.3. present working directory4. exit

    make the case statement , the menu should be placed approximately in thecenter of the screen and should be displayed in bold using the tput statement.

  • 7/30/2019 Operating Sysytem

    35/42

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

  • 7/30/2019 Operating Sysytem

    36/42

    6. Program to find area and circumference of circle

    7.Program to find simple interest

  • 7/30/2019 Operating Sysytem

    37/42

    8.Program to find factorial

    9.Program to read from file

  • 7/30/2019 Operating Sysytem

    38/42

    10.Program to show case

    Output

    11. Program to show for loop

    Output

  • 7/30/2019 Operating Sysytem

    39/42

    12. Program To show use of until loop

    Output of until loop

    13. Program for leap year

  • 7/30/2019 Operating Sysytem

    40/42

    Output

    14. Program to add digits of a num

  • 7/30/2019 Operating Sysytem

    41/42

    Output

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

  • 7/30/2019 Operating Sysytem

    42/42

    Output