You are on page 1of 68

3

Lv
3.1 LR
Lv v (Linus Torualds), HF
CA F ,
F MFO FE (Project)
J. F, CK
v. (Prof.Andrew S. Tannenbaum) A,
QR IQv (Minix)
F . IQ H,
QR F F L
. Qv , (Ken Thompson)
O C . IQv ,
dCJ F I Qv F
Lv v bQ.
QR (IQR
) C Lv (Linux) K.
1991 F 0.11- OJ. Lv,
N MQA.
O G F L
F. Qv O C
. F I G
LR O F
. J, Lv, H M Q
. ,
F GJ A. P
J (entire code) H PH
, EJ G
F. Lv P A
A. , M P L
F H P F .
Lv, I O F,
4 H G .
F G
132
A M F.
, LR GF (Stability) (Speed)
FM.
F GO O
H Lv , C
M. A. H
Lv, Q C (ANSI)
Cv(POSIX- Portable Operating System Interface for Com-
puter Environments) .
P, J dC Lv -
.
LR Of F
. G F (Stable version) K
(beta) F. n.x.y FE, n,
F PA. x,
H G F, K
F. , 2.2.25 F x=2 .
G F.
LR C ;
A EP L
H E
N. G N
L A A. F
Lv A. O F
I. c HA,
OI Lv P I (latest)
.
3.2 LR O
(Logging in / Logging out of Linux)
Lv F E
FA. F (user terminal)
E. L c Lv
F . Lv C
H, (prompt) . (
133
P F). -
O (login name) O .
K (username) . A
(Login) J.
A, !
i , J
A. J FI
. i
? i
O. GI
. c i Q K
K C Pf
. i J K
Pf A
A F. c
Pf L Q,
, F . L
Q, Pf F
. c K
. F.
LR GA. Lv
, FJ (Login prompt)
O (Login name) O
i. K O. ,
F (Password prompt) .
K O. C
. , Lv , c
FJ .
O M H .
M M Q, M
e . J, M
, W F .
[ilamathi@localhost ilamathi]$

F F , F
. CP (lowercase) K (upper case)
134
O I . Lv
(case sensitive). FJ
(directories) (files)
. , K K
J.
J , K (Home
Directory) GA (System Administrator - SA)
A. v P H d.
O (Logout Process)

M
O , b M
M. , Lv M O
(logout) . PJ (Command
Prompt) exit logout O, O Lv
. , , H
P FJ .
(Changing the password)
PM
A .
H, I M K. Lv
, C b C N
A. P FA. passwd

P . F
P HP G W
. EPJ .
:
[ilamathi@localhost ilamathi]$ passwd
Changing password for ilamathi (current ) password:
( OA)
New password: ( F OA)
Retype new password:
( F e OA)
135
passwd: all authentication tokens updated successfully
[ilamathi@localhost ilamathi]$ _

passwd . K
F K C .
b H O EJ N
. F P
b M FA. -
F L A.
:
[ilamathi@localhost ilamathi]$ passwd
Changing password for ilamathi
( current ) password:
( OA)
New passwd:( F OA)
Retype new password: ( H A)
Sorry, passwords do not match
New password:

(c M
) k , H, c F
AM. , c K
Al A M.
, F
. A F M
Q, M.
bQ . c
F .
, P F
.
MF C:
c
.
, F
136
LL
.
K KL
.
F
.
HK ?
GA F e
. , Lv J
K P.
3.3 Lv (The Linux File System)
M MAl
? Q EPJ I
d? H I . ,
?
O .
P A. ,
(entity)
J E
. O F .
. I
M C HK .
, K A -
. K F O
, .
OJ O F
O . O
. (Directory) A.
F OJ
. , P ,
, H. Q H I
. P, P
OJ . K
.
O P
137
. J, OJ
F . F
, P HL
HK. , O H FOL
F O G Q K
. O F F
. G J
I . P
H, PH H P O .
Q, (root direc-
tory) F W IA.
H A.
W G ( ) .
F CJ . FL A F
. AO C C A AF. FJ
. A.
A, (directoreis) - (sub-
directories) A. F
(root directory) c AFd.

3.1 Lv
138
(root) , bin, boot, home, usr, etc, lib, dev, tmp
HKA. (home direc-
tory) /home PA. / (root)
F A.
, F .
A.
H .
H K
. H W MF
H.
H -
1 . , W (underscore), , O,
O .
2 . 256 .
3 . , .
4. O .
(CPH GO, O
F,
. O
O (dot file) A. O
A ).
5 . (Slash), MP, FP
.
6. .
H Q (Primary name) ,
G (Secondary Name) . O
Q . O H
G c (extension) A.
c A. ,
C c (C )
. C-NJ G P
A.
139
c
.
F
A. IP
, J
F .
, cprogramming H ,
/home/kumaran/cprogramming

