+ All Categories
Home > Documents > 140702_Lab Manual_1_2 (1)

140702_Lab Manual_1_2 (1)

Date post: 08-Nov-2014
Category:
Upload: jalpa-pandya
View: 26 times
Download: 1 times
Share this document with a friend
Popular Tags:
32
Gandhinagar Institute of Technology Operating System (140702) EXPERIMENT- 1 AIM: -An Introduction to UNIX operating system. 1. UNIX Architecture 2. UNIX Characteristics 3. Types of Terminal 4. Types of Shell Objectives Learn to Introduction of Operating System. Learn about various UNIX architecture, Characteristics and types of terminal and types of Shell. Tools / Preparation: In the system first required to install Unix/Linux Operating System with the proper drivers. Operating System : The operating system (OS) is the program which starts up when you turn on your computer and runs underneath all other programs - without it nothing would happen at all. Pandya Jalpa (120123116020) 1 4 th sem I.T.
Transcript
Page 1: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

EXPERIMENT- 1

AIM: -An Introduction to UNIX operating system.

1. UNIX Architecture2. UNIX Characteristics3. Types of Terminal4. Types of Shell

Objectives

Learn to Introduction of Operating System. Learn about various UNIX architecture, Characteristics and types of terminal and types of

Shell.

Tools / Preparation:

In the system first required to install Unix/Linux Operating System with the proper drivers.

Operating System :

The operating system (OS) is the program which starts up when you turn on your computer and runs underneath all other programs - without it nothing would happen at all.

In simple terms, an operating system is a manager. It manages all the available resources on a computer, from the CPU, to memory, to hard disk accesses.

Tasks the operating system must perform:

Control Hardware - The operating system controls all the parts of the computer and attempts to get everything working together.

Run Applications - Another job the OS does is run application software. This would include word processors, web browsers, games, etc...

Pandya Jalpa (120123116020) 1 4th sem I.T.

Page 2: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Manage Data and Files - The OS makes it easy for you to organize your computer. Through the OS you are able to do a number of things to data, including copy, move, delete, and rename it. This makes it much easier to find and organize what you have.

UNIX HISTORY

The UNIX operating system was born in the late 1960s. It originally began as a one man project led by Ken Thompson of Bell Labs, and has since grown to become the most widely used operating system.

In the time since UNIX was first developed, it has gone through many different generations and even mutations.

Some differ substantially from the original version, like Berkeley Software Distribution (BSD) or Linux.

Others, still contain major portions that are based on the original source code.

UNIX architecture

Hardware

Kernel

Shell (Command Interpreter)

Tools ans Applications (Utilities)

UNIX characteristics

Multi user Capability

Multi tasking Capability

Communication

Pandya Jalpa (120123116020) 2 4th sem I.T.

Page 3: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Security

Portability

Types of Terminal

Dumb Terminal

– Consist of a Keyboard and display unit with no memory or disks of its own.

– Acts as Independent machines.

Terminal Emulation

– Software that makes PC work like a dumb terminal.

Dial In Terminals

– Are Telephone lines to connect with the host machines.

Types of Shell

Bourne Shell (sh)

• This is the original Unix shell written by Steve Bourne of Bell Labs. It is available on all UNIX systems.

• This shell does not have the interactive facilites provided by modern shells such as the C shell and Korn shell. You are advised to to use another shell which has these features.

C shell (csh)

• This shell was written at the University of California, Berkeley. It provides a C-like language with which to write shell scripts - hence its name.

Korn Shell (ksh)

Pandya Jalpa (120123116020) 3 4th sem I.T.

Page 4: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

• This shell was written by David Korn of Bell labs. It is now provided as the standard shell on Unix systems.

• It provides all the features of the C and TC shells together with a shell programming

language similar to that of the original Bourne shell.

• It is the most efficient shell. Consider using this as your standard interactive shell.

Bourne Again Shell (BASH)

• Bash is a Unix shell written for the GNU Project.

• The name of the actual executable is bash. Its name is an acronym for Bourne-again shell, a pun on the name of the Bourne shell (sh) (i.e. “Bourne again” or “born again”), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978.

• Bash was created in 1987 by Brian Fox. In 1990 Chet Ramey became the primary maintainer. Bash is the default shell on most Linux systems as well as on Mac OS X and it can be run on most Unix-like operating systems.

Evaluation

Observation &Implementation(4)

TimelyCompletion(2)

Viva(4) Total(10)

Date:

Pandya Jalpa (120123116020) 4 4th sem I.T.

Page 5: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

EXPERIMENT- 2

AIM:-Execute Unix/Linux Command and Describe the Output.

