Sie sind auf Seite 1von 7

Ex.

No: 1 Date:

STUDY OF UNIX OPERATING SYSTEM

Aim: To Study about general purpose UNIX Operating system basics. Definition of Operating System An operating system (OS) is a software program designed to act as an interface between the user and the computer. It controls the computer hardware, manages the system resources, and supervises the interaction between the system and the user. The operating system also forms a database on which application software is developed and executed. Function of an operating system Command interpretation: The CPU cant understand the commands keyed in by a user. It is the function of the OS to make it understand. Peripheral Interfaces: the OS also has to take care of the devices attached to the system. The OS oversees communication between these devices and the CPU. Memory management: the OS handles the extremely important job of allocating memory for various processes running on the system. Process management: this is required if several programs must run concurrently. CPU time would then have to be Rationed out by the OS to ensure that no programs gets more than its fair share of the processor time. Types of operating system There are two basic types of operating system single-user and multi-user. A multi-user operating system handles multiple users as well as multiple peripheral devices simultaneously. Such an operating system is more than single-user OS. Single user systems: A personal computer is a popular single user system. The PC is a small general-purpose system that can execute programs to perform a wide verity of tasks. Multi-user system are required when a number of program have to be run simultaneously, or common resources like printers and disks are to be shared by a number of users.

Basic concepts of multi-user system A multi-user system has a single computer with several terminals attached to it. This computer can be a PC AT, a mini or a mainframe. Various users can work on this machine through the attached terminals. These terminals can be of two types: Smart & Dumb. A Dumb terminal consists of a VDU and a keyboard. It has no CPU of its own, and the processes is done only by the central unit. A Smart terminal has its own CPU and peripherals, and can work independent of the central unit. UNIX Kernel The core of the UNIX system is the kernel the operating system program. The kernel controls the computer resources, allocating them to different users and different tasks. It interacts directly with the hardware. Since the kernel communicates with the hardware, parts of the kernel must be customized to each systems hardware features. However the kernel doesnt deal directly with the user instead it stars up a separate interactive program called the shell for each user UNIX utilities Unix utilities or commands are a collection of about two hundred programs that service the day to day processing requirements. This programs are invoked through shell which itself an utility. Application software Apart from the utilities that are provided as a part of the UNIX operating system more than a thousand UNIX based application programs like database management systems, word processor, accounting software, and language processor are available from independent software vendors. UNIX file system A single fixed disk can store thousands of files for organizing data in the disk; the operating system provides a file system. This file system allows you to group files in a convenient manner. When UNIX was developed it had features that the other operating system at that time did not have. Once such feature was it file system. The UNIX file system has a hierarchical structure and the files can be stored at the directories. Directories are similar to the drawers of the filling cabinet. Just as each drawer contains the files, each of which contains the files of the similar nature. Additionally, just as in a filling cabinet, the user decides the drawer labels and

contents, so also the user decides the directory name and the files in the directory. All the files are stored on the disk under one main directory for the root directory. File naming conventions : In UNIX file, filenames

Can be up to 14 char long. Can contain digits, a dot (.), hyphen (-) are the underscore symbol (_) anywhere. Can contain both upper case and lower case alphabets. Are case sensitive. For example: THIS_FILE is not same as this_file. a.h is not the same as A.H or A.h. Should not have a blank or a tag. A user of Unix based system works as a user terminal. After the boot procedure is

Starting a UNIX session Logging In : completed, that is the operating system is loaded in memory, the following message appears at each user terminal: Logging: Each user has a identification called the user name are the login name which has to be entered when the login: message appears. The user is then asked to enter the password. Unix keeps track of all the Unix user names and the information about identity in a special file. Ending a UNIX session Logging Out: Once a user has logged into the system the users works session continues until the user instructs the shell to terminate the session. This is done by pressing the ctrl and d keys together or typing exit at the dollar prompt. Then the system display the login: Prompt on the screen. Result:

Ex. No: 6 Date:

STUDY OF VI EDITOR & SHELL PROGRAMMING

Editor An editor allows the users to see a portion of a file on the screen and to modify characters and lines by simply typing at the cursor position. Vi editor Vi stands for visual It is a full screen editor and allows the user to view and edit the entire document at the same time. Vi is case sensitive. It has powerful undo features. Modes of Vi editor Vi editor works in 3 modes Command mode In this mode all the keys pressed by the user are interpreted to be editor commands. No text is displayed on the screen even if corresponding keys is pressed on the keyboard. Insert mode This mode permits to insert a new text, editing and replacement of existing text. When Vi editor is in insert mode the letters typed at the keyboard are echoed on the screen. Escape mode Commands typed at the command line. Starting with Vi editor Syntax: vi filename Moving the cursor The cursor movement commands are: Command H or backspace l or spacebar K or J or + I #b #e F[character] Action Left one character Right one character Up one line Down one line Moves forward a word Moves back a word Moves to the last character in the word Moves right to the specified character in a line

T[character] 0 or ^ #$ L G Editing the file

Moves right and places it one character before the specified character Moves to the beginning of the file Moves to the end of the file Moves to the last line of the file Moves to the specified line number

Open the file using $ vi filename To add text at the end of the file, position the cursor at the last character of the file. Switch from command mode to text input mode by pressing a. Here a stands for append. Inserting text in the middle of the file is possible by pressing i. The editor accepts and inserts the typed character until Esc key is pressed. Command Purpose Inserts text to the left of the cursor Inserts text at the beginning of the line Append text to the right of the cursor Appends text at the end of the line Appends a new line below Appends a line above

I I A A O O

Deleting Text For deleting a character, move the cursor to the character , press x. The character will disappear. Command X nx #x #X D$ or d D0 #dd #dw Purpose Deletes one character Deletes n number of characters Deletes on character at the cursor position Deletes on the character before the cursor position Deletes a line from the cursor position to the end of the line Deletes from the cursor position to the starting of the line Deletes the current line where the cursor is positioned Deletes the word from the cursor position to the end of the word

The undo features u-undo the recent changes U- undo all changes in the current line Saving text :w save the file and remains in edit mode :wq save the file and quits from edit mode :q quit without changes from edit mode

Quitting vi Press zz or :wq in command mode. Shell Programming The format for the various conditional statements and looping statements and the relational operators used for those conditions are given below. if condition if condition then execute commands fi if else condition if condition then execute commands else execute commands fi if elif condition multi way branching if condition then execute commands elif condition then execute commands else execute commands fi Relational Operators Operator -eq -ne -gt -ge -lt -le Meaning Equal to Not equal to Greater than Greater than or equal to Less than Less than or equal to

Case condition case expression in pattern1) execute commands ;; pattern2) execute commands ;; pattern3) execute commands ;; .. esac while looping While expression do execute commands done until : whiles complement until [ condition ] for looping for variable in list do execute commands done

Result:

Das könnte Ihnen auch gefallen