.
3.4 O
Lv J .
1. GA
(System Administrator or the Root user)
J GA
(v) A. v, O /home
A. O
J KA. EPJ A
C- .
EP L
M A. LR ,
(root user) e (super user)
A. P (prompt), # . H
$ .
2. K (File Owner)
H H K
A. H K,
H , N, F
. chmod H
F P, (execute)
. chmod P H d.
3. K (Group Owner)
PH FEJ EP
140
M F F A
. K /home F
A. M H
A A. M
(group users) A.
, O
A.
4. H (Other users)
J EA, FE M H
M
H PA. P
H M H
H .
3.5 (Directory Commands)
O
P , P
C (Concepts) c P
. J :
[] []
(Command [option] [argument]
(option), (argument)
A I. C
. C
. C
. , ls , ,
. ,
, . [ls
list . , ls F, E
P K F list .
H F (error message )
K A. ls M
F (typing) IA. J
G A ].
141
:

ls
ls -l
ls .C

ls -l file1

P H MK A.
.
F .
C A. L
(spelling), O (case)
.
J (option) N (dash) P
. .
PH.
F (case) I A. N P
O (Blank space)
. N P, HL
F (option) A.
O FK F .
G M e
A. , -a ls J (ls
-a) , F
O M . ,
-a A [$mark - ge 81 -a $mark -le 100]
J (logical and) A.
, , H e
A H .
(alphabet) . O (dot
files) C O
OJ (.) .
3.1 - bin personal
F, P (path name) ,
142
, Q . bin
O /bin /usr/bin .
A. ,
personal O /home/kumaran/personal
/home/ilamathi/personal . /home personal
F, H
.
(tree structure) M
A.
F I ,
.
PH H P F H.
LR J PH, J
(Forward slash) HK
. P, J F
Q PA.
A. ,
, PH A.
H A,
J O
, . H A.
. :
1. G (Absolute Path name)
2. G (Relative Path name)
,
F , G
A.
G c EK
F . c E ,
H PA.
3.1- H, c E
K kumaran Q, job H G
/personal/job . H G
/home/kumaran/personal/job .
143
c EK
Pi? C O,
H, c F EKAl
K . GO pwd (print
working directory or path of working directory or present working directory)
. F , J (logged on),
$ PJ pwd A
:
[ilamathi@localhost ilamathi] $ pwd
/home/ilamathi
[ilamathi@localhost ilamathi] $

FJ . /home/ilamathi K
J F . , FJ
F (home directory) G .
PH ,
K, J M .
(Changing Current Directory)
cd (change directory) , FL,
PH . ,
F FL,
/usr/bin MA. L,
P,
P, H /usr/bin . P
J W :
[ilamathi@localhost ilamathi] $ pwd
/home/ilamathi
[ilamathi@localhost ilamathi] $ cd /usr/bin
[ilamathi@localhost bin ] $ pwd
/usr/bin

, F (parent
directory) MA Q, $ PJ, cd..
.
144
P: O (..) F
PA. O (.)
PA. cd .. AA
O (space) . O
O .
:
[ilamathi@localhost bin] $ cd ..
[ilamathi@localhost /usr] $ pwd

/usr
[ilamathi@localhost /usr] $ cd ..
[ilamathi@localhost /] $ pwd
, J , /usr/bin
F .
MA. cd
. ,
.
:
[kumaran@localhost bin] $ cd
[kumaran@localhost kumaran] $ pwd
/home/kumaran

P: cd
,
.
/usr/bin F A.
personal bQA. M
GP I O N, /personal
O (~) P .
[kumaran@localhost bin] $ ~/personal
[kumaran@localhost personal] $ pwd

/home/kumaran/personal
145
[kumaran@localhost personal] $ cd ~
[kumaran@localhost kumaran] $ pwd
/home/kumaran
P:O P,
.
personal F A,
health MA F
. cd.. , /health E
GP . $ PJ W
.
[kumaran@localhost personal] $ cd .. /health
[kumaran@localhost health] $ pwd
/home/kumaran/health
F W
F - (Sub - Directory)
A.
(Creating a Directory)
, health F W
insurance MA
. health F . mkdir
(make directory) . mkdir
PHA K
F , F W .
F
. F
MH, cd F .
[kumaran@localhost health] $ mkdir insurance

health F W insurance
F . F
mkdir J PH
.

146
c (Removing a Directory)
NJA Q,
c NJ. K
A A? , c G K! rmdir
(remove directory) .
:
[kumaran@localhost health] $ rmdir insurance

c c MAl Q,
,
1. L (empty) .
2. (current directory) .
, insurance F I
M. L . ,
health-, insurance . , insurance
N A.
I , L
c MH L rm
. P MM .
mkdir J , rmdir J
PH.
F L
F -
O L MAl. M
G ls FA.
, , /home/kumaran
F -O
P MA .
:
[ Kumaran@localhost kumaran]$ ls /home/kumaran
health cprogramming c++programming personal.
[kumaran@localhost kumaran] $ ls - F
health/ cprogramming c++ programming personal/
147
J -F ,
ls
- H / P
.
ls
P:
A. , /home
F . ( / P -
O FJ ).
P P MH
ls G.
P M Q ls -
-l . -l ,
L. , ls , -a -
, -
- L. -a -l -
F NO :
-al, -la, -a -l, -l -a

ls
W J :

-a
L.
-F H
( HL HK,
P
H / P .
-R EK -
O L.
-r -O
W KJ .
-s H M (size)
K.
-A . .. M,
O .
148
3.6 H
F
clear F M. tput clear
E G.
tput cup 20 20
, (cursor) A (row) 20,
(column) 20 - G. C-N GF
gotoxy(20,20) .

M
P, ls
P M P MH man (manual)
. man , H
. (
E AF Man Friday
).
:
$ man ls

man JI
c F M G
(level of help) PH
. GK ,
man , M M
M . Q, GGJ (online) M
A.
echo
echo , C-N GF
\n A
printf()
. F FJ MH,
echo .
:
$echo Please enter your name

, Please enter your name A F F


J . KJ, (cursor) F.
149
KJ F G, echo
, -n .
$echo -n Please enter your name

P (double quotes - )
O A. (improve read ability). ,
.
$echo -n Please enter your name

Lv J (logging on) ,
Lv . logout exit
, Lv ML O.
K P .

(Hierarchial File System) Lv A.
LR (Ordinary Files),
(Directory Files), C (Special Files)
.
:
v (Root user )
v K (File Owner)
v K (Group Owner)
v H (Other users)
J :

Command Option Argument
C :
v pwd - EK
v man - M P
v mkfs - A
v cd - EK FL
v mkdir - F
150
v rmdir L c
v ls -l F
v echo F FJ

JC M
I. OJ G
1. _________ A .
2. IQv A _________.
3. (v) K _________
F .
4. _________ ,
_________ J .
5. ()
_________ ,
P.
6 . Lv _________ .
7. P _________ .
8. P _________
A.
9. cd .. _________

10. _________ P, J
AA.
II. K PH
1. IQ A.
2. K C L
F.
3. Lv O M 4 H G
.
4. FE x Q F
n.x.y
G (stable) F.
151
5. , F .
6. exit A
logout
F O .
7. .
8. O, LR
A.
9. MFM P, $
P A.
10. GA (System Administrator) e (Super
user) .

11. FL , change
directory .

III. M
1. e (Super user) ?
2. O P
d?
3. P H
MF ?
4. c EK
P i?
5. K K ?
6. H P?
7. M J
KF i?
8. rmdir F , c
G ?
9. A H GAJ
M i?

152
10. F i?
11. , , - A
Li?
12 . man J ?
3.7
H
cat H O.
more G . cat ,
PH H FJ .
K Q, FJ G. M
c C . GO
more . , F
.
, f (forward) b (backward) M
. Q, cat, more A (filters)
. N
A.
tee . cat J E
E . tee T
. .
F A . F
. T (A F A) N c
F F c A
. tee kFL
(Standard input) k , M FJ
(cat ). M, tee
PH H I. , tee
F A.
LR C
O (stream) . LR, -
(byte-stream file)
. k ,
k (standard input) , Of .
153
Of (standard output) . k
, C F
(data stream) A.
k A. k
M (keyboard) .
Of C F
. , Of
P . k
A FF . EJ,
Of , A
I FF .
K
Al. Q, P [ilamathi@localhost ilamathi]$
F $ P KJ
.
file1 H FJ
MAl. W M
. file1- ,
It is a fun.
You are encouraged to work with the Linux

.
$cat file1

J Of,
It is a fun.
You are encouraged to work with the Linux.

A.
- FJ,
file1
J MAl Q,
:
$ more file1

Of,

154
It is a Fun
You are encouraged to work with the Linux.

, cat more
M. , file1-
F H, cat J C
d. more J GF
.
FF (redirection), (piping) P
H cat, more, tee A G
.
c I Q, iO
O FA c O
MA. ,
. c K F P
H, FA c , A,
K A FFHMA. Lv
, Of k F M
FF . (L
, k, Of, F,
M F A).
F F P (>) - MK Pf - Of
FF E A. F F P
(<) - MCPPf - k FF E
A. Of FF P, P
H H ( >
H ) , ( >
H ) FFH MA.
$cat file1

file1- FJ A
. Of file2 (F
F) MAl Q W
:
$cat file1 > file2
$cat file2
155
, file2 - FJ .
, file1- .
J Of Of A. F
F , Of F
FHMA. $cat file1 > file2 J, cat file1
F, Of Of F
H A. , FF P (>)
F Of GF, O
f file2- H A . ( F F A ) . f i l e 2
Q, F . file1-
, file2- . file2
? F M N, file1-
M F .
J E M F
HE M . J cat file1 F >
P L A. file2 F L
. file2 Q F M
N. file1 H ,
Of H . Of file 2-
k A. L, file1- file2-
A. MFL, W
c P:
$cat file1 > file1

F, F
L . file1
NM. Q, F .
file1 H .
.
FF ,
H N F
noclobber F F
. , H (overwriting)
A. M N .
H M H
156
P (>>) . H P,
(append)
H ,
H, MO W M.
,
$cat file1 >> file2

file1- , file2 -
F W M.
k (The Standard Input)
Lv , k N
A. k
. Q (by
default) k, M .
M F ,
k , H H
, .
M M,
cat
kL, k . cat K
MJ O.
k N cat .
:
$cat

, (cursor) K
F.
This command expects data from the standard input
(M k)
This command expects data from the standard input (Of)
Now you have to enter the data from the keyboard
(M k)
Now you have to enter the data from the knewboard (Of)
Ctrl+D
$
157
cat H, MJL K
k Al. K , F
FL (buffer) k A.
A cat k A. F
F P F cat
FJ A. K, cat
, k N F
. , K, M
k . K, J F.
E H, c E M
EP . C KJ Ctrl+D
, FMA.
P : (data) A
G c H. c
,
J A A. , c I
, ,
G, Y J c H
A. H.
k F A
, k Y J H
A. LR Ctrl+D Pf,
P (end-of-file character) .
cat Of FF P (>)
.
:
$ cat > file3
The typed in material will be redirected
to the cat command through the std input (M
and this message is sent to the file after > k)
symbol.
Ctrl+D

158
$ cat file3
The typed in material will be redirected
to the cat command through the std input
and this message is sent to the file after >
symbol. $

k FF P (<)
(Input Redirection Operator)

, M N
k HA. k,
OL F .
k FF P (<) FA. cat
, file3 HL (MJL )
W .
$cat < file 3
The typed in material will be redirected
to the cat command through the std input
and this message is sent to the file after >
symbol.
Of FF P (>)
, F F A. k FF
P (<) file3- k H
A. cat k , file3-
FJ A. file3- ,
k FFH file4- , O
f FF Q, W
:
$cat < file3 > file4

(Pipes)
J Of
k Q FF P . F
F P Oe .
GO (Pipe) A.

c O K .
159
. AA I
k. JL L
, L b E
Fk. JL
L, (Conveyor Belt) , K
HA. , L K
I, A.
A. , ,
EKI E (
) HA. LR
(Piping Operation) . ,
JL N H
A.
L H, K A
H A. , E FL,
A L , K
A. FF .
M AA . F
H H
b F. H O
.
I
I ( AA ).
, F A
G ( E ). HQ
I ; HL e
. HL
, H I ;
. FF,
Of HQ A. , O
f A.
H C MAl. cat
H
Of A Pi. ,
cat J Of lpr (line print)
160
N . lpr , O
f k P A. ,
KP
A. E FF P
i. O M .

JL ,
k A. Pf,
| . E :
$cat file3 | lpr

file3-
, Lv J
K P (line printer) HA
.
M N F M H
Pi.
cat E .
Of FJ F, K P
H i? ! M H
M! cat lpr
M GP ? J
| P
GM . A
M? , K! M:
$cat | lpr
The printer should be made ready.
Interesting things are going to be printed.
Ctrl+D

F (Ctrl+D M) P
J C.
H ( file3 ) M KK K
C . W
E G:
$ cat -n file3 | lpr

161
cat - n , file3 - ,
K K , Of
A. cat file3- , KE Q
P H cat -n L
A. , more- F
Al. K H FJ cat
F, c C
FJ Pi. C
M, more W
:
$cat file3 | more

K FJ
file3-
A. W
P:
$cat -n file3 | more

J PH
.
$cat -n file1 file2 file3 | more

P: A O
. O/O
HK .
sort . PH
H K KJ KF, K
F M Of H
. KF Of more, cat -n, lpr P
H.
:
$ sort file3 | more
$ sort file3 | cat -n | more
$ sort file3 | cat -n | lpr

P P.
tee
E A.
162
tee Of H F
A. Of F H
(argument) A. O
f A, tee
HKA. F , tee
FHM. F
H. W , file5-
file6- F , FJ A.

$ cat file5 | tee file6


H K
H F , FJ .
:
$ sort file5 | tee sfile5
sfile5- file5-
K FA
J. K FJ .
sort J, file5- J
F. F K
A. file5 - ,
Chandran
Ashok
Malar
K .
sort, cat, tee, lpr A W
:
:
$sort file5 | tee sfile5 | lpr
Of:
Ashok
Chandran
Malar
FJ , sfile5 H
F . , MF C
A.
163
$ sort file5 | cat -n | tee sfile5 | lpr

Of:
1. Ashok
2. Chandran
3. Malar

M FJ , sfile5 H
F. , C A.
tee cat -n A P
. Of .
(Copying Files)
J, H
H
. c ,
F F, cp (copy)
J E .

$ cp [] <()> < / >
P M
. . M
M. P (< >) /
. ,
, / P
/ .
, c file1- file6 -
MAl. :
$cp file1 file6
file1 (, A
A). file6 (,
F A). file1-
J F. file6
Q F N file1-
F . cp L
164
H A H, file1 H
F . H
N K F
. E ,
H M (
H) K
F . cp J -i
, H, F
(, N K F
) K F .
, c E GFM.
:
$cp -i file1 file2
overwrite file2? n$

F Q,
PH. file1, file2 A
(link) Q, -i F -l
.
cp J -r F
- ,
(recursively) J .
:
cp -r alpha alpha1

, alpha F
- (P
) alpha1 F J .
F M
A F. alpha1 Q,
alpha- M F I. alpha1
Q, F ,
- F . alpha1
F . (recur-
sion) P J.

EF L (factorial) K
165
?
0! = 1
n! = n * (n-1)!
factorial(1) = 1 * factorial (0) = 1

factorial (2) = 2* factorial (1) = 2


factorial(n) P Q factorial(n-1) F
P. n- . ,
,
cp -S -V
. -S , Pf H (Symbolic Link)
A. -V ( verbose P)
A MK.
c
N rm
A. rmdir M FI.
:
$rm file1 file2

, F file1, file2 A
cAM. () F Q,
J . , rmdir
P Pk. N L
Q rmdir Q. GO
N, rm -r -R (recursion
P) .
:
$rm -r alpha1

, alpha1 -
cAM. -i -V
O . -f A
. c .

166
Fh P
O O F GM
Q P , Lv *, ?, [ ]
( L O ) A C Pf A
. ch .c
L MH * C Pf
.
:
$ ls
main.c fact.c swap.c char1 char2.ex doc1 doc2

$ ls ch*
char1 char2.ex
$ ls *.c
main.c fact.c swap.c

* C Pf, e
Fh A.
$rm
*
I .
PM. MP (?), K
M Fh A.
$ls char?
char1

P: MP, GJ
MA. char? H 5
c PA.
- char . C
.
.
char2.ex
. c
5 F .
P [ ], H K A
F PH A. doc A 1
167
2 H L MAl.
W :
$ ls doc[12]
doc1 doc2

() 1 2. 12
. iC (range)
PH .
:
doc[1-5] doc[a-g]

doc1, doc2, doc3, doc4, doc5 A O


. , doca, docb,
docd, docd, doce, docf, docg A .

F
H Enter M
, KJ F .
P ( Crrl+B), P ( Ctrl +F) A M
F . Back Space (
Ctrl+H) Delete M F
N. Ctrl+U K N. KJ
.
O (;) HK .
KO F .
KJ FJ H (\)
.

mv (move) E A.
1 . FL
.
2. F .
P: H KFL
FL
. L F
F.
168
:
mv [] < > < >
:
$mv temp temporary
temp F temporary
P . mv , H P
.
:
$mv file1 /home/ilamathi/personal/file1

O, -i, -v, -f A
F .
EPJ F,
$ P date EP
J F A J
.
:
$ date
Wed July 07:11:41:12 ET 2004

F, A FJ OJ
.
P .
P + P .
FJ , , F E, GI,
M P . W:

%d F (F)
%m (F)
%y (C )
%D F mm/dd/yy M
%H E (00 23 )
169
%M GI (00 59 )
%S M (00 59 )
%T HH:MM:SS M
%a (Sun
Sat )
%h (jan
dec )

%r AM/PM PF
Date J
P: %m, %M AP I
. %m,
. %M, GI . ,
%h %H P . %h
. %H, E P. date
J %D F
Al.
:
$ date +%m
7
$ date +%D
07/07/04
$ date +%T
11:43:14
P: O M,
GA, date J F
.
3.8 : mount umount
Lv J
F ; G, A
, I O
F . PH I
F Lv (File
System) . Lv
, I O
170
. M, KL
G
. F , G HKM (Parti-
tion) J F F, ,
A JL
.
Lv A A
K . , -
FL HK A- (sub-tree) .
O A- H. O
J Q, O M
(Directorate of School Education) .
O M C
O C
A. , A -
(root-directory) F
A. P J
Q, FL .
, A- .
J AJ
. I
. N
P . G HK
M mount
G .
A.
I F
G
, (mounting the device)
A. mount GA. H
F P F
. F A Q,
(root user)
. , P, EP
J (Integrity) A.
KJ P $ L # P
171
Fd. , mount # PJ
GM .
, mount (arguments)
. , A I
PA. N Lv,
A. , H,
F
PA. I F ,
F destination F
MAl. device A C , E
P A. mount
J (syntax) :
# mount device destination

/dev O .
. K
, K FJ P. , fd0
EPJ A
P. ( fd0- M C -, N
(Zero) ). , fd1 , EPJ
A (J)
P. dCO Lv J, G
HKO (harddisk partitions) hd
. , G K, P.
F, G HK
P K . , hda2 ,
Q HK P. a
G, 2
HK P GA.
Q
L . A, mount
O A. W
, A F (fd0) A,
/destination F A.

# mount /dev/fd0 /destination


172
EPJ G
cAM
G ,
PM (unmount) . P,

M. A AF F,
Fk. ,
A M A M
Al. L c A,
JL PM (unmount) . H A
F A cAM F A
. umount
PM. ( . u-
m- J n ) umount , F

. :
# umount device ( destination)
W , /destination F
A PM.
# umount /dev/fd0
# umount /destination
umountJ A G MF .
c EP
PM . AJ QJ
F ?
A ,
c MH L
O . , A
MH, L F
J (mount) . , /dev/fd0
A P. c MH
F F . Lv
, A /mnt/floppy
F A .
173
( mnt mount PA). W
A J FM.
#mount /dev/fd0 /mnt /floppy

A EP .
A (unmount) , A
F P, H F
A. A MH, dev/fd0-
PH, F A W O
G .
#umount /dev/fd0


# umount /mnt/floppy

H
# mount /mnt/floppy
P: mkfs (make formattings) A
.
C- (Mounting CD-Roms)
C- MH,
PH F. Lv J, C-
/mnt/cdrom
. W C- :
# mount /mnt/cdrom
C- MH,
C- PM, F C-
. :
# umount /mnt/cdrom
( C- P )
# mount /mnt/cdrom
F C- M
H, mount J
. W C- F
174
. ,
/destination
C-K /dev/hdc .
# mount /dev/hdc /destination

:
C :
cat - O .
more - PH H
GF H. f b M
F, A, H
A .
tee - H FJ .
J H
.
| (pipe) - J Of
k H.
> (output redirection) - FF.
< (input redirection) - H
FF.
cp - .
rm - c.
mv -
.
mount - I F

. .
umount - .
fd0 - EPJ
A P.

175
C :
date - EP F,
, .
tput clear - FJ M .
tput cup - PH A, J
G.
man - Lv P M
F .
JC M:
I. O G
1. _________
.
2. PH P M F P
MH, _________ M
.
3. K H _________ ,
GF H.
4. J _________ , H
cp
P K .
5. _________ file2 file1-
$cat file1
file2- J H.
6. FF
H M _________
F .
7. F Pf _________ .
8. (mounting) I
F ,
_________ .
9. G HKM J
F , C- J
_________ .
176
10. _________ E .
11. Lv J
_________ F .
1 2 . Lv A
K _________ .
II. K PH
1. Is , O .
2. mv , H KFL P .
3. tput cup 20 20 , C-N GF
gotoxy(20, 20) .
4. echo -n This is nice , This is nice FJ
, (cursor) K .
5. read myname G C-N G
F gets(myname) .
6. H
cat
GF H.
7. $ cat file1 > file1 file1-
e F.
8. , file1, file2 A
$ cat file1 > file2
.
9. lpr Of k
, F H.
10. mount .
11. , F ,
umount
F .
III. M
1. rm -r, rmdir A ?
2. F FJ
My name is <yourname>
?
177
3. F -
N ?
4. cat A? cat J
F MF.
5. , FF - F .
6. mv, cp F .
7. - file2- K
file1
N M.
8. F
?
3.9 M H (vi Editor)

, N, FF
H (Editors) A. LR
H . C F .
Lv O H
. (ed), M (vi) H .
F K F F.
F. M HJ
F FJ J FF
. , M H
A. QR M H P
F, HH F
F, M H A.
H M P E
F A. :
1) PH.
2) O k .
dC H, E M
J MA HK A.
O M, E
M (Functional Keys), M (Control Keys)
F A. dC H MK
178
M K FA. MO
E FK A.
, Qv, Lv,
J C. Lv J M-
. LR H, -
K M I EJ
H M M .
C Pf, Esc M Enter M - -
. I M , M
H, G OA .
c, OJ Al.
J i / A
l. OJ C
Al. i F
Al. (
) A. , M H, M
A. M HJ
. :
1) (Command mode)
2) k (Input mode)
AQ, MJ M
(Edit Command) M PMA
. k AQ, M
P A.
MJ A ,
PMA. , AQ, x -
M, MJ, delete M
, (cursor) F NM.
, k AQ, x M
F x . Esc M MFM-
. Esc M F, PM.
, AQ H, Esc M d
L . M H F
I M A. AQ
179
EAl A , M M
. d L , AQ
P . d L M, (M
M ) k AQ M
M . ,
Esc M MA.

