Documente Academic
Documente Profesional
Documente Cultură
Studying of commands of
1
Unix
1
Unix Programming Lab
Assignment -1
ls dirname
2. rm Removes a file
rm filename
rmdir dirname
cat filename
mkdir dirname
2
Unix Programming Lab
13. whoami Specified case of who , but don’t display all the users who have logged
3
Unix Programming Lab
4
Unix Programming Lab
32. file Determines file types ( e.g. shell script , executable etc.)
5
Unix Programming Lab
Assignment -2
6
Unix Programming Lab
7
Unix Programming Lab
8
Unix Programming Lab
The kernel has the several functions. It manages files, carries out
all the data transfer b/w the file system and hardware. It manages
memory. It also handles any interrupts issued, as it is the entity that
has direct dealings with the h/w. The kernel program is usually
stored in a file ‘UNIX’, whereas the shell program is in a file
called ‘sh’.
9
Unix Programming Lab
2. Super Block: - The super block describe the state of the file
system – how large it is, how many maximum files it can
accommodate, how many more files can be created.
10
Unix Programming Lab
Assignment -3,4
Q1. Explain the three modes of operation of vi-editor.
11
Unix Programming Lab
12
Unix Programming Lab
Ans.
Command Function
:s/str1/str2 Replaces first occurrence of str1
with str2 in current line.
13
Unix Programming Lab
Assignment -5
read a b
read choice
case $choice in
1)
result=$(($a + $b))
echo "The answer is" $result
;;
2)
result=$(($a - $b))
echo "The answer is" $result
;;
3)
result=$(($a * $b))
echo "The answer is" $result
;;
4)
result=$(($a / $b))
echo "The answer is" $result
;;
esac
14
Unix Programming Lab
read a b c
if [ $a –gt $b ]
then
if [ $a –gt $c ]
then
echo $a is greatest
else
echo $c is greatest
fi
else
if [ $b –gt $c ]
then
echo $b is greatest
else
echo $c is greatest
fi
15
Unix Programming Lab
read num
num1=0
num2=1
echo $num1
echo $num2
count=2
do
echo $num3
16
Unix Programming Lab
num1=$num2
num2=$num3
count=`expr $count + 1`
done
17
Unix Programming Lab
read num
i=2
do
then
exit
fi
i=`expr $i + 1`
done
18
Unix Programming Lab
19