UNIX
UNIX
Experiment 1
Aim:- To learn linux commands
1. Cal:- Linux command to display
calendar. Output:-
3. W:-Linux command to display the list of users who are currently using
Linux server.
Output:-
Experiment 2
Aim:- to learn linux commands.
1. Help:-Linux command to get help with various options.
Output:-
Experiment 3
Aim:- to learn linux commands.
1. Comm:- Linux command to show the common data of two files.
Output:-
Experiment 4
Aim:- to learn linux commands.
1. Tail:- Linux command to view the last 20 lines of a
file. Output:-
5. Sed:- Linux command to find any character and replace it with some
other character.
output:-
Experiment 5
Aim:- Program to print hello world.
Code:-
Output:-
Experiment 6
Aim:- Program to Display calendar.
Code:-
Output:-
Experiment 7
Aim:- Program to a simple script to read user input and perform
operations with them.
Code:-
Read NUM1 # Read the user input from Standard Input and store in Variable
NUM1
Output:-
Experiment 8
Aim:- A script to show usage of if condition.
Code:-
Fi
Output:-
Experiment 9
Aim:- A script to show usage of if else
condition. Code:-
Output:-
Experiment 10
Aim:- A script to demonstrate case
statement. Code:-
Output:-
Experiment 11
Aim:- A script to demonstrate case statement.
Code:-
Echo -n “Enter a character: “
Read CHAR
Case $CHAR in
;;
I | I)
Echo “You entered $CHAR which is a vowel”
;;
O | O)
Echo “You entered $CHAR which is a vowel”
;;
U | U)
Echo “You entered $CHAR which is a vowel”
;;
*) # Defaults to everything else
;;
Esac
Output:-
Experiment 12
Aim:- A script to demonstrate case
statement. Code:-
Case “$USER_INPUT” in
Esac
Output:-
Experiment 13
Aim:- A simple script to show usage of string compare operator =
and !=.
Code:-
STR1=”Hello”
STR2=”Hello”
If [ ${STR1} = ${STR2} ]
Then
Else
Output:-
Experiment 14
Aim:- A simple script to show usage of string compare operator -z
and -n.
Code:-
STR1=”Hello”
STR2=”Hello”
Fi
Output:-
Experiment 15
Aim:- A simple script to show usage of logical
operators. Code:-
Output:-
Experiment 16
Aim:- A simple script to show usage while loop
Code:-
COUNT=0
Echo “Done”
Output:-
Experiment 17
Aim:- Sum of N natural numbers using while
loop. Code:-
Read NUM
Let SUM=0;
Let I=1
Do
I=$((${I} + 1))
Done
Output:-
Experiment 18
Aim:- A simple script to demonstrate for
loop. Code:-
COUNT=0
For I in 0 1 2 3 4
Do
COUNT=$((COUNT + 1))
Done
Output:-
Experiment 19
Aim:- A script to show usage of if else
condition. Code:-
NUM2=5
Then
Else
Fi
Output:-