M HJ ,
F A F, H I
G . E, K
(line-editing) A.
AQ O (: colon) K
. GP
H, Enter M F, F
Mi. c P ,
K A P .
M HJ H , I,
, O:
K H
student
F, K F H
MH,
$ vi student
.
H
FJ .
Q, F, F C O
(~) P . A ,
c AQ d. FJ O P
F, H P
A.
H M O MH, k
P . a, i, o A M
F, P . H, K
F OJP ZZ F. CapsLock Key
, Shift M F Z
180
M ). , H I;
M H M OP Lv F
i.
AQ , H I M
O . , HQ M O
, I . Esc M -
F . H O
(:) F, K . , w
M . KJ ,
H I; c Fi. :w
K
I. H LO (Word Processors) Save
As A.

H .
:
$vi
KP H ,
J F. c F
M F (Buffers) I. M
O . F M FF
. ZZ H I
. A H ZZ I. ZZ
F, :w < > M
I. , F M
, c K I.
A ( K )
. H ,
E. c .
M HM O MAl. :f
, (shell) Fi. , HQ
C F FH .
:q! . HQ
I M HM O .
P M
. E K M
181
MH F. h,j,k,l M
M G.
h =[ ( P)
l = \ ( P)
j =] (W P)
k =] ( P)
h, j, k, l A M MJ AJ,
O . M h,
F, l F . , h M
P , l M P
A. Enter M h- F, Spacebar
M l- F .
J K FJ F
. Enter M K A. KJ
FJ O (Space)
O (dead space) . HQ I
. h l MO M K I
. (cursor) KJ FJ ,
KJ F MH, j M .
KJ F MH k M .
J F . Ctrl +F
M F F
(Forward) . Ctrl+B M ,
HA (Backward) .
K G
M H J K K
. K G (K ) F
PH K . H F M
H, K G F .
GJ MH, :set wm =
< > . < > I
F .
a M F, M H, k
182
. O , I
. i M F k P,
I F. CP
o () M F, I W
K . F KJ F k
F, k .
N (Deletion)
AQ, x M, N.
P, x M MJ Delete M
. x M F F F,
N.
dd , K
NM. x dd
, EJ K N
M.
FL 5 N M
Al. AQ , 5x
. K N MH,
AQ dd . K
N M. 5dd K A
5 K NM.
M (Undo)
U , C F M
M.
K P (Break a Line)
K P Q, k AQ
, Enter M . K
J (K ) M .
(Moving)
J F (C K) MAl.
ndd( M KO E n PA)
K N . , M
v vd Q (cut)
183
. N K F .
Mv vd Q
H . , K
F, F . p M
. K KJ,
K . , Mv vd
Q (Paste) .
(Copying)
K yy .
K A n K MH, nyy
. K
F . F K
M F . K
M FH, p M
F . M G. ,
Mv vd-
J P. nyy J K
NF.
(Searching)
F P
. PH , F
P MH /
? P .
(/), FJ PH E
(pattern) P A. MP (?) F
HA . / M F, FJ
FJ K . KJ F / P .
F. E O
Enter M . / M ,
FL . H F
. A .
MP (?) E . H
A FJ . MP
, F A, H
. HA .
184
(Changing)
K P P A.
cc
L K NM, k
. KJ F M O, Esc M
, dd o ()
. r (replacement) , F
P A. H
, , k .
FH, A
d. R (Replacement) , C
(to overwrite) . , H HO
. , P
c k AQ Al.
F H Esc M F, P
. J, H HO
I A.
, K P , cw
cc
P A. dw
N.
HJ P
W FJ F .
Having computer knowledge is an invaluable asset, it will do a world of
good to young people seeking jobs.
1 Reliability: Linux is a highly reliable system. Linux servers are not shut down
for years together. Normally operating failures are unknown to Linux systems.
It does not mean that you need not be vigilant. Do not forget the computer
adage. If something can go wrong, it will.
2 Backward Compatibility: Linux has excellent support for older hardware. It
can run on different types of processors including the older ones. It can run the
commands of its ealier version successfully.
3. Simple Upgrade and Installation: The installation procedure of most Linux
versions is menu driven and easy.