Objectives

Learn about various UNIX/LINUX command.

Tools / Preparation:

In the system first required to install Unix/Linux Operating System with the proper drivers.

1). TOUCH

Options : No options.

Description: Used to create an empty file or to update the time

stamp of an existing file.

Output : TOUCH F1

Creates a blank file f1 in present directory.

2). CAT

Options : -U: Cause output to be unbuffered.

Pandya Jalpa (120123116020) 5 4th sem I.T.

Page 6: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

-V: prints normally non-printing characters like

Space, tab, enter etc.

Description: Concatenates and outputs the contents of the

given files.

Output : CAT F1

Gives the contents of file f1.

CAT > F1

Used to enter data into file f1. Ctrl+d used to save

the entered data. If a file f1 already exists than a

new file is created overwriting previous file.

CAT >> F1

Used to concatenate data into file f1 with

Previous data.

CAT F1 > F2

Used to copy entire content of file f1 to f2. Data

of f2 is overwritten if it already exists.

CAT F1 >> F2

Used to concatenate data of f1 to f2 with

Previous content of f2 safe.

3). LS

Options : -A : Display all files and directory including

hidden file and directories.

Pandya Jalpa (120123116020) 6 4th sem I.T.

Page 7: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

. : Current Directory.

.. : Parent Directory.

-B : Display non-printing characters in Octal

Notation.

-D : Display only the directory Names.

-L : List long Format of Directory with Time

stamp.

-M : List Files across Page Seperated by commas.

-N : List long format showing user id no. instead

of String.

-R : List file in reverse alphabetic order or oldest

first when used with -T.

-T : List File Information stored by most Recent

to oldest time stamp.

Description: List directory content or file information.

Output : LS

Output is list of files and directories in present

Working directory like

D1 f1 f2

LS –L

Lists all the directories and files in the present

Directory with time stamp, user privileges etc.

Pandya Jalpa (120123116020) 7 4th sem I.T.

Page 8: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

4). MKDIR

Options : -M: Allow the mode to be specified.

-P: allows creation of parent directories specified in

Directory name.

Description: Used to create Directory.

Output : MKDIR D1

Creates a directory d1 in present working directory.

MKDIR -P D1/D2/D3

Creates directoris d1 d2 and d3 with d1 parent of d2 and d2 parent of d3.

5). RMDIR

Options : -P: Removes directory and parent directories in all

path of directory name.

Description: Remove directory.

Output : RMDIR D1

Removes directory d1 from present directory.

6). CD

Options : No options.

Description: Change directory.

Output : CD

change present working directory to current

directory.

Pandya Jalpa (120123116020) 8 4th sem I.T.

Page 9: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

CD Path

Change present working directory to the

specified path.

7). CLEAR

Options : No option.

Description: Clear the content of the screen.

Output : CLEAR

A new screen with prompt appears.

8). CP

Options : -I : Prompts to avoid overwriting existing target.

-R : Copies contents of directories file to directory

target.

Description: Copy files to target location.

Output : CP F1 D2

Copy the file f1 into directory D2.

CP F1,F2,F3 D2

Copy multiple files into directory d2.

9). CAL

Options : No option.

Description: Print the calander.

Output : CAL

Print the calendar of current month.

Pandya Jalpa (120123116020) 9 4th sem I.T.

Page 10: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

CAL 2008

Print calendar of the year 2008.

CAL 03

Print calendar of the 3rd month of current year.

10). HISTORY

Options : No option.

Description: Gives all the commands executed by current user

in sequential manner.

Output : HISTORY

Gives all the commands executed till now on

Current user.

HISTORY || MORE

Gives history page wise.

11). CHMOD

Options : NNNN: provides absolute octal no. for read, write &

Update.

WHO: specifies that a user(a), group(g) or other(o) is

to be changed.

-PERM : Indicates deletion of permission.

+PERM : indicates addition of permission.

Description: Change the permission mode of the file.

Output : CHMOD 777 F1

Gives all the permissions i.e read write and modify

Pandya Jalpa (120123116020) 10 4th sem I.T.

Page 11: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

to user, group and other for the file f1

CHMOD 700 F1

Gives all the permissions i.e read write and modify

to user and no permission to group and other for the file f1.

12).UMASK

Options : No option.

Description: Used to change the default permissions for a file.

Permissions calculated as (777 – the specified

Permissions) i.e 000 for all permission.

Output : UMASK 000

Sets the default permissions i.e read write and

modify to user, group and other.

UMASK 077

Sets the default permissions to i.e read write and

modify to user and no permission to group and

other.

13). HEAD

Options : No options.

