Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Operating System Lab Manulas for TE IT PUNE 2010

Operating System Lab Manulas for TE IT PUNE 2010

Ratings: (0)|Views: 857|Likes:
Published by saket123india

More info:

Published by: saket123india on Oct 19, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Operating System Lab SCOEIT 1
Shell Programming
A. Write a program to handle student data base with options given below,a) Create data base. b) View Data Base. c) Insert a record.d) Delete a record. e) Modify a record. f) Result of a particular student. g) Exit.B. Menu driven program for a) Find factorial of a no. b) Find greatest of three numbers c) Find a prime nod) Find whether a number is palindrome e) Find whether a string is palindromeC. Write shell program using command-line argument for a. Finding biggest of three numbers b. Reversing a number c. Accept a number N and a word and print the word N times, one word per lined. Sum of individual digits of a 4-digit
(1234 -> 1+2+3+4=10)
Understanding of UNIX shell commands & shell programming.
1) What is Shell?Linux comes with various command interpreters called as shells in the Unix terminology.Actually shell sits in between the kernel of an operation system and the user. So whatever user wants to do through kernel it is available in terms of shell commands. Once you provide validcommand for the required operation it hands over the request to the operating system kernel andfinally job will be done by the system.There are various shells available to use in the Linux environment but following shells arethe standard shells.UNIX/Linux ShellsThe shells used in the Linux operating system has dual capability, in one had it is used as a toolwhich accepts commands interpret it and hands over it to the operating system kernel. Due to thiscapability it is called as command – line interpreter, another use of shell is it can be used as a programming language. Shell programming is interpretive by nature and mostly it is used toassist in system administration tasks.
Bourne Shell C Shell Korn ShellBash tcsh
Operating System Lab SCOEIT 2
Shell Programming
2)Explain shell Command with example:
Special Characters
Before we continue to learn about Linux shell commands, it is important to know that there aremany symbols and characters that the shell interprets in special ways. This means thatcertain typed characters: a) cannot be used in certain situations, b) may be used to perform special operations, or, c) must be “escaped” if you want to use them in a normal way.
Escape character. If you want to reference a special character, you must “escape” it with abackslash first.Example:
touch /tmp/filename\*
 Directory separator, used to separate a string of directory names.Example:
 Current directory. Can also “hide” files when it is the first character in a filename.
 Parent directory
User's home directory
 Represents 0 or more characters in a filename, or by itself, all files in a directory.Example:
can represent the files
, etc. 
 Represents a single character in a filename.Example:
can represent
, but not
[ ]
 Can be used to represent a range of values, e.g.
, etc.Example:
represents the names
, and
 “Pipe”. Redirect the output of one command into another command.Example:
ls | more
 Redirect output of a command into a new file. If the file already exists, over-write it.Example:
ls > myfiles.txt
 Redirect the output of a command onto the end of an existing file.Example:
echo “Mary 555-1234” >> phonenumbers.txt
 Redirect a file as input to a program.Example:
more < phonenumbers.txt
 Command separator. Allows you to execute multiple commands on a single line.Example:
cd /var/log ; less messages
Operating System Lab SCOEIT 3
 Command separator as above, but only runs the second command if the first onefinished without errors.Example:
cd /var/logs && less messages
Execute a command in the background, and immediately get your shell back.Example:
find / -name core > /tmp/corefiles.txt &
Executing Commands
The Command
Most common commands are located in your shell's “
”, meaning that you can just type the name of the program to execute it.Example: Typing “
” will execute the “
” command.Your shell's “
” variable includes the most common program locations, such as
, and others. To execute commands that are not in your current PATH, you have to give thecomplete location of the command.Examples:
(Execute a program in the current directory)
(Execute program from a personal
Command Syntax
Commands can be run by themselves, or you can pass in additional arguments to make themdo different things. Typical command syntax can look something like this:
command [-argument] [-argument] [--argument] [file]
List files in current directory
ls -l
Lists files in “long” format
ls -l --color
As above, with colourized output
cat filename
Show contents of a file
cat -n filename
Show contents of a file, with line numbers
When you're stuck and need help with a Linux command, help is usually only a fewkeystrokes away! Help on most Linux commands is typically built right into the commandsthemselves, available through online help programs (“man pages” and “info pages”), and of course online.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->