4. Suitable to any machine: Suitable Linux version can run on any machine
available now. This allows low investment for the hardware. The users, who
have low configuration machines, prefer to use Linux OS compared to other
OSs that require higher configurations.
185
FJ
. 3 ,
. AQ M Esc M F
. 2dd .
K N, F .
K . K 2G
. p (CP ) M . k
i. Enter M .
, K . Esc M F,
. , F
J. , 3 J , r
(CP ) M . 3 N M.
, F. 1
F. c k . e,
1 , 1- 2- .
2 3 .
Q, I want to strees the point that G
FJ FJ MAl. G M
. FJ F i. e
o () M . A KJ, I want to
stress the point O. H
. 2yy . L K F
. e ( O M)
G. p M . , K
that F. Q, Having
L H h . H F W,
G. r M . H N
M. , F. h F
. , F W PJ:
Having computer knowledge is an invaluable asset it will do a world of
good to young people seeking jobs.
1 Simple Upgrade and Installation: The installation procedure of most Linux
versions is menu driven and easy.
2 Reliability: Linux is a highly reliable system. Linux servers are not shut
down for years together. Normally operating failures are unknown to Linux systems.
It does not mean that you need not be vigilant. Do not forget the computer adage. If
186
something can go wrong, it will.
3 Backward Compatibility: Linux has excellent support for older hardware.
It can run on different types of processors including the older ones. It can run the
commands of its ealier version successfully.
4 Suitable to any machine: Suitable Linux version can run on any machine
available now. This allows low investment for the hardware. The users, who have low
configuration machines, prefer to use Linux OS compared to other OSs that require
higher configurations.

