Professional Documents
Culture Documents
T.Y.B.Sc.
Linux
Practical No 3
Part-I:File System Commands:touch,cat,cp,rm,mv,mkdir,cd,rmdir
Q:1) Create five files with the name a1,b2,c3,d4,e5 by using touch
command.
[user43@linserver user43]$ touch a1 b2 c3 d4 e5
Q:2) Create five files with the name f6,g7,h8 using cat command with
some meaningful contents with a
[user43@linserver user43]$ cat> f6
This is file f6
this is cat command.
hello.
hi.
tybsc.
[user43@linserver user43]$ cat> g7
thid is file g7
hello.
hi.
tybsc.
this is cat cmd.
[user43@linserver user43]$ cat> h8
this is file h8
hello.
hi.
tybsc.
this is cat cmd.
Q:3) Concatenate the contents of f6 and g7 to a file called new1.
(Without creating new1)
[user43@linserver user43]$ cat f6 g7 >>new1
[user43@linserver user43]$ cat new1
This is file f6
this is cat command.
hello.
hi.
tybsc.
thid is file g7
hello.
hi.
tybsc.
this is cat cmd.
Q:4) Append the contents of f6 and h8 to new1.
[user43@linserver user43]$ cat f6 h8 >> new1
[user43@linserver user43]$ 9]$ cat new1
This is file f6
this is cat command.
Kirti College
hello.
hi.
tybsc.
thid is
hello.
hi.
tybsc.
this is
This is
this is
hello.
hi.
tybsc.
this is
hello.
hi.
tybsc.
this is
T.Y.B.Sc.
Linux
file g7
cat cmd.
file f6
cat command.
file h8
cat cmd.
Kirti College
T.Y.B.Sc.
Linux
ls
red
rm
mkdir
rmdir
mknod
rpm
mktemp
rvi
Kirti College
basename
unicode_start
bash
unicode_stop
bash2
unlink
bsh
usleep
cat
chgrp
view
chmod
ypdomainname
chown
zcat
cp
cpio
csh
T.Y.B.Sc.
Linux
dnsdomainname
gzip
more
rview
doexec
hostname
mount
sed
domainname
igawk
mt
setfont
dumpkeys
ipcalc
mv
setserial
echo
ed
jpeg-6b
kbd_mode
netstat
nice
sh
sleep
egrep
kill
nisdomainname
sort
env
link
pgawk
stty
ex
false
fgrep
ln
loadkeys
login
ping
ps
pwd
su
sync
tar
vi
Kirti College
T.Y.B.Sc.
pwd
Linux
red
rpm
rvi
sed
tar
????
link
ln
ls
mail
more
mt
mv
nice
ping
ps
rm
sh
sort
stty
su
sync
tcsh
true
vi
view
zcat
umount
unicode_start
uname
unicode_stop
Kirti College
arch
unicode_start
ash
unicode_stop
ash.static
aumix-minimal
awk
basename
bash
ypdomainname
bash2
bsh
T.Y.B.Sc.
Linux
cat
nice
rpm
stty
chgrp
nisdomainname
rvi
su
chmod
chown
cp
cpio
csh
pgawk
ping
ps
pwd
red
rview
sed
setfont
setserial
sh
sync
tar
tcsh
touch
true
unlink
usleep
vi
view
cut
netstat
rm
rmdir
sleep
sort
umount
uname
zcat
Kirti College
T.Y.B.Sc.
Linux
(xvi) List the contents of the directory along with all hidden files
except . and .. files.
[user43@linserver user43]$ ls -A
+1
copy1
fcmp1_289
green
pract7.10
pract7.7
prime1.out
Student
date
fcmp2
.gtkrc
pract7.11
pract7.9
prime.c
Student289
ashwini
date1
fcmp2_289 .kde
pract7.12
pract8.1
.prime.c.swo t4
.bash_history dir1
fcmp3_289
line
pract7.13
pract8.11.2
prime.out
transdata
.bash_logout dir2
fex1
login
pract7.15
pract8.12.3 product_289
try2
.bash_profile dir3
.file
loop
pract7.17
pract8.14
result
tryTime
.bashrc
doll
file2
masterdata pract7.18
pract8.3
result1
.viminfo
bdata289
.emacs
fod1
merit289
pract7.3
pract8.5
Shweta289 yellow
check
emp
foreg
month
pract7.3.1
pract8.6
ss1
checkgrade
empdata289
fsp289
names
pract7.4
pract8.7
ss2
commandfor
fact
gre1
pract
pract7.5
pract8.8
ss3
commandline fcmp1
(xvii) List all files with their attributes and file permissions.
[user43@linserver user43]$ ls -l
total 204
-rw-r--r-1 tybsc289 tybsc
159 Dec 7 10:52 +1
-rw-r--r-1 tybsc289 tybsc
16 Jan 18 09:57 ashwini
-rw-r--r-1 tybsc289 tybsc
193 Jan 18 08:39 check
-rw-r--r-1 tybsc289 tybsc
307 Jan 10 15:51 Stud289
...
...
-rw-r--r-1 tybsc289 tybsc
139 Jan 19 11:53 Student
-rw-r--r-1 tybsc289 tybsc
881 Jan 4 08:58 t1
-rw-rw-r-1 tybsc289 546
881 Dec 14 09:52 try1
-rw-rw-r-1 tybsc289 546
28 Dec 30 10:15 white
-rw-rw-r-1 tybsc289 546
36 Dec 14 09:09 yellow
(xviii) Same as above
(xix) List all the files showing the size of each file rounded up to
the nearest kilobyte.
[user43@linserver user43]$ ls -s
total 204
4 +1
4 dir3
4 login
4 pract7.17
4
ss1
4 ashwini
4 doll
4 loop
4 pract7.18
4
ss2
4 check
4 emp
4 names
4 pract7.3
4
ss3
Kirti College
4 checkgrade
Stud289
4 commandfor
Student
4 date
white
...
T.Y.B.Sc.
Linux
4 fact
4 pink
4 pract7.3.1
4 file2
4 pract
4 pract7.4
4 gre1
4 pract7.11
0 pract7.7
file size.
fact
fcmp3_244
prime1.out pract8.14
merit289
commandline
pract7.12
pract8.12.3
10000
pract8.8
pract7.17
file2
prime1.c
checkgrade
pract7.1
pract7.7
pract7.4
ss3
pract7.3.1 date
green
pract8.7
names
pract8.11.2 empdata244
ss2
try2
gre2
product_244 pract8.3
fex1
fcmp1
ss1
in columns.
check
ashwini
pract8.3
ss2
doll
pract7.17
pract8.1
yellow
pink
ss1
emp
foreg
dir2
names
fact
pract
date
line
pract7.1
checkgrade
ss3
dir3
t1
pract7.6
pract7.10
loop
Kirti College
T.Y.B.Sc.
Linux
pink
gre1
dir3
commandfor
(xxiii) Give the file listing where all the files are in long format
showing full size details.
[user43@linserver user43]$ ls -l
total 204
-rw-r--r-1 tybsc244 tybsc
159 Dec 7 10:52 +1
-rw-r--r-1 tybsc244 tybsc
16 Jan 18 09:57 ashwini
-rw-r--r-1 tybsc244 tybsc
193 Jan 18 08:39 check
-rw-r--r-1 tybsc244 tybsc
243 Jan 18 08:38 checkgrade
-rw-r--r-1 tybsc244 tybsc
31 Jan 18 11:26 commandfor
-rw-r--r-1 tybsc244 tybsc
56 Jan 4 08:57 commandline
-rw-r--r-1 tybsc244 tybsc
212 Jan 7 11:56 copy1
-rw-r--r-1 tybsc244 tybsc
220 Jan 18 11:48 date
-rw-r--r-1 tybsc244 tybsc
0 Jan 18 11:32 date1
drwxrwxr-x
2 tybsc244 546
4096 Nov 30 09:44 dir1
drwxrwxr-x
3 tybsc244 546
4096 Dec 14 10:08 dir2
drwxrwxrwx
2 tybsc244 546
4096 Dec 7 09:07 dir3
-r-xr-xr-x
1 tybsc244 tybsc
47 Jan 4 08:24 doll
. . .
-rw-r--r-1 tybsc244tybsc
41 Jan 4 10:18 pract7.1
-rw-r--r-1 tybsc244 tybsc
260 Jan 18 09:10 pract7.10
-rw-r--r-1 tybsc244 tybsc
299 Jan 18 09:24 pract7.11
-rw-r--r-1 tybsc244 tybsc
286 Jan 18 09:33 pract7.12
-rw-r--r-1 tybsc244 tybsc
419 Jan 18 09:56 pract7.13
-rw-r--r-1 tybsc244 tybsc
220 Jan 18 11:03 pract7.15
-rw-r--r-1 tybsc244 tybsc
115 Jan 18 10:49 pract7.17
-rw-r--r-1 tybsc244 tybsc
3 Jan 18 10:26 pract7.18
-rw-r--r-1 tybsc244 tybsc
1 Jan 4 10:32 pract7.3
-rw-r--r-1 tybsc244 tybsc
360 Jan 4 10:49 pract7.3.1
-rw-r--r-1 tybsc244 tybsc
138 Jan 18 08:10 pract7.4
-rw-r--r-1 tybsc244 tybsc
103 Jan 18 08:02 pract7.5
-rw-r--r-1 tybsc244 tybsc
128 Jan 18 08:12 pract7.6
-rw-r--r-1 tybsc244 tybsc
0 Jan 18 08:33 pract7.7
-rw-r--r-1 tybsc244 tybsc
221 Jan 18 08:43 pract7.9
-rw-r--r-1 tybsc244 tybsc
79 Jan 19 11:18 pract8.1
-rw-rw-r-1 tybsc244 546
28 Dec 30 10:15 white
-rw-rw-r-1 tybsc244 546
36 Dec 14 09:09 yellow
Kirti College
T.Y.B.Sc.
Linux
Practical No 4
Study of commands:find, tr, head, tail, wc, file, sort, split
1) Display using find command all the filenames under:
(i) /usr/sbin one screen at a time.
[user43@linserver user43]$ find /usr/sbin | more
/usr/sbin
/usr/sbin/iconvconfig
/usr/sbin/rpcinfo
/usr/sbin/build-locale-archive
/usr/sbin/zdump
/usr/sbin/zic
/usr/sbin/pwunconv
/usr/sbin/pwck
/usr/sbin/glibc_post_upgrade
/usr/sbin/alternatives
/usr/sbin/update-alternatives
/usr/sbin/mklost+found
/usr/sbin/arping
/usr/sbin/clockdiff
/usr/sbin/ping6
/usr/sbin/rdisc
/usr/sbin/tracepath
/usr/sbin/tracepath6
/usr/sbin/traceroute6
/usr/sbin/adduser
/usr/sbin/chpasswd
/usr/sbin/groupadd
/usr/sbin/groupdel
--More
(ii) /usr/sbin beginning with a lowercase c.
[user43@linserver user43]$ find /usr/sbin/c*
/usr/sbin/camel-index-control
/usr/sbin/camel-lock-helper
/usr/sbin/capiinit
/usr/sbin/chat
/usr/sbin/chkfontpath
/usr/sbin/chpasswd
/usr/sbin/chroot
/usr/sbin/ciped-cb
/usr/sbin/clockdiff
/usr/sbin/crond
/usr/sbin/cupsaddsmb
/usr/sbin/cupsd
10
Kirti College
T.Y.B.Sc.
Linux
11
Kirti College
T.Y.B.Sc.
Linux
Extension
ez
12
Kirti College
T.Y.B.Sc.
Linux
13
Kirti College
el 80386, version 1
(uses shared
libs), stripped
/usr/bin/zipgrep:
script text execu
table
/usr/bin/zipinfo:
executable, Int
el 80386, version 1
(uses shared
libs), stripped
/usr/bin/zipnote:
executable, Int
el 80386, version 1
(uses shared
libs), stripped
/usr/bin/zipsplit:
executable, Int
el 80386, version 1
(uses shared
libs), stripped
/usr/bin/zless:
script text execu
table
/usr/bin/zmore:
script text execu
table
..
T.Y.B.Sc.
Linux
14
Kirti College
/etc/cdrecord.conf:
/etc/cipe:
/etc/CORBA:
/etc/cron.d:
/etc/cron.daily:
/etc/cron.hourly:
/etc/cron.monthly:
T.Y.B.Sc.
Linux
15
Kirti College
T.Y.B.Sc.
Linux
/usr/bin/zmore:
Bourne shell
script text execu
table
/usr/bin/zless:
Bourne shell
script text execu
table
/usr/bin/zless:
Bourne shell
script text execu
table
/usr/bin/zipsplit:
ELF 32-bit LSB
executable, Int
el 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked
(uses shared
libs), stripped
/usr/bin/zipsplit:
ELF 32-bit LSB
executable, Int
el 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked
(uses shared
libs), stripped
/usr/bin/zipnote:
ELF 32-bit LSB
executable, Int
el 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked
(uses shared
libs), stripped
c) Sort the etcfiles.txt into alphabetical order on the second field
[user43@linserver user43]$ sort +1 etcfiles.txt | more
/usr/bin/evolution-move-tasks:
a perl script text
executable
/usr/bin/evolution-move-tasks:
a perl script text
executable
/usr/bin/libglade-xgettext:
a python script
text executabl
e
/usr/bin/libglade-xgettext:
a python script
text executabl
e
/etc/rpc:
ASCII C program text
/etc/mime-magic:
ASCII C++ program text
/etc/ltrace.conf:
ASCII C program text
/usr/bin/e2pall:
ASCII English text
/usr/bin/e2pall:
ASCII English text
/usr/bin/xsubpp:
ASCII English text
/usr/bin/xsubpp:
ASCII English text
/usr/bin/epstopdf:
ASCII English text
/usr/bin/epstopdf:
ASCII English text
/usr/bin/thumbpdf:
ASCII English text
/usr/bin/thumbpdf:
ASCII English text
/etc/imrc:
ASCII English text
/etc/fdprm:
ASCII English text
/etc/hosts:
ASCII English text
16
Kirti College
T.Y.B.Sc.
Linux
d) Find out how many English text files are listed in the
etcfiles.txt file
[user43@linserver user43]$ grep English etcfiles.txt | wc -l
67
5) Create a file using vi editor with the following contents.
[user43@linserver user43]$ cat names
Mahesh Deshpande 234
Naresh Nair 431
Allen Disuza 121
Hari Kutian 231
Ramesh Dubey 231
Akshay Das 256
(i) Sort on the first names only
[user43@linserver user43]$ sort +0 -1 names
Akshay Das 25
Allen Disuza 121
Hari Kutian 231
Mahesh Deshpande 234
Naresh Nair 431
Ramesh Dubey 231
(ii) Sort on the last names only
[user43@linserver user43]$ sort +1 -2 names
Akshay Das 256
Mahesh Deshpande 234
Allen Disuza 121
Ramesh Dubey 231
Hari Kutian 231
Naresh Nair 431
(iii) Sort on first four characters only
[user43@linserver user43]$ cut -c 1-4 names | sort
Aksh
Alle
Hari
Mahe
Nare
Rame
(iv) Sort on their numbers only
[user43@linserver user43]$ sort +2 names
Allen Disuza 121
Hari Kutian 231
Ramesh Dubey 231
Mahesh Deshpande 234
Akshay Das 256
Naresh Nair 431
17
Kirti College
T.Y.B.Sc.
Linux
6)Construct and execute the commands to create a file with the name
Stud<roll_no> with the following fields separated by a blank space.
(i)
[user43@linserver user43]$ cat Stud244
RollNo FirstName
LastName
DateOfBirth
Marks
289
Shweta
Choudhary
7-12-1985
430
291
Mildred
D'mello
9-12-1985
500
289
Megha
Menon
14-10-1985
550
298
Vikrant
Mahkal
12-5-1985
500
300
Sankalp
Naik
11-5-1985
550
(ii) Sort the data on first names only
[user43@linserver user43]$ sort +1 -2 Stud244
RollNo FirstName
LastName
DateOfBirth
289
Megha
Menon
14-10-1985
291
Mildred
D'mello
9-12-1985
300
Sankalp
Naik
11-5-1985
289
Shweta
Choudhary
7-12-1985
298
Vikrant
Mahkal
12-5-1985
Marks
550
500
550
430
500
430
500
500
550
550
Marks
Extension
18
Kirti College
T.Y.B.Sc.
Linux
...
application/news-message-id
application/news-transmission
application/ocsp-request
application/ocsp-response
(ii) Display first two lines of fsp<seat_no> and convert all the
characters into capital letters
[user43@linserver user43]$ head -2 fsp244 | tr '[a-z]' '[A-Z]'
# THIS IS A COMMENT. I LOVE COMMENTS.
(iii) Display the last 15 lines
[user43@linserver user43]$ tail
application/iotp
application/ipp
application/isup
application/font-tdpfr
application/mac-binhex40
application/mac-compactpro
application/macwriteii
application/marc
application/mathematica
application/mathematica-old
application/msword
application/news-message-id
application/news-transmission
application/ocsp-request
application/ocsp-response
of fsp<seat_no>
-15 fsp244
hqx
cpt
doc
19
Kirti College
application/index.cmd
. . .
application/mathematica-old
application/msword
application/news-message-id
application/news-transmission
application/ocsp-request
application/ocsp-response
T.Y.B.Sc.
Linux
doc
having at most 20
and count the
t4
dir2
dir3
doll
fod1
foreg
fact
fcmp1
gre1
pract7.6
10000
fcut2
fex1
file2
month
names
fsed1
fsp244
pract
pract7.7
20
Kirti College
T.Y.B.Sc.
Linux
(vi) Split the files fsp<seat_no> into three subparts named fspaa,
fspab, fspac and display the contents of these files and count the
number of lines in them
[user43@linserver user43]$ split -20 fsp244 fsp
[user43@linserver user43]$ ls
+1
date1
fcmp3_244
line
t4
10000
dir1
fcut1
login
ashwini
dir2
fcut2
loop
product_244 try2
bdata244
dir3
fex1
masterdata
result
tryTime
check
doll
file2
merit244
result1
xaa
emp
fod1
month
pract7.18
Shweta244
xab
empdata244 foreg
names
pract7.3
fspaa
xac
commandline fact
fsed1
newsed
fspab
yellow
copy1
fcmp1
fsp244
newsedclear fspac
cutlist1
fcmp1_244
gre1
pract
cutlist2
fcmp2
gre2
pract7.1
pract7.6
prime1.c
date
fcmp2_244
green
pract7.10
pract7.7
prime1.out
Student244
[user43@linserver user43]$ cat fspaa | wc -l
20
[user43@linserver user43]$ cat fspab | wc -l
20
[user43@linserver user43]$ cat fspac | wc -l
10
21
Kirti College
T.Y.B.Sc.
Linux
Practical No.5
1) od,cmp,comm.,diff,uniq:
Create a file named fod1 with some contents
contents and display it in
(i) octal form only
[user43@linserver user43]$ od -b fod1
0000000 124 150 151 163 040 151 163 040 160
141
0000020 154 040 156 165 155 142 143 162 040
164
0000040 141 040 103 150 157 165 144 150 141
163
0000060 143 012
0000062
(ii) octal form along with its text
[user43@linserver user43]$ od -b -c
0000000 124 150 151 163 040 151 163
141
T
h
i
s
i
s
a
0000020 154 040 156 165 155 142 143
164
l
n
u
m
b
e
t
0000040 141 040 103 150 157 165 144
163
a
C
h
o
u
d
s
0000060 143 012
c \n
0000062
contents.
fod1
040 160 162 141 143 164 151 143
p
\n
\n
22
Kirti College
T.Y.B.Sc.
Linux
(b) Add two more names and save the contents in fcmp2<seat_no>.
[user43@linserver user43]$ cp fcmp1_244 fcmp2_244 && cat >>
fcmp2_244
Minal
Ankit
[user43@linserver user43]$ cat fcmp2_244
Shweta
Megha
Mildred
Sonal
Nikita
Nisha
Minal
Ankit
(c) Sort the contents of file fcmp1<seat_no>.
[user43@linserver user43]$ sort fcmp1_244
Ankit
Megha
Mildred
Minal
Nikita
Nisha
Shweta
Sonal
(d) Display the names, which are common to fcmp1<seat_no>, and
fcmp2<seat_no>.
[user43@linserver user43]$ comm fcmp1_244 fcmp2_244
Shweta
Megha
Mildred
Sonal
Nikita
Nisha
Minal
Ankit
(e) Display the difference between fcmp1<seat_no> and
fcmp2<seat_no>.
[user43@linserver user43]$ cat >> fcmp1_244
Abhishek
[user43@linserver user43]$ diff fcmp1_244 fcmp2_244
9d8
< Abhishek
23
Kirti College
T.Y.B.Sc.
Linux
24
Kirti College
T.Y.B.Sc.
Linux
A)
(i) To check whether the files differ.
[user43@linserver user43]$ cmp fcmp1 fcmp2
fcmp1 fcmp2 differ: byte 37, line 3
(ii) To compare the two files byte to byte.
[user43@linserver user43]$ cmp -l fcmp1 fcmp2
37 165 63
38 156 162
39 151 144
40 170 40
41 40 154
42 160 151
43 162 156
44 141 143
43 143 12
. . .
59 141 151
60 154 143
61 40 141
62 157 154
63 156 40
64 40 156
66 144 40
67 12 65
68 120 12
cmp: EOF on fcmp2
B) Using diff
(i) To display the lines which are common to both, the lines which
are not common and to display the lines, which are common to both.
[user43@linserver user43]$ diff fcmp1 fcmp2
3,4c3,4
< This is unix practical
< Practical on od
--> This is 3rd line
> Goodbye
(ii) To display the difference in context output format.
[user43@linserver user43]$ diff -c fcmp1 fcmp2
*** fcmp1
2006-01-24 09:30:21.000000000 +0530
--- fcmp2
2006-01-24 09:35:02.000000000 +0530
***************
*** 1,5 ****
This is fcmp1
This is fcmp2
! This is unix practical
! Practical on od
Practical no 5
25
Kirti College
T.Y.B.Sc.
Linux
26
Kirti College
4
5
T.Y.B.Sc.
Linux
Practical on od
Practical no 5
E) Using cat to append the fcmp1 to fcmp2 and sort this appended
fcmp2 and store it in a file named funiq1
[user43@linserver user43]$ cat fcmp1
Hello
Hi
GoodMorning
GoodNight
Good Bye
[user43@linserver user43]$ cat fcmp2
Hello
Hi
GoodMorning
GoodNight
Good Bye
Hello
Hi
GoodMorning
GoodNight
Good Bye
[user43@linserver user43]$ cat fcmp1 fcmp2 |sort > funiq1
[tybsc297@linserver tybsc297]$ cat funiq1
Good Bye
Good Bye
Good Bye
GoodMorning
GoodMorning
GoodMorning
GoodNight
GoodNight
GoodNight
Hello
Hello
Hello
Hi
Hi
Hi
27
Kirti College
T.Y.B.Sc.
Linux
F) Using uniq
(i) To remove the duplicate lines in funiq1
[user43@linserver user43]$ uniq funiq1
Good Bye
GoodMorning
GoodNight
Hello
Hi
(ii) To count the duplications and prepend number to each line
[user43@linserver user43]$ uniq -c funiq1
3 Good Bye
3 GoodMorning
3 GoodNight
3 Hello
3 Hi
(iii) To display the duplicate lines only
[user43@linserver user43]$ uniq -d funiq1
Good Bye
GoodMorning
GoodNight
Hello
Hi
(iv) To display unique lines only
[user43@linserver user43]$ uniq funiq1
Good Bye
GoodMorning
GoodNight
Hello
Hi
4) Create a file name<roll_no> with fields(first name, second name,
last name, salary)separated by :. Insert at least five appropriate
records in above file
[user43@linserver user43]$ vi Shweta244
[user43@linserver user43]$ cat Shweta244
Shweta:Naresh:Choudhary:20000
Anu:Chandu:Menon:30000
Nisha:Suresh:Choudhary:2500
Mildred:Felix:D'mello:40000
Dilip:Chandu:Mehra:60000
28
Kirti College
T.Y.B.Sc.
Linux
29
Kirti College
T.Y.B.Sc.
Linux
(i) Cut first two columns from fcut1 and store the contents in the
file cutlist1 and cut the second and third columns from the fcut2
and store it in cutlist2.
[user43@linserver user43]$ cut -c 1-2 fcut1 >> cutlist1
[user43@linserver user43]$ cat cutlist1
Ak
Al
Ha
Ma
Na
[user43@linserver user43]$ cut -c 2-3 fcut2 >> cutlist2
[user43@linserver user43]$ cat cutlist2
hi
hi
hi
oo
ra
(ii) Paste the contents of cutlist2 to contents of cutlist1.
[user43@linserver user43]$ paste cutlist2 >> cutlist1
[user43@linserver user43]$ cat cutlist1
Ak
Al
Ha
Ma
Na
hi
hi
hi
oo
ra
Translate the first three lines into capital letters using tr
command.
[user43@linserver user43]$ head -3 fcut1 fcut2 | tr '[a-z]' '[A-Z]'
==> FCUT1 <==
AKSHAY DAS 256
ALLEN DISUZA 121
HARI KUTIAN 231
==> FCUT2 <==
THIS IS FCMP1
THIS IS FCMP2
THIS IS 3RD LINE
30
Kirti College
T.Y.B.Sc.
Linux
Practical No 6
Grep,egrep,fgrep:
A) Create the file with the name gre1 and the following contents:
[user43@linserver user43]$ cat gre1
This is a first line.
This is a second line.
Please type the third line.
Do you wish to continue?
Simply type the fourth line.
B) Create the file with the name gre2 and the following contents:
[user43@linserver user43]$ cat gre2
The grep is an acronym for 'globally search a regular expression and
print it'.
The command searches the specified inpyt globally for a match with
the specified patter
n and displays it.While forming the pattern to be searched we can
use shell metacharact
ers, or regular expressions as professional unix users call them.
C) Do the following:
1) Search the word line and display the lines containing it.
[user43@linserver user43]$ grep line gre1
This is a first line.
This is a second line.
Please type the third line.
Simply type the fourth line.
2) Search the word the or The in both the files gre1 and gre2 and
display the lines containing it.
[user43@linserver user43]$ grep the gre1 gre2
gre1:Please type the third line.
gre1:Simplt type the fourth line.
gre2:The command searches the specified inpyt globally for a match
with the specified p
attern and displays it.While forming the pattern to be searched we
can use shell metach
aracters, or regular expressions as professional unix users call
them.
[user43@linserver user43]$ grep The gre1 gre2
gre2:The grep is an acronym for 'globally search a regular
expression and print it'.
gre2:The command searches the specified inpyt globally for a match
with the specified p
attern and displays it.While forming the pattern to be searched we
can use shell metach
aracters, or regular expressions as professional unix users call
them.
31
Kirti College
T.Y.B.Sc.
Linux
32
Kirti College
T.Y.B.Sc.
Linux
33
Kirti College
T.Y.B.Sc.
Linux
Practical No 7
Q1)Advanced Shell Programming I
1) To find the sum and product of integers.
[user43@linserver user43]$ cat calc
a=30
b=20
expr $a + $b
expr $a \* $b
echo
Output
[user43@linserver user43]$ bash calc
50
600
2) To read the basic salary and find the gross salary.
[user43@linserver user43]$ cat pract7.3
echo Enter your basic salary
read basic
echo da
da= expr \( $basic \* 20 / 100 \)
echo hra
hra= expr \( $basic \* 30 / 100 \)
echo Taxes
Taxes= expr \( $basic \* 20 / 100 \)
echo Your gross salary is
expr $basic + \( $basic \* 20 / 100 \) + \( $basic \* 30 / 100 \)
- \( $basic \*
20 / 100 \)
Output
[user43@linserver user43]$ bash pract7.3
Enter your basic salary
1000
da
200
hra
300
Taxes
200
Your gross salary is
1300
34
Kirti College
T.Y.B.Sc.
Linux
35
Kirti College
T.Y.B.Sc.
Linux
36
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver user43]$ bash grades
enter your marks
158
enter below 100
7)To check whether the number is +ve or ve using ifelif.
[user43@linserver user43]$ cat 10nos
echo enter a number
read a
if [ $a -lt 0 ]
then
echo $a is negative
elif [ $a -gt 0 ]
then
echo $a is positive
else
echo number is neither positive nor negative
fi
Output
[user43@linserver user43]$ bash 10nos
enter a number
55
55 is positive
8) To print the day of week using case in
[user43@linserver user43]$ cat pract7.9
echo enter a value for a day
read d
case $d in
1) echo "Monday"
;;
2) echo "Tuesday"
;;
3) echo "Wednesday"
;;
4) echo "Thursday"
;;
5) echo "Friday"
;;
6) echo "Saturday"
;;
7) echo "Sunday"
;;
*) echo "Invalid Day Number"
esac
37
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver user43]$ bash pract7.9
enter a value for a day
6
Saturday
9) To find the type of the character entered.
[user43@linserver user43]$ cat pract7.10
echo enter the character
read char
case $char in
[a-z] )echo "You have entered small case"
;;
[A-Z] )echo "You have entered capital case"
;;
[0-9] )echo "You have entered number"
;;
?)echo "You have entered a special character"
;;
*)echo "You have entered more the one character"
;;
esac
Output
[user43@linserver user43]$ bash pract7.10
enter the character
a
You have entered small case
10) To find the pattern of the string entered using casein.
[user43@linserver user43]$ cat pract7.11
echo enter the string
read s
case $s in
[aeiou]*)echo "The String begins with a small case vowel"
;;
[AEIOU]*)echo "The String begins with a capital case vowel"
;;
[0-9]*)echo "The String begins with a digit"
;;
*[0-9])echo "The String ends with a digit"
;;
?????)echo "You entered a five letter word"
;;
esac
38
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver user43]$ bash pract7.11
enter the string
i
The String begins with a small case vowel
11) To find the type of the file.
[user43@linserver user43]$ cat pract7.12
echo enter the filename
read filename
if [ -f $filename ]
then
echo It is a file
if [ -c $filename ]
then
echo It is a charcter special file
elif [ -b $filename ]
then
echo It is a block special file
else
echo Format not reconized
fi
elif [ -d $filename ]
then
echo It is a directory
else
echo The file or directory doesnt exist
fi
Output
[user43@linserver user43]$ bash pract7.12
enter the filename
pract7.1
It is a file
Format not recognized
12) To prepare a menu driven program.
[user43@linserver user43]$ cat pract7.13
echo Press 1 to see the working directory
echo Press 2 to create new file with some contents
echo Press 3 to see Contents of the directory
echo Press 4 to sort a file
echo Press 5 to see all users logged in
echo Enter Your choice
read a
case $a in
39
Kirti College
T.Y.B.Sc.
Linux
1) \pwd
;;
2) echo Enter the filename
read n
\cat > $n
;;
3) \ls dir1
;;
4) echo enter the filename
read f
\sort $f
;;
5) \who
;;
*) echo Entry made is not valid
;;
esac
Output
[user43@linserver user43]$ bash pract7.13
Press 1 to see the working directory
Press 2 to create new file with same contents
Press 3 to see Contents of the directory
Press 4 to sort a file
Press 5 to see all users logged in
Enter Your choice
1
/home/tybsc244
13) To print first n number and their sum using while loop to print.
[user43@linserver user43]$ cat loop
echo enter the number
read d
n=1
sum=0
while [ $n -le $d ]
do
echo $n
sum=` expr $sum + $n `
n=` expr $n + 1 `
done
echo The sum of $d nos is $sum
40
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver user43]$ bash loop
enter the number
12
1
2
3
4
5
6
7
8
9
10
11
12
The sum of 12 nos is 78
14) To call another file.
[user43@linserver user43]$ cat pract7.15
echo Press 1 to Compare the String
echo Press 2 To check wheteher number is +ve and -ve
echo Press 3 To Obtain sum of and product two numbers
read f
case $f in
1) bash pract7.4
;;
2)bash check
;;
3)bash pract7.1
;;
*)echo Invalid entry
;;
esac
Output
[user43@linserver user43]$ bash pract7.15
Press 1 to Compare the String
Press 2 To check wheteher number is +ve and -ve
Press 3 To Obtain sum of and product two numbers
2
Enter any No
-5
The no. is negative
41
Kirti College
T.Y.B.Sc.
Linux
15) To print the first n numbers and their sum using dountil
[user43@linserver user43]$ cat pract7.16
echo Enter The first n nos. using until
read n
i=1
sum=0
until [ $i -gt $n ]
do
echo $i
sum=`expr $sum + $i`
i=`expr $i + 1`
done
echo The Sum of $n nos is $sum
Output
[user43@linserver user43]$ bash pract7.16
Enter The first n nos. using until
12
1
2
3
4
5
6
7
8
9
10
11
12
The Sum of 12 nos is 78
16) To demonstrates the use of for loop.
[user43@linserver user43]$ cat pract7.17
echo The First 10 nos using For loop
n=0
sum=0
for n in 1 2 3 4 5 6 7 8 9 10
do
echo $n
sum=`expr $sum + $n `
done
echo The sum Of 10 nos is $sum
Output
The First 10 nos using For loop
42
Kirti College
T.Y.B.Sc.
Linux
1
2
3
4
5
6
7
8
9
10
The sum Of 10 nos is 55
For loop using command line arguments
[user43@linserver user43]$ cat commandfor
for f in $*
do
echo $f
done
Output
[user43@linserver user43]$ bash commandfor 1 2 3
1
2
3
17) To display the directories and files.
[user43@linserver user43]$ cat pract7.18
ls
Output
[user43@linserver user43]$ bash pract7.18
=
fcmp2
login
pract7.1
pract8.11.c
saffron
+1
fcmp2289
loop
pract7.10
sample
10000
fcmp2397
megha
pract8.11.out
pract7.11 pract8.12.3 scheck
5
fcmp289
Megha289
pract7.12
pract8.1.a
dir3
.5
pract7.6
prime.out
us1
egg
pract08.2
pract7.7
product289
white
empdata289 greenpple
pract11.a
pract7.9
pscheck
workbpbunixbools
fcmp1
head
pract11.a.c pract8.1
result
fcmp1289
icecream
pract4.5
pract8.11 result1
43
Kirti College
T.Y.B.Sc.
Linux
Practical no. 8
ADVANCED SHELL PROGRAMMING II
Ex.1
(A)Write a shell script to generate the following series
1,3,2,4,3,5,4,6100
Write down the shell script in the answer sheet. Execute it and
show it to the examiner.
[user43@linserver user43]$ cat pract8.1.a
i=1
j=3
while [ $i -le 11 ]
do
echo $i
echo `expr $i + 2 `
i=` expr $i + 1 `
done
Output
[user43@linserver user43]$ bash pract8.1.a
1
3
2
4
3
5
4
6
5
7
6
8
7
9
8
10
44
Kirti College
T.Y.B.Sc.
Linux
45
Kirti College
T.Y.B.Sc.
Linux
Ex.2
(A)
(i) Give correct command to the following
1. Display your current working directory.
2. List all files starting with letter C.
3. Display your terminal address.
4. Create a subdirectory COMP<seatno>.Change to this
directory & create two files comp1 <seatno1> and
<seatno2>.
5. Make a copy of file comp2<seatno2> into file
comp3<seatno3>.Display their inode numbers.
Write down the commands in the answer sheet. Execute them and
show it to the examiner.
[user43@linserver user43]$ cat pract8.2.1
echo You have following options
echo 1. Display your current working directory
echo 2. List all files starting with letter c
echo 3. Display your terminal address
echo 4. Change to directory COMP303 and create files
echo 5. Copy file comp2303 into file comp3303 and display inode
number
echo Enter your choice
read c
case $c in
1)echo you are working on
pwd
;;
2)ls c*
;;
3)tty
;;
4)cd COMP303
echo Changed to directory COMP303
echo Enter two file names
read f1
read f2
touch $f1 $f2
echo Files created
;;
5)cp comp2303 comp3303
echo File copied
cat comp3303
ls -i comp2303 comp3303
;;
esac
46
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver user43]$ bash pract8.2.1
You have following options
1. Display your current working directory
2. List all files starting with letter c
3. Display your terminal address
4. Change to directory COMP303 and create files
5. Copy file comp2303 into file comp3303 and display inode number
Enter your choice
5
File copied
This is file comp2303
Practical no 8
1056849 comp2303 1056848 comp3303
(B)Create a shell script to print summation of following series
1! +2! +3! + 4! + 5! + ------- + N!
Write down shell script in the answer sheet. Execute it and show
it to the examiner.
[user43@linserver user43]$ cat pract8.2
i=1
fact=1
sum=0
echo Enter values
read n
while [ $i -le $n ]
do
fact=`expr $fact \* $i`
i=`expr $i + 1`
sum=`expr $sum + $fact`
echo $fact
done
echo The sum of the factorial $n is $sum
Output
[user43@linserver user43]$ bash pract8.2
Enter values
5
1
2
6
24
120
The sum of the factorial 5 is 153
47
Kirti College
T.Y.B.Sc.
Linux
Ex.3
(A)Write a shell script, which displays number of ordinary files,
directories and special files in the current working directory.
Write down the shell script on the answer sheet. Execute it and show
it to the examiner.
[user43@linserver user43]$ cat filetype
echo Enter a filename
read filename
if [ -f $filename ]
then
echo Entered a file name
if [ -s $filename ]
then
echo File of length greater than 0
elif [ -c $filename ]
then
echo Special character file
elif [-b $filename ]
then
echo Block special file
else
echo File not supported
fi
elif [ -d $filename ]
then
echo entered a directory
else
echo Invalid name
fi
Output
[user43@linserver user43]$ bash filetype
Enter a filename
greenapple
Entered a file name
File of length greater than 0
Ex.4
(A)Write a shell script to create a file, which stores the names of
the files and against each name, put either morning, evening or
afternoon depending upon the time when file was created. Write a
shell script in answer sheet, execute it and show it to the
examiner.
[user43@linserver user43]$ cat time1
echo Enter File name
read f
hrs=`ls -l |grep $f|cut -d" " -f 19|cut -c1,2`
echo $hrs
48
Kirti College
T.Y.B.Sc.
Linux
]
Morning
12 ]
Afternoon
49
Kirti College
T.Y.B.Sc.
Linux
50
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver
enter the product
04
enter the product
lmn
enter the price
90
enter the product
8
Record entered
01:abc:10:2
01:abc:12:09
02:pqr:20:1
03:bcd:20:20
04:lmn:90:8
qty
Ex.7
(A)Write a shell script that asks the user to input a number N and
displays the squares of al
numbers from 1 to N as follows.
1 square = _______
2 square = _______
.
.
N square = _______
Write down the shell script in the answer sheet, execute it and
show it to the examiner.
[user43@linserver user43]$ cat pract8.7
echo enter the number N
read N
i=1
sqr=1
while [ $i -le $N ]
do
sqr=` expr $i \* $i `
echo $i square = $sqr
i=` expr $i + 1`
done
Output
[user43@linserver user43]$ bash pract8.7
enter the number N
5
1 square = 1
2 square = 4
3 square = 9
4 square = 16
5 square = 25
51
Kirti College
T.Y.B.Sc.
Linux
Ex.8
(A)Generate a shell script, which accepts a user name. If user is
not present then appropriate message should be displayed
otherwise tell the user to logout out. Wait for 5 seconds and
then kill the given users jobs.
[NOTE: User will be provided by the examiner.]
Write down the shell script in the answer sheet, execute it and
show it to the examiner.
Create a file named file <seatno> of your choice and try that
grep command to search for the following patterns along with the
following options.
1. To print only a count of line that contains a
pattern.
2. Ignore uppercase/lowercase distinction during
comparison.
3. Print all lines except those contain a pattern.
Write down the commands in the answer sheet, execute them and
show it to the examiner.
[user43@linserver user43]$ cat pract8.8
echo enter the username
read us
who >> us1
n=`grep $us us1 | wc -l `
if [ $n -gt 0 ]
then
echo You are valid user
else
echo Invalid user
fi
Output
[user43@linserver user43]$ bash pract8.8
enter the username
tybsc244
You are valid user
[user43@linserver user43]$ bash pract8.8
enter the username
tybsc200
Invalid user
52
Kirti College
T.Y.B.Sc.
Linux
Ex.9
(A)Generate a shell script that will check for every minute, how
many
users logged in.
Write down shell script in the answer sheet, execute it and show
it to the examiner.
[user43@linserver user43]$ cat pract8.9
#To Check Whether how many users have logged in every minute
echo Enter the time
read time
t=`who | cut -c 30,31,32,33,34 | grep -c $time`
echo The Number of users who logged in at $time :$t
Output
[user43@linserver user43]$ bash pract8.9
Enter the time
15:46
The Number of users who logged in at 15:46 :3
Ex.10
(A)Write a shell script to generate prime series up to N.
Write down shell script in the answer sheet, execute it and show
it
to the examiner.
[user43@linserver user43]$ cat pract8.11.c
#include<stdio.h>
#include<math.h>
main(void)
{int no,i,j,prime=1,m;
printf("enter a number: ");
scanf("%d",&no);
if (no==1)
printf("1 is a prime");
if (no==2)
printf("2 is a prime number");
if (no%2==0)
prime=0;
53
Kirti College
T.Y.B.Sc.
Linux
else
{
for(i=3;i<=no;i=i+2)
{ prime=1;
for(m=3;m<=(no/2);m=m+2)
{
if(no%i==0)
{
prime=0;
break;
}
}
if (prime==1)
printf("\n%d is a prime number",i);
}
}
}
Output
[user43@linserver user43]$ gcc -o primeo.out pract8.11.c
[tybsc289@linserver tybsc289]$ ./primeo.out
Enter the no 11
3
5
7
54
Kirti College
T.Y.B.Sc.
Linux
Ex.11
(A) Write a shell script to find GCD& LCD of two positive numbers.
Write down shell script in the answer sheet, execute it and show
it to the examiner.
echo enter two numbers
read a b
prod=`expr $a \* $b | bc -l `
if [ $a -lt $b ]
then
temp=$a
a=$b
b=$temp
fi
r=` expr $a % $b `
while [ $r -gt 0 ]
do
a=$b
b=$r
r=` expr $a % $b `
done
echo GCD = $b
LCM=`expr $prod / $b | bc -l `
echo LCM = $LCM
Output
[user43@linserver user43]$ bash gcd
enter two numbers
30 58
GCD = 2
LCM = 870
(B) Write a shell script which takes two arguments. The first
argument is a pattern & second is a filename .Check whether the
pattern supplied is found in the file or not. If found store it
in other file named output<seatno> and display the content of
output file with line numbers.
Write down shell script in the answer sheet, execute it and show
it to the examiner.
[user43@linserver user43]$ cat pract8.12.3
if [ $# -gt 2 -o $# -lt 2 ]
then
echo Wrong arguments
elif [ -f $2 ]
then
echo `grep -n $1 $2` >> result
cat result
else
echo File does not exist
fi
55
Kirti College
T.Y.B.Sc.
Linux
Output
[user43@linserver user43]$ bash pattern1 apple greenapple
1223343777
1223343777
asdakjkjdhkwe
2:asdakjkjdhkwe
2:asdakjkjdhkwe
1:i am apple 2:then i am greenapple
Ex 12
Write a shell script,which acceptes a month number , and print
corresponding month name.
[user43@linserver user43]$ cat month1
echo enter month number
read n
case $n in
1)echo January
;;
2)echo February
;;
3)echo March
;;
4)echo April
;;
5)echo May
;;
6)echo June
;;
7)echo July
;;
8)echo August
;;
9)echo September
;;
10)echo October
;;
11)echo November
;;
12)echo December
;;
*)
echo Invalid Month
;;
Esac
Output
[user43@linserver user43]$ bash month1
enter month number
1
January
56
Kirti College
T.Y.B.Sc.
Linux
Ex.13 (*********************************)
(A)Create the following files using given fields. Fields are
separated by a colon (:)
Masterdata<seatno> (Product number,
product name, rate, description, supplier code,
Supplier name, supplier address)
Transdata<seatno> (Product number, customer code, customer
name, unit sold, rate of
sale, date of sale.)
Insert at least three records in each file and write a shell
script to display following menu: 1: Product Query 2: Customer
Query 0; Exit
Enter choice (0-2):
If the choice is 1, get the customer number from the user and
display all records with this product number from the file
masterdata<seatno>, and then ask the user if he/she wants to
query on another product. If the answer is no, the user should be
returned to main menu.
If the choice is 2, get the customer number from the user and
display all transactions pertaining to this customer from the
file transdata<seatno>.
If the choice is 0, the user shall return to shell prompt.
If choice is other than (0-2) then an error message should be
displayed and the choice is re-accepted.
Write down shell script in the answer sheet, execute it and
show it to the examiner.
[user43@linserver user43]$ cat Pract14
echo Press 1 product query
echo Press 2 customer query
echo Press 0 for exit
read n
case $n in
1)while [ $result = y ]
do
echo enter product no
read pno
echo `cut -f 1 Masterdata | grep $pno`
echo 'Do u want to check any other product?(y/n)'
read result
done
;;
2)while [ $result = y ]
do
echo enter customer no
read cno
echo `cut -f 2 Transdata | grep $cno`
#************************************************
r=`echo grep $cno Transdata | wc -l`
echo $r
57
Kirti College
T.Y.B.Sc.
Linux
Output
Masterdata
[user43@linserver user43]$ cat Masterdata
01:abc:10:xyz:c001:def:bbbb
02:uuu:10:ppp:c002:lll:oooo
03:kkk:11:hhh:c003:tttt:iiii
Transdata
[user43@linserver user43]$ cat Transdata
01:Cust01:shweta:03:20:22Jan2005
02:Cust02:Milu:03:25:21Oct2006
03:Cust03:Anu:04:24:11Apr2004
General Output
Press 1 product query
Press 2 customer query
Press 0 for exit
1
enter product no
03
03:kkk:11:hhh:c003:tttt:iiii
Do u want to check any other product?(y/n)
n
Press 1 product query
Press 2 customer query
Press 0 for exit
2
enter customer no
Cust01
01:Cust01:shweta:03:20:22Jan2005
1
Do u want to check any other customer?(y/n)
n
Press 1 product query
Press 2 customer query
Press 0 for exit
58
Kirti College
T.Y.B.Sc.
Linux
Practical No 9
Editors In Linux
Part I
vi editor
Create a file with the name fvi1 with atleast 10 lines.
[user43@linserver user43]$ vi fvil
1) Perform the vi commands to the following cursor movements:
- 3 words to the right
3w
- 4 words to the left
4b
- Bottom of screen
L
- Beginning of current line
O
- Beginning of the file
H
- End of current line
$
- End of the line
G
2) Perform the vi commands to do the following deletions:
- character at the cursor
x
- one word from the current position
dw
- current line
dd
- next 4 lines
4dd
- line to the left of cursor
d0
- line to the right of cursor
d$
59
Kirti College
T.Y.B.Sc.
Linux
Part II
Ex line editor
Create a file with the name fex1 having the contents as follows:
Do the following:
1) Invoke this file from ex mode
[user43@linserver user43]$ ex fex1
2) Give line numbers to the lines of included in the file
set nu
3) Delete the last line
dd
4) Copy the first line after the last line
y$ then 1p
5) Copy lines 2 to 5 after the last line
e4yy ep
6) Delete the line 1 to 5
e5dd
7) Append the lines 6 to 10 to this line
e3yy ep
8) Try out various options to bring the file in the original order
of line numbers
set nu
9) Replace all occurrences of the word is with IS from the first
line to the end of file
sed 1,$ s/is/IS/g fex1
10) Replace all occurrences of the word for with FOR from the
following lines of the paragraph you have already typed
sed 1,10 s/for/FOR/g fex1
Part III
sed editor
Create a file with five records with the name fsed1 and do the
following using sed command:
[user43@linserver user43]$ cat fsed1
This is file fsed1
this is cat command.
hello.
hi.
tybsc.
1) Display first three lines
[user43@linserver user43]$ sed -n '1,3p' fsed1
This is file fsed1
60
Kirti College
T.Y.B.Sc.
Linux
61
Kirti College
T.Y.B.Sc.
Linux
Practical No 10
1) Link to the file :ln
A) Create two files with some contents with name ln1.
[user43@linserver user43]$ vi ln1
[user43@linserver user43]$ cat ln1
This is file ln1
Practical no 10
B) Copy ln1 to ln2.
[user43@linserver user43]$ cp ln1 ln2
[user43@linserver user43]$ cat ln2
This is file ln1
Practical no 10
C) Create a hard link to as hardln1 and a soft link as softln1
to ln1
[user43@linserver user43]$ ln ln1 Hardln1
[user43@linserver user43]$ ln -s ln1 Softln1
[user43@linserver user43]$ ls
+1
emp
fspab
newsedclear pract8.1
Softln1
10000
empdata244 fspac
pract
pract8.11.2 ss1
ashwini
fact
gre1
pract7.1
pract8.12.3 ss2
bdata244
fcmp1
gre2
pract7.10
pract8.14
ss3
check
fcmp1_244 green
pract7.11
pract8.3
Stud244
checkgrade
fcmp2
Hardln1
pract7.12
pract8.5
Student
date1
fod1
merit289
pract7.4
prime.out
xab
dir1
foreg
month
pract7.5
product_244 xac
dir2
fsed1
names
pract7.6
result
yellow
dir3
fsp244
newBC
pract7.7
result1
doll
fspaa
newsed
pract7.9
Shweta244
D) Construct the command to find the file permissions and inode
numbers of the above three files.
[user43@linserver user43]$ ls -i Hardln1 Softln1
1137795 Hardln1 1137795 Softln1
E) Remove file ln1.
[user43@linserver user43]$ rm ln1
F)Type the contents of hardln1 and softln1.
[user43@linserver user43]$ cat Hardln1
This is file ln1
Practical no 10
[user43@linserver user43]$ cat Softln1
This is file ln1
62
Kirti College
T.Y.B.Sc.
Linux
63
Kirti College
T.Y.B.Sc.
Linux
CMD
init
[keventd]
in.telnetd:
[login]
in.telnetd:
[login]
3 13:07 tryowner
3 13:07 tryowner
64
Kirti College
T.Y.B.Sc.
Linux
users on the
user20
user32
user21
user33
user22
user34
user23
user35
user24
user36
user25
user37
user26
user38
user27
user39
user28
user4
user29
user40
user3
user30
user31
user41
user42
user43
65
Kirti College
T.Y.B.Sc.
Linux
66