Professional Documents
Culture Documents
h. I ( pipeline command)
v. Passwd
Du
ANS
A
a. Date : Used To Show the current date and
C:
a. tty : prints the file name of the terminal connected to standard input
c. cat :Used to create single or multiple files, view contain of file, concatenate
files and redirect output in terminal or files
f. mv : used to move one or more files or directories from one place to Aunothe
place
g. cut : used to cut out the sections from each line of files and writing the result to
standard output
h. paste : used to join files horizontally by outputting lines consisting of lines from
each file specified, separated by tab as delimiter, to the standard output.
D:
a. more : used to view the text files in the command prompt, displaying one screen at a
time in case the file is large
b. cmp : used to compare the two files byte by byte and helps you to find out whether the
two files are identical or not.
c. Comm: compare two sorted files line by line and write to standard output; the lines
d. diff : used to display the differences in the files by comparing the files line by line
a. head : for outputting the first part of files given to it via standard input.
b. Tail : for outputting the last part of files given to it via standard input.
c. sort : sorts the contents of a text file, line by line
d. find : allows the user to find files located in the file system via criteria
such as the file name
G:
e. wc : used to find out number of lines, word count, byte and characters
count in the files specified in the file arguments.
f. man : used to display the user manual of any command that we can run on
the terminal H:
a. PIPELINE COMMAND: The Pipe is a command in Linux that lets you use two or
more commands such that output of one command serves as input to the
next.
In short, the output of each process directly as input to the next one like a
pipeline.
I:
h. SGID : enables other users to inherit the effective GID of file group
owner
Output:-
Enter a Number
10
Positive
Enter a Number
-2
Negative
Enter a Number
fi
Output:-
Enter a number: 88
Number is odd.
Practical:- echo
"Enter Num1" read num1
echo "Enter
Num2" read num2 echo
"Enter Num3" read num3
Enter Num2
34
NAME= SHINDE KRISHNA KETANBHAI
SUB= OS
Enter Num3
34
charCheck($input_char)
Character ";
?>
Output:-
Input:8
Output: Digit
Input: E
Output: Alphabet
$i -le `expr
fi
i=`expr $i + 1` done if [
is Prime"
fi
Output:-
Enter a number: 5
Practical:- echo
"Enter a number"
read num
NAME= SHINDE KRISHNA KETANBHAI
SUB= OS
fact=1
for((i=2;i<=num;i++))
echo $fact
Output:-
Enter a number
Enter a number
24
Enter a number
120
9. Write a shell script for a fibrotic series of given number.
Practical:-
# Static input fo N
N=6
done
Output:-
Fibonacci Series is :
0
2
5
10. Write a shell script for a sum, average and product of given
number. Practical:- echo "Please enter your first number: " read a echo "Second
number: " read b echo "Third number: " read c echo "Fourth number: " read d echo
$sum / 5 | bc -l ) prod=$(($a
* $b * $c * $d * $e))
Output:-
Please enter your first number:
2
Second number:
Third number:
2
Fourth number:
Fifth number:
2
The sum of these numbers is: 11
fi
Output:-
Input: 2024
Output: "2024 is leap year"
Input: 2018
Output:
reverse number: of
12345 is 54321
Practical:- echo "Enter the five subject marks for the student" read m1 m2 m3 m4
m5 sum1=`expr $m1 +
Fail"
fi
Output:-
Enter the five subject marks for the student
45
35
30
40
42
Percentage : 76.8
14. Write a shell script to display the following details in a pay list
Pay slip details , House rent allowance, Dearness allowance,
Provident fund. HRA is to be calculated at the rate of 20% of
basic, DA at the rate of 40% of basic and PF at the rate of 10% of
basic.
Practical:
- i="y" while [
Output:-
15. Write a shell script to display a list of all files in the current
directory to which you have read, write and execute
permissions.
read dir if [ -d
$dir ] then cd
$dir ls > f exec
line
do
if [ -f $line ] then if [ -r $line -a -w
permissions"
fi fi
done
fi
Output:-
enter the directory name dir1
ff has all permissions files
not having permission
in
+) expr $n1 + $n2 ;;
esac
Output:-
Enter n1
2
Enter n2 3
N1+n2 5 N1-n2
1
N1*n2 6 N1/n2
0.666