3.10 G (Shell Script)

G Lv A
(text file) . M H
H (Text Editor) P
H c . ( F
FJ k). PH Lv O
F KJ
H, GL M c .
KJ K O G
L E , E
. , c F H
O K PM.
GJ CL i. G
O, G . ,
HJP F I
. GL k/ Of
G . P (variable)
.
G
Lv J , c E
F F.
(Login Shell) A. F
Q (default shell) w (Bash) .
w G N F .
M, C G c
. G, Lv
A, C b A.
187
C-NJ M Lv
A. P A F .
G H P . G
F PO .
PJ, sh F
(new shell) . F ,
F -
. G G,
F . O
e (Login
shell) A. M M ,
F. ,
b , NM.
G I .
H , ,
CK . , A F
. K
, G c G
. W :
$ sh <filename>
,
$.<filename>
$ PJ G
MH, PH GH F
(File Access Permission - FAP) P . H
(execute) F . chmod
. edufile G $ PJ
MAl.
$ chmod u+x edufile
$ edufile

.
chmod +x ,
(execute) F . u+x ,
H K F A.
188
G A, F
A F G .
3.11 P (Variables)

P F F G
H. Lv P
. P E
G . , expr
let P .
P (Creating Variables)
PH, w O
Q . c MH
P J w F
E. P,
P A. M
, F P
A . F P
. FH J FH
P MM .
GL PO -
K , W (underscore),
.
M P (!), P (&), O A
.
, .
F c .
, PO .
G PO :
file1, bookshell, book_shell, a+b, rs-paise