Description: Display beginning <n> lines of the file.

Output : HEAD F1

Display the beginning 10 lines of file f1.

HEAD 2 F1

Pandya Jalpa (120123116020) 11 4th sem I.T.

Page 12: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Display the starting 2 lines of file f1.

14). TAIL

Options : No option.

Description: Display last <n> lines of the file.

Output : TAIL F1

Display the last 10 lines of file f1.

TAIL 2 F1

Display the last 2 lines of file f1.

15). DATE

Options : No option.

Description: Display current date and time or modify the date.

Output : DATE

Displays the current date.

16). EXPR

Options : No option.

Description: Used to do basic arithmetic operation i.e addition,

Subtraction, multiplication, division.

Output : EXPR 1 + 2

Gives 3 as output.

EXPR $A + $B

Gives the addition of values of variable A and B.

Pandya Jalpa (120123116020) 12 4th sem I.T.

Page 13: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

EXPR 2 \* 4

Gives the product of 2 and 4 as output.

17). WHO

Options : No option.

Description: Display all the current user who are currently

logged on.

Output : WHO

Name of users which are currently logged into

TELNET are displayed with port nos.

WHO AM I

Name of the user logged in on the same system

with port no.

18). UNAME

Options : No option.

Description: It display the version of Operating System.

Output : UNAME

Gives the version of OS currently being used.

19). FINGER

Options : No option.

Description: Display all the detail of all the users.

Output : FINGER

Pandya Jalpa (120123116020) 13 4th sem I.T.

Page 14: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Displays the additional details I any of the users

logged on.

20).CMP

Options : -C : Print differing bytes as characters.

-I NUM : Ignore the first num bytes of input.

-L :Print offsets and codes of all differing bytes.

Description: Compares files.

Use standard input if a file is - or missing.

This command is normally used for

comparing binary files, although files can be of any type.

Output : CMP F1 F2

Compares file f1 and f2 and returns 0 if files have

same content, 1 if a difference is there and 2 if

files are inaccessible.

21). COMM

Options : -1: suppresses displays of lines unique to file 1

-2: suppresses displays of lines unique to file 2.

-3 : suppresses displays of lines unique to file 1 & file 2.

Description: Compare lines common to the sorted files file1 and file2. Output is in three columns, from left to right: lines unique to file1, lines unique to file2, and lines common to both files. comm is similar to diff in that both commands compare two files. But comm can also be used like uniq; comm selects duplicate or unique lines between 2 sorted files, whereas uniq selects duplicate or unique lines within the same sorted file.

Output : COMM F1 F2

Pandya Jalpa (120123116020) 14 4th sem I.T.

Page 15: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Column1 contains data which is unique to file f1, column 2 contains data which is unique to file 2 and column 3 contains data which is common to both the files .

22). SORT

Options : -M : merges previously sorted files together

-N : uses numerical values as the sorting sequence.

-D : sorts according to dictionary rules.

-F : ignores case in sorting sequence.

-R : sorts in reverse of the normal sorting sequence.

-U : eliminates records with duplicate key.

Description: Sorts the lines in the given file in character order

and outputs them.

Output : SORT F1

Sorts the content of file f1 in alphabetical order.

23). SPELL

Options : -B : checks British spelling of words.

Description: Lists incorrectly spelled words found in file.

Output : SPELL F1

Those words of file f1 which are not spelled

Correctly are listed.

24). WC

Options : -L : counts no. of lines in a file.

-w : counts no. of words in a file.

-c : counts no. of characters in a file.

Pandya Jalpa (120123116020) 15 4th sem I.T.

Page 16: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Description: Counts no. of lines, words and characters in the

file.

Output : WC F1

Output is the no. of lines, no. of words and no. of characters in f1.

WC –C F1

Output is the no. of characters in f1.

25). TTY

Output : No option.

Description: Give the terminal devaice name.

Output : TTY

Output is the port to which computer is connected.

26). ECHO

Options : No option.

Description: To print any String.

Output : ECHO HELLO

Hello

ECHO ADDITION OF 4 AND 2 `EXPR 4 + 2`

Gives output as :

Addition of 4 and 2 is 6.

27). MAN

Options : No option.

Description: Display information of particular command.

Pandya Jalpa (120123116020) 16 4th sem I.T.

Page 17: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Output : MAN CAT

Help of CAT command is displayed.

28). MORE

Options :-C : clear the screen and redraw

-D : displays errors rather than ringing bell.

-S : squeeze multiple blank lines into one blank line.

NO. : starts display at specified line no.

-F : moves file unconditionally to target.

-I : prompts user for combination to avoid overwriting

