Exp2
Exp2
Experiment No.2
Write shell scripts programming.
Date of Performance:
Date of Submission:
Aim: Write Shell Scripts to do the following:
1. Perform the basic arithmetic operations
2. Display top 10 processes in Ascending order.
3. Display processes with highest memory usage.
4. Display current logged in user and log name.
5. Display current shell, home directory, kernel version.
Objective: The shell is the operating system's command-line interface (CLI) and interpreter for the set
of commands that are used to communicate with the system. A shell script is usually created for
command sequences in which a user has a need to use repeatedly in order to save time.
Theory:
Shell is a user program or its environment is provided for user interaction. It is a command prompt
within Linux where you can type commands. It is a program that takes your commands from the
keyboard and gives them to the OS to perform. Shell is not part of system KERNAL but it uses system
KERNAL to execute programs, create files,etc. A Shell Script is a text file that contains a sequence of
commands for a UNIX based OS. It is called a Shell Script because it combines into a "Script" in a
single file a sequence of commands, that would otherwise have to be presented to the system from a
keyboard one at a time. A Shell Script is usually created for command sequences for which a user has
a repeated need. You initiate the sequence of commands in Shell Script by simply entering the name of
the Shell Script on a command line.
Types of Shell Script :-
1. sh - Simple Shell
2. bash - Bourne Again Shell
3. ksh - Korne Shell
4. csh - C Shell
5. ssh - Secure Shell
To use a particular Shell type the Shell name at the command prompt. Eg:- $csh - It will switch the
current Shell to C Shell. To view the current Shell that is being used, type echo $ SHELL at the
command prompt.