:
a + b, a+ b, a!b, ab&, a=b
189
P :
<variable_name> = <value>

P: P PM, FH
P (=) O
. , C-N GF FH
. = PJ O
M, , C-N GF == (G)
P .
F (P F), F
O P (delimiters) J,
FH P
. , P
P
P. L
. H k.
:
name=Ezhil Kumaran
.
name=Ezhil Kumaran

F F O Q P
I.
:
name=Ilamathi
name=Ilamathi
name=Ilamathi
.
W FH :
number=12

FHL number PJ F
F, F .
(character string) . number PJ 1, 2 A
. 12 ( M 1100)
190
M. number PJ e
EF , , , N,
, A G .
P (Referencing Variables)
PJ F $ P
. $ P, PJ F .
:
var1=${var2},
var1, var2 A G H P G
A. ${var2} , HF F
A. FH , var1 PJ
A. P I. , PJ
F F MH
P . , father PJ John
F , son F
son1 PJ Q, W
:
$ son1=${father}son ( $ P, P)
son1 PJ Johnson F .
P M ? M O
. P :
$ son1=$fatherson
$, P, $, P P .
father, son A A O
, fatherson PJ
. P , H
F A. P M Q,
F M K FIP son1-
M. M, M AM. (father, son
O M, P EM).