target.

NICE : executes command with lower than normal

priority.

Description: Display the named files on a terminal, one screen

full at a time.

Output : MORE F1,F2,F3

Displays the contents of file f1, f2 and f3, one

screen full at a time.

HISTORY || MORE

Displays history of commands page wise.

29). PASSWD

Options : -D : Delete the password for the user's account.

Description: Create or change a password associated with a

Pandya Jalpa (120123116020) 17 4th sem I.T.

Page 18: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

username. Only the owner or a privileged user

may change a password.

Output : PASSWD IT0748

New password:

Confirm password:

30). PWD

Options : No option.

Description: Display present working directory.

Output : PWD

Output is like :

Home/it074/d1

Which is the present working directory.

31). GREP

Options : -C : displays count of the no. of lines containing

expression.

-L : prints file name of file connecting expression.

-I : ignores casing while looking for expression.

-V : prints all lines not containing the pattern

expression.

Description: Scans the given files and displays the lines which

match the given pattern.

Output : GREP CAT *.SH

Pandya Jalpa (120123116020) 18 4th sem I.T.

Page 19: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Displays all the lines containing CAT in all the

.SH extension files.

32).PS

Options : -A : shows most frequently requested process status.

-E : shows information about all currently running

processes.

-F : generates a full listing for each running process.

Description: Display all the current working process.

Output : PS

Displays all the currently running process.

33). RM

Options : -F : removes all files without prompt.

-I : removes files one at a time by interactive user

prompting.

-R : removes files recursively including directories.

Description: It is used to remove the file.

Output : RM F1

Removes file f1 from the directory.

RM –R D2

Removes directory D2 with its contents if any .

34). SET

Options : No option.

Pandya Jalpa (120123116020) 19 4th sem I.T.

Page 20: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Description: It display the complete list of the environment

variable.

Output : SET

home\it074

IFS

Logname=it074

Mail=\var\mail\it074

35). CUT

Options : -B : Specify list of positions; only bytes in these

positions will be printed.

-C : Cut the column positions identified in list. Column

numbers start with 1.

-D : Use with -F to specify field delimiter as character

c (default is tab); special characters must be

quoted.

-F : Cut the fields identified in list.

-N : Don't split multibyte characters.

-S : Use with -F to suppress lines without delimiters.

Description: Cut out selected columns or fields from one or

More files.

Output : WHO || CUT –D”” –F

Find out who is logged on, but list only login name.

Pandya Jalpa (120123116020) 20 4th sem I.T.

Page 21: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

36). READ

Options : No option.

Description: It is used to read values from keyboard and assign

it to some variable.

Output : READ $A

Whatever value the user enters is assigned to variable A.

37). LN

Options : -D : Allow hard links to directories. Available to

privileged users.

-S : To create a link with to a file in another directory,

with the same name.

-F: Force the link (don't prompt for overwrite

Permission).

-I : Prompt for permission before removing files.

-N : Replace symbolic links to directories instead of

dereferencing them. –f is useful with this option.

Description: Used to create links for files, allowing them to be

accessed by different names.

Output : LN F1 F2

Here F2 refers to or links to file F1.

38). KILL

Options : No option.

Pandya Jalpa (120123116020) 21 4th sem I.T.

Page 22: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Description: Used to kill the process or a job.

Output : KILL %3

aborts 3rd job in the system.

39. ALIAS

Options : No option.

Description: Lets us define aliases for a particular command.

Output : ALIAS L=`LS –L`

Here, whenever we type l and enter, LS –L

command gets executed.

40). DIFF

Options : -R : Reports all the differences between files with the

same name In two different directories.

Description: Reports the differences between 2 files, or nothing

if the files are identical.

Output : DIFF F1 F2

Gives differences between file F1 and F2 in same

format as COMM command.

41).LOCATE

Options : No option.

Description: Lists all the files on your system with specified

keys in their name.

Output : LOCATE F

Pandya Jalpa (120123116020) 22 4th sem I.T.

Page 23: 140702_Lab Manual_1_2 (1)

Gandhinagar Institute of Technology Operating System (140702)

Displays names of all those files which contain

character ‘f’ in their name.

42). FIND

Options : . : Current directory.

-NAME: Specify type of file to be searched.

Description: Used to search specific search.

Output : FIND. –NAME F1

Searches for file F1 in current directory.

FIND D1 –NAME F1

Searches for file F1 in D1 directory.

Evaluation

Observation &Implementation(4)

TimelyCompletion(2)

Viva(4) Total(10)

Date:

Pandya Jalpa (120123116020) 23 4th sem I.T.


Recommended