191
F PJ (Reading a value into a variable)
KI Q,
Please enter your name

FJ . ,
k . GF F
. E G LR
:
echo Please enter your name
read name
echo FJ . F,
k . read
, name PK F, O
F. , O Enter M
F, name PJ . ,
GL H . read
P (shell prompt) J
. , read GO
A.
J F
P: echo
P O F .
3.12 (Expressions)
expr let
, , C
W, E FM .
Ed G
? M G .
P F. P
A.
F G , P E J N
J . M . expr
let F. expr , W
O M E A. J
Of Of (F) A.
192
:
$ expr 21 + 51

72 M FJ . + P
J O (Space) Q
. expr J P .
$num1=7
$num2=3
$expr $num1 + $num2

Of F , FJ 10
. $ P P (prompt)
, PJ F A
. $num1 F 7 , $num2
F 3 . , expr
. H P
P.
expr +, -, *, / A W . , *
P I
. Q, * P, Fh Pf A.
, A , F .
\* F, P .
$ expr 1 / 2

0 M. 0.5 M . /
P H O Q.
$expr 0.5 / 2

, A? H
F M A. Q, F O (decimal point),
O (dot) . 0.5
.
let , O M, F
H A. :
$ let < F1 > < P > < F2 >
P W P (arithmatic
193
operator) .
d P (relational opera-
tor) . let
expr M . let
P FH, F
P PM. F, GL
O F A. expr
J P H O (space) .
let J P ,
O/O . O/
O M MH M. E
P . let J
PH H M PJ M Q,
M FJ .
:
$ let pr = 5*10
$ echo The product is $pr
The product is 50

P:1) P \* PH
F. 2) let J E J FH
P (=) P
J . expr J
J.
PJ H O/O M
MH, W P
.
:
$ let pr = 5 * 10
$ echo The product is $pr
The product is 50

M PJ F M FJ
. M FJ Q echo
.

194
:
$ let sum = 2 + 4
$ echo The sum is $sum
The sum is 6
GF let F W
F F.
let a = 0
let a = a+1

P:2.3, 0.5 F let


K.
P P
L P. Q,
. name PJ IIamathi
.
echo The given name is $name
echo The given name is $name

Al. P M
:
The given name is IIamathi
The given name is $name

P $ P PJ F
A. F IIamathi
FLA. P, O
F OJM. , $name
. PJ F
.
3.13 Fh (Command Substitute)
FJ M EPJ F
MAl. $date
. ($ P, PJL FH .
F ). JL
195
M Q H
P (L P ` )
. FJ F , date
H P (L P)
. P, MJ 1 ( ! ) M
. O P (~ tilde), H
P ( `backward quote) MJ W .
F .
:
$ echo Todays date is `date +% D`

F FJ , `date + % D` P
F EPJ F . date +
P O Q.
. (+%D Pf mm/dd/yy
M F HK ). , L
J Of FJ . H echo
G. Fh (comma
substitution) , J Of PJ
.
:
cfiles = `Is *.c | wc - l`

, F .c O
E cfiles PJ .
L, expr J Of,
Of . F, Of P
J F J, Fh
. ,
$ var1=5
$ var1=`expr $var1 + 20`

var1 PJ 25 F
.
expr H P
. L F O
196
f G. H, eF .
H G NO if, for, while
G GL (Advanded Shell Script)
.
3.14 LR C
(Reliability)
Lv, I
. Lv (servers) A G
A. Lv
O G G A. c
K F
. EP N M .
H, .
HA F (Backward Compatibility)
EPO Lv .
LO (processors) .
LO . FO Lv
, F FO P A.
O G (Simple Upgrade and Installation)
Lv FO G
(Menu)J, I O.
EP (Suitable to any machine)
F EPJ K Lv
F . F
h F. F EP
F, F F
A, H L K
MA.
T A (GUI Interface)
, T, A
LR . Lv HK
HK. , T Mv 98
197
F A.
Of (Multiple Distributors)
Lv G OJA.
K F .
, Lv M (Buyers
Market) . (Redhat), (Caldera),
(Mandrake), H (Debian), v (Slackware) A
Lv Of C.
G (No Virus Attack)
EP NJ I
G. G J F
A. L G F
A. L G
M.
F (Security Features)
HQ C EJ
N MMA. F
Lv F .
(Internet Service Provid-
ers - ISPs) Lv A.

E (Can Support a High User Load)


LR F E
.
(Development Libraries)
C++, N C
E (platform) Lv A.

198

u (nyy nY), p n K
u LR H F
G .
u W O M E expr
A.
u let expr M .
u vi M H A.
u M H AQ . k
.
AQ A P Esc M
.
u M, K A
A PF.
u ,
Fh (Command Substiution) A.
JC M
OJ G
1. K _________ F,
$vi filename.
H I.
2. :w , H _________, _________ .
3. Esc M , d L , c
_________ AQ k .
4. _________ PH F
ndd
M .
5. _________ E I
F A.
6. GL _________ ,
GFM.

199

You might also like