LINUX
O'REILLY8 , & .
Books Ru - Microsoft Internet FxploieiJfjaa*
|] hi p '/, boa ru/
1 , U J j Lt- 3 _, UJ^
nf-n_LTL , JF.-U-L'U
|/I- 1 T6LIM. I ;
/ . t q biffi^1
basari ^; -
=bL_*ll
Delphi. P, f
Flier
LINUXIN A NUTSHELL
Third Edition
Ellen Siever, Stephen Spainhour,Stephen Figgins & Jessica P. Hekman
O'REILLY'
LINUX
, ,
.
, ,
.
Linux. .
.
. .
.
. ,
.
.
.
., ., .
Linux. . - . . - : -, 2001. - 912 ., .ISBN 5-93286-012-
,
Linux, . - ,
, .
Linux , : , bash, csh tcsh, , Emacs vi, sed gawk, , .
LILO Loadlin, RCS CVS, GNOME KDE fvwm2. - Red Hat - Debian - dpkg. .
ISBN 5-93286-012-ISBN 0-59600-025-1()
-, 2001Authorized translation of the English edition 2000 O'Reilly & Associates Inc. Thistranslation is published and sold by permission of O'Reilly & Associates Inc., the ownerof all rights to publish and sell the same. , -
. -
, , .
-. 193148, -, . , 4,. (812) 324-5353, [email protected]. 000054 25.12.98.
15.10.2001. 70xlOOV,e. .
. 57 . . 3000 . 1848. . . .
,
.
197110, -, ., 15.
9
1. 15 Linux 16 17 Linux 18 18 21 22
2. 27 27 33 TCP/IP 35 41 NFS 43 NIS 45 NIS 46RPC XDR 47
3. Linux 48 49
4. 459 459LILO: Linux 461Loadlin: MS-DOS 473 Linux Windows NT/2000 475, 477initrd: RAM- 479
5. Red Hat Debian 481 Red Hat 482 Debian 494
6. Linux 514 514 515 516 518
7. bash: 519 519 521 523 534 539 541 544 573
8. csh tcsh 575 576 576 577 582 595 599 603 608 csh tcsh 609
9. 633 634 Linux 634 636 638
10. Emacs 641 641 641 644 Emacs 652 Emacs 657
11. vi 664 vi 665 vi 667 668 670 672 677 ,
678 681 682 vi 695
12. sed 699 sed 699 700 sed 701 sed 702 sed 704
13. gawk 713 714 714 716 gawk 718 719 720 awk 721 721
14. CVS RCS 729 729 CVS 732 CVS 733 CVS 754 RCS 782 RCS 783 RCS 783 RCS 784 RCS 789
15. GNOME 803 804 807 809 GNOME 811
16. 830 831 837 KDE 839
17. fvwmZ 857 fvwm2 858 858 859
860 fvwm 861 863
864 864 865 867
869
870 872 877FvwmWinList: 879
882
Linux - - Unix . Linux (Linus Torvalds), -
. -
, -
. Linux , -
(Free Software Foundation, FSF) Berkley Unix (BSD), X Window (XFree86) X Consortium - , Linux.Linux - ,
RAID-, , - . -
GNOME , .
-
Linux. - In a Nutshell O'Reilly, , , ,
, ,
. ,
Linux.
10
, Linux - .
(Bill McCarty), O'Reilly, - Red Hat Linux (Learning Red Hat Linux) Debian GNU/Linux (Learning Debian GNU/Linux), Linux, -. ,
(Matt Welsh), - (Matthias Kalle Dalheimer) (Lar Kaufman) - Linux1 (Running Linux), .
Linux (Linux NetworkingAdministration Guide) (Olaf Kirch) (TerryDawson). O'Reilly Linux Li-nux Unix, X Win-dow, Perl Java.
Linux . Linux(Linux Documentation Project), http://www.Unux-doc.org. , - HOWTO, . GNU, , http://www.gnu.org ( - ). (FSF), - GNU, , , - .
Linux Journal Linux MagazineLinux Journal Linux Magazine - , - Linux. - Linux. - , -
, . Linux Journal - - , S.S.C. Incorporated http://www.ssc.com. Linux Magazine http://www.linuxmagazine.com.
1 ., ., . Linux, -
, 2000.
11
Usenet, Linux Usenet :
..os,linux.announce ,
, , -
Li-nux. Linux . - [email protected].
comp.os.linux.help Linux.
comp.os.linux.admin , Linux.
comp.os.linux.networking Linux.
.os.linux.development , Linux .
comp.os.linux.misc , ,
.
, Linux, , , , (fr.comp.os.linux) (de.comp.os.linux)1.
Linux ,
, .
IRC- OpenProjects , Open Source ( ), Open Hardware ( ). Linux. IRC (In-ternet Relay Chat) , - . -
IRC , -
1 -fido7.ru.lmux. - . .
.
12
. ,
, , .
IRC OpenProjects, 24 - , -
Linux -. IRC, IRC-, irc-II, irc.openprojects.org:6667n Jt l ihpeople 1 .
Linux Linux . -
, , , -
. -
Linux - - , .
, .
:
Groups of Linux Users Everywherehttp://www.ssc.com/glue/groups
LUG list projecthttp://www.nllgg.nl/lugww
LUG registryhttp://www.linux.org/users
,
:
, .
, , .
, -
. -
, -
.
.
ttrusunix t t u n i x . ru irc.msu.ru. - . ..
13
, .
,
.
% $ -
tcsh (%) bash ($). [ ]
( -). , [files]. , - (. . ). - .
EOF ( +).
| , -
.
, -
. :
, ,
, .
.
. -
. , -wra ( ) , w . - .
, -
, , -
( !). , , -
, :
14
O'Reilly & Associates, Inc.101 Morris StreetSebastopol, CA 95472800-998-9938 ( )707-829-0515 (/ )707-829-0104 ()
. -
, :
, :
[email protected] -, ,
. :
http://www.oreilly.com/catalog/linuxnut3
O'Reilly:http://www.oreilly.com
Linux. . (Andy Oram) , (Val Quercia) -
, .
, Linux (RunningLinux) Installation and Getting Started Guide, ; (Michael . Johnson) Red Hat Software, - (Robert J. Chassell), (Phil Hughes) (LaurieLynne Tucker) Linux Journal; (Arnold Robbins), (Julian T.J. Midgley), (Doug Moreen), (Ron Passerini) (Mark Stone).
1
Linux , -
. -
Unix, Linux - . -, -
Unix- Win-dows NT. , Linux ( ), Windows, , .
-
Linux . Linux (http://opensource.org), , Samba GNOME, - , -
, SourceForge (http://sourceforge.net). - , Linux GNU , , ,
,
Linux. , Linux -
.
Linux , -, ,
.
16 !.
Linux , Linux - -: - -. Linux - , ,
.
Linux ( In-tel, ), - - , , -
Linux, . , Linux Unix-. - Unix ( , -, ,
) , , Perl, , -
.
, AT&T Unix , - .
- Linux - , , -
. , ,
(, , - Linux), , , , -
-
.
Linux , - ,
. -
, , (, , ). Li-nux , .
Linux Unix, - .
1
Linux POSIX.l. Linux
1 Unix-, -
/.
17
Unix-, , , Unix Linux. , , - , Unix.
Linux - IBM- , - . , MS-DOS MicrosoftWindows, , , Linux . Linux - .
Linux , -
: , ., -
Samba Linux , - PC-. - Apache Linux - ( ) -, -.
- , Linux,
. -
,
. 50, , , ,
. CD-ROM - Linux .
Linux, .
Usenet ( ),
. -
, Linux , , , .
Linux Intel, -
., PowerPC, Alpha ( Digital Equipment Corporation, Compaq), SPARC, MIPS 64- Intel Itanium.
18 1.
Linux Linux Unix. ! , - GNU, - . GNU GNU's not Unix (GNU - Unix). . Unix, - GNU , -
, , -
.
GNU Linux - , grep, - Linux - Berkeley Software (BSD). , Linux, , , Linux. - Unix, - Linux. , -
Linux, - X Window, XFree86 - Intel. -, -
,
KDE, GNOME fvwm.
O'Reilly & Associ-ates Unix in a Nutshell, , - Linux. , - ( - , -
), KDE GNOME, fvwm, , CVS bash.Linux. Linux. , ,
, .
, , ,
, ,
. -
, .
19
Unix ( 70-),Linux . Linux- - ( -), Linux . , Unix in a Nutshell, .
, Linux , - ,
. , -
VT100 ( xterm), . , -
, .
, -
Linux, - , - .
Unix-, -. O'Reilly, RedHat Linux (Learning Red Hat Linux), Debian GNU/Linux (Le-arning Debian GNU/Linux) Linux (Running Linux). - 2 , -
, -
; 3 Linux. -,
.
, 3, .
( MicrosoftWindows, OS/2 - Unix), Linux . -
, . 4
Intel, LILO (Linux Loader) Loadlin. 5 Red Hat Debian Red Hat (rpm), ,Red Hat SuSE, Debian (dpkg). - -
; - .
. -
- ,
.
. Linux - - bash tcsh, . ( Linux Unix- -
20 1.
, -
.) - . , -
, , -
, ,
.
, -
: , -. , Linux, - vi Emacs. - Unix, : sed gawk (GNU-- awk). O'Reilly , - . , -
. Emacs, , - , ,
+, ( tutorial - ). - CVS (Concurrent Versions System) RCS(Revision Control System) - - -
. RCS CVS - -
, -
, ,
. CVS - RCS . CVS RCS 14CVSnRCS. Linux , , -, , ,
. -
, , -
.
, .
, X Window, ( , Linux ), -, Perl, Tcl/Tk Python, - . -
, -
.
, -
. , ,
, 95% -, .
21
Linux, . Linux ( , - -
). , . -
Linux , , -
'
. -
General Public License, GPL copyleft (- copyright), (FSF)., (Richard Stallman), ,
, . ( Linux: ,
?) - Unix - GNU Emacs, gcc g++ ( C++), - . GNU - GNOME, - , . -
GNOME , - ,
, .
, FSF , , -
, . FSF - Linux- Debian. FSF ,
GPL. - . ,
, - -
, . .
. FSF -. GPL , - , http://www.gnu.org/copy-left/gpl.html. , Linux BSD, GNU. BSD . - BSD GPL,
22 1.
. BSD - -
, GNU.
Linux, -. , ,
.
ftp File Transfer Protocol ( ).login .rlogin .rsh .talk
.
telnet .tftp Trivial File Transfer Protocol (
).uudecode ,
uuencode.uuencode , , -
.
vacation .
.
.
diff .diffS .
cat .chfn ,
finger, . .cksum .chmod .chsh , . .
23
csplit ,dd .file .head .less .In .Is .merge .mkdir . .
mv .
newgrp .pwd . .
.
rmdir .split .tail .we , .
Ipq .1 .Iprm .Ipstat . .
.
as .
bison . .
flex .g++ GNU C++.gcc GNU .Id .4 .make .
24 1.
ranlib .rpcgen RPC . .
cvs .
etags Emacs.gctags vi.gdb GNU.gprof .imake make.make ,
.
.
patch .res .
size .strace .strip .
apropos .egrep grep.fgrep .find .grep .strings .whereis .
echo . .
printf .sleep .test .
25
bzip2 .cpio .gunzip (.gz .Z) ().gzip .shar .tar .zcat .
at .atq ,
at.atrm at.chgrp .chown .crontab .date .df .du .env .
finger .kill .printenv .ps ,stty .who , .
col .cut . , vi.expand .fmt .fold .gawk .ghostscript PostScript PDF.groff troff.
26 1.
ispell .join .paste .rev .
sed .sort .tac .tr () .uniq .vi .xargs .
banner .be .cal .clear .man .
nice .nohup
.
passwd .script .su .
tee .which .
2
-
.
hwclock .netdate (host).rdate .zdump .zic .
apmd .bootpd .fingerd finger.ftpd (FTP).gated .identd , TCP/IP.imapd .inetd -.kerneld , .klogd syslogd.
28 2.
Ipd .mountd ,
NFS.named .nfsd NFS.pop2d POP-.pop3d POP-.powerd .pppd (- -
point-to-point protocol).rdistd .rexecd .rlogind rlogin.routed .rshd .rwhod who.syslogd , , .talkd , talk,tcpd TCP.tftpd .update .ypbind NIS.yppasswdd NIS.ypserv NIS-.
agetty . ARP.cardctl PCMCIA-.cardmgr PCMCIA-.cfdisk ( ).fdisk .getty .kbdrate
.
ramsi/e RAM-.setserial .slattach .
29
arch .dnsdomainname DNS- .domainname NIS- .free .host .hostname .nslookup .uname .
cpio .install .rdist .tar
.
fetchmail .formail .mailq .makemap sendmail.rmail uucp.sendmail .
Unix ( - , -), . , , -
- , -
.
; , -
. Linux - Se-cond Extended Filesystem, ext2fs, , , . (Second Ex-tended Filesystem), Linux, 256 , - - . ( ,
30 2.
.)
MS-DOS, Linux , DOS- , ISO 9660, - -.
debugfsdosfsckdumpe2fse2fsckfdformatfsckfsck.minixfusermke2fsmkfsmkfs.ext2mkfs.minixmklost+foundmkraidmkswapmountraidstartraidstoprdevrootflags
showmountswapdevswapoffswaponsynctune2fsumount
ext2fs. DOS VFAT. .
ext2fs. .
.
MINIX. , .
ext2fs. .
mke2fs. MINIX. lost+found. RAID-. .
.
RAID-. RAID-. .
, .
.
.
.
.
.
ext2fs. .
depmod .insmod .Ismod .
31
modprobe
rmmod
,
.
.
dip dial-up IP-.gdc gated.ifconfig .ipchains ( 2.2).iptables ( 2.4).named IP- ( ).netstat .portmap . RARP.route .routed .rpcinfo RPC.ruptime .rwho , .systat .traceroute .
NISdomainname NIS-.makedbm NIS.ypbind NIS-.ypcat NIS.ypchfn ( finger, -
. .) NIS.ypchsh ( -
) NIS.ypinit NIS.ypmatch NIS.yppasswd NIS.yppasswdd NIS yppasswd.yppoll NIS NIS-.yppush NIS.ypserv NIS-.
32 2.
ypsetypwhichypxfr
Ipctunelp
ypbind . NIS- . NIS .
.
.
badblocks .chroot .
bootpd .bootpgw .bootptest bootpd.halt .init .reboot .runlevel (runlevel) .shutdown .telinit .uptime .
, 3 Li-nux, -. , kill, killall, killallS, pidof, ps who.
fuser , .
psupdate /boot/psupdate.renice .top .
chpasswd .groupadd .
33
groupdel .groupmod .grpck .grpconv .lastlog .newusers .
pwck .pwconv .rusers ( ,
who).rwall .useradd .userdel .usermod .w ,
.
wall .whoami .
.
dmesg , .Idconfig .logger .logrotate .rstat ^.run-parts .
,
. Unix - ,
, ,
, ,
. .
,
, -
. .
, Linux-:
34 2.
named ( IP- -, - ), Ipd ( , , ), ftpd ( ftp). Unix (Internet Protocols, IP). - . -
( ) - ( ). , -
-, TCP/IP (, ). Unix-, Linux. -Unix-, TCP/IP - .
, NFS NIS, ,
sendmail.
/1-ftpd .gated .host .ifconfig .named IP- ( ).netstat .nslookup .ping , .pppd -.rdate .route .routed .slattach
.
telnetd Telnet- .tfptd .
NFS NISdomainname NIS-.makedbm NIS.
TCP/IP 35
portmap DARPA RPC.rpcinfo RPC.ypbind NIS-.ypcat NIS.ypinit NIS.ypmatch NIS.yppasswd NIS.yppasswdd NIS yppasswd.yppoll NIS NIS-.yppush NIS.ypserv NIS-.ypset ypbind .ypwhich NIS- .ypxfr NIS .
TCP/IPTCP/IP - , - .
: (TCP,Transmission Control Protocol) (Internet Protocol). : , -
. (TCP) -, , ,
,
. , TCP/IP :Address Resolution Protocol, ARP ( )
-
( Ethernet ).Internet Control Message Protocol, ICMP ( -)
-
.
Point-to-Point Protocol, PPP ( - ) TCP/IP ( ) - .
Reverse Address Resolution Protocol, RARP ( - )
( ARP).
36 2.
Serial Line Internet Protocol, SLIP ( - )
IP .
Simple Mail Transport Protocol, SMTP ( -.)
, sendmail TCP/IP.
Simple Network Management Protocol, SNMP ( - )
-
TCP/IP.
User Datagramm Protocol, UDP ( ) , TCP.
TCP/IP (Douglas R. Comer) TCP/IP (Internetworking with TCP/IP), Prentice-Hall. O'Reilly & Associates: (Craig Hunt) TCP/IP (TCP/IP NetworkAdministration, Second Edition) (Olaf Kirch), (Terry Dawson) Linux (Linux Net-working Administration Guide). TCP/IP ( ), - (. 2.1).
(Application Layer)Iph ,
'*"
(Host-to-Host Transport Layer)
(Internet Layer)
(Network Access Layer) ,
. 2.1. TCP/IP
TCP/IP 37
IP-
IP- (-) 32- , .
IP-, -. , ,
. -
: , (. 2.2). , .
2 10 0 1 ii
'^ - '^^ . - . --W8
[24
' 12 --.V : V $ "^ ... , .
1 1
^ -. .'
16 16
" 19 '"'. -: 17 ""' ! ,- 1 1 Ib
24 ' 8
. 2.2. IP-
(Classless Inter-Domain Routing, CIDR) - , ( , ) . CIDR ( 8) -, .
, IPv6, IP-, - , .
38 2.
-
(Network Information Center) . - ,
, .
,
RFC 1597. IP- , IANA (Internet AssignedNumbers Authority). IP- Ethernet-, - .
, -
. ,
,
(). . ,
.
:
EGP (Exterior Gateway Protocol) - BGP (Border Gateway Protocol) -
.
RIP (Routing Information Protocol) - ; .
Hello protocolOSPF (Open Shortest Path First) -
.
- gated routed - - . -
, gated , .
, RIP, Hello,BGP, EGP OSPF .routed - , RIP.
. gated routed - 3.
TCP/IP 39
,
. , -
,
. -
netstat.
,
. , IP-. IP- (, ).DNSnBIND (Domain Name System, DNS) - , .
Unix, . . -, . ( -) IP-. DNS BIND (Berkeley Internet Name Domain).DNS -. Resolver- -, . (name server) - , . BIND - named. nslookup. named nslookup 3. -
( ) -.
.
,
,
. , oreilly.com orellly ( O'Reilly &Associates), (). - www.oreilly.com. :
-
edu - gov mil -
40 2.
net - , - ( , -)org - .
TCP/IPifconfig , -
, : , IP- . .
ifconfig. , ,
IP-. , , ARP, - , , -
-.
ifconfig 3.
: - (SLIP) -- (). -
Ethernet. Linux SLIP . - SLIP- slattach ( slattach 3). , SLIP- - ifconfig - . , tanu-ki ruby:
# ifconfig s10 tanuki pointopoint rubyit route add ruby route add default gw ruby
ruby -, - ruby , - ruby .
SLIP. - -, /, -
. Linux , - pppd. pppcl 3.
41
TCP/IP TCP/IP . 3.ifconfig
.
netstat
.
ping, .
nslookup DNS.
traceroute
, .
- - ,
(. . ) . - , , ,
.
,
,
. ,
.
,
IP-, - IP-. - (masquerading). , , -
, . ,
IP-.
, iptables, Linux 2.4. iptables, 2.4 . -
.
O'Reilly Linux (Linux Network Administrator's Guide) (Olaf Kirch) (Terry Dawson), Linux IPTABLES-HOWTO. WTO-, , -
Linux (. ).
42 2.
, Linux 2.2 ipchains, 2.4 - iptables. 2.0 ipfwadm, -, , .
, -
. , -
2.4, . - - , . Linuxnetfilter Hacking HOWTO , . -
, , ,
.
make config 2.2 : Network firewalls TCP/IP networking IP: firewalling -
, :
IP: transparent proxy support :
IP: masquerading IP: ICMP masquerading 2.4 : Network packet filtering ( ipchains) IP tables support ( filtering/masq/NAT) Packet filtering , -
. -
iptables. 2.2 2.0 -
, iptables. , (chains), . 2.4 , , ,
.
, , -
, . -
, ,
. ip-tables ipchains .
NFS 43
-
. - -
. -
, .
- ,
. -
, , , -
, .
,
.
, . -
.
2.2 ipchains. - , ipchains-save , , ipchains-restore - . -
2.4 iptables. ip-tables-save iptables-restore , ipchains-.
, -
, ,
O'Reilly 1 (Building In-ternet Firewalls), (Elizabeth D. Zwicky), - (Simon Cooper) (D. Brent Chapman). - ipchains iptables Linux (Linux Network Administra-tor's Guide) (Olaf Kirch) (Terry Dawson) HOW-TO, Linux IPCHAINSHOW-TO Linux IPTABLES HOW-TO.
NFS (Network File System, NFS) - , -
, .
NFS -: , , -
. NFS - ,
. NFS RPC. TCP/IP.
1 , -, IV . 2001 .
44 2.
NFS NFS NFS, - NFS . NFS /etc/exports; -,
. , NFS, - /etc/hosts.
NFS, nfsd-, - RPC- . NFS mountd . biod - - /. portmap RFC-- /1-.
NFS-, - -. /etc/exports, - . -
mountd - , /etc/exports.
NFS - mount, , , /etc/fstab. mount mountd, - . , -
, umount - .
,
NFS.
mount umount, user /etc/fstab. , -
. -
, /etc/fstab.
NIS 45
NISNetwork Information System (NIS) - , - Sun (Sun Yellow Pages, YP) - . -
,
. -
, (maps). NIS - RPC. - NIS- Linux - yps ypserv.
NIS - (master) (slave).- -
. --
.
NIS - , . /var/yp, , . ,
. NIS domainname.
NIS NIS , . dbm- , - (- ), - - . (-ASCII) dbm- - NIS, -push . /var/yp/YP_MAP_X_LATE NIS, NIS-. , NIS.
NIS :
makedbm dbm-. ypservers ( ) .
46 2.
ypinit NIS. - NIS. - NIS.
yppush -.
NIS NIS NIS- NIS--. , , NIS - ypserv, /-. NIS RPC-- portmap, NIS.
NIS- NIS- :1. NIS domainname.2. ypMakeflle, ,
.
3. ypMakefile /var/yp/Make file.4. make /var/yp, . . -
.
5. ypserv - NIS.
NIS- NIS NIS - domainname ( NIS-) ypbind.
NIS NIS : - . -
-; , NIS. NIS. - , . . ,
. NIS -, -
RPC XDR 47
. NIS .
RPC XDR (Remote Procedure Call, RPC) - , NFS, NIS. , , -
. RPC , XDR(external Data Representation, ).
3
Linux
,
. -
. -
() , - . -
. , -
,
.
. -
.
. -
; Linux . , -
. -
, , .
. -
help, . ( , invalid option - .)
(d). -, (debug). - .
49
agetty [options] port baudrate [term] . Linux- - getty. , , - . init. init-getty-lo-gin-shell, , agetty login . - agetty .
, agetty /dev. -, agetty - . -
baudrate, , agetty. term, agetty ,
TERM.
h , .
i /etc/issue - .
-I program /bin/login.
-m .
t timeout agetty , (open), (login prompt) timeout -.
-L . . -
.
agetty
50 3. Linux
apmd apmd [options] , apmd - , -
BIOS (Advanced Power Management BIOSdriver). - -
, apmd - syslogd -
. apmd , apmd_proxy, .
, check n -
.
. -
-
.
- command, apmd_proxy command
.
. command -, , -
. .
, percentage n -
. 5. > 100 .
V, version .
V, verbose .
-W, wall .
w n, warn n
,
. = 10.
.
51
q, quiet -
.
-?, help apmd .
(apmd_proxy) :
start .
stop .
suspend [system user], -
. -
.
standby [system user],
. -
.
resume [suspend | standby critical], -
.
, .
critical - .
; resume - .
change power .
change battery, BIOS - .
change capability, BIOS - , -
.
apmd
52 3. Linux
apropos apropos string...
-
whatis - . whatis, , , .
man k.
ar ar [-V] key [args] [posname] archive [files] (files) (archi-ve). - , -
(Id). , -
args ( ), posname - (archive). (files) - posname, . - -V .
d (files) (archive).m .
(files) (archive).q . .
t .
.
m posname.
, , posna-me.
(archive) - .
f .i ,
53
1 - ; Linux .
.
s ( strip).
S .
, .
v ; .
mylib.a :
m y l i b . a 'Is * . o '
arch
-
. uname -m.
arch
arp [options] TCP/IP. , - ARP- (//net/arp).
v .
-t type type ARP-. type - ether (Ethernet), 25 ( .25); ether.
a [hosts] hosts , .
d host
host.
arp
54 3. Linux
arp s host hardware-address host hardware-address, ether- , .
-f file .
as as [options] files
(files) . - , , -
.s .. as - .
[ files-]
(files) .-a[dhlns][=file]
-
, .
:
-ad .
-ah -
, .
al .an
.
as
.
=file file.
defsym symbol=value symbol. value .
f .
55
gstabs .
objfile objfile ( - file.).
v .
-Ipath path .include.
-
.
L , L.R .W .
as
at [options] time
(time) - (date). . (. batch.) - EOF. (time) - (, ), . -
(date) , - (today tomorrow). .
.
at -.
/etc/at.allow, ; /etc/at.deny. ,
.
job [job...] .
.
-d job [job...] .
atrm.
at
56 3. Linux
at -f file file, .
1 , - , . -
atq.m ,
, -
.
q letter ,
(letter), letter [a-z] [A-Z]. ( - ). - .
V .
hh:mm [modifiers}
( 24- - ); - ; - ,
h, hh ( ) hhmm ( , ). , : 5, 5:30,0530, 19:45. am 12- . - zulu - (Greenwich Mean Time).
midnight | noon j teatime | now -
, teatime 4 ; now (increment).
month num[, year] (month) ,
; ;
57
at (year) . , , -
, at - .
day , -
.
today | tomorrow , -
. (date) , at - today, , -
(tomorrow).
, ,
.
minute, hour, day, week,month year ( ). next + 1.
, :
at 1945 pm December 9at 7:45pm Dec 9at 3 am Saturdayat now + 5 hoursat noon next day
atq [options] .
,
. -
at -1.
q queue , -
.
-v , , .
V .
atq
58 3. Linux
atrm atrm [options] [job] [job...] . at d.
-q queue .
V .
badblocks badblocks [options] device block-count .
device. - (block-count).
b blocksize blocksize .
- f i l e .
-v .
w - .
banner banner [options] [characters] (characters) - . characters , ban-ner . -
,
.
w width width -. , /. w, - 132. w , -, 80.
/usr/games/banner -w50 Happy Birthday! |lpr
59
basename name [suffix]basename option
. -
suffix, -. .
help -
.
version basename - .
% basename /usr/lib/libm.alibm.a
% basename /usr/lib/libm.a .al ibm
basename
bash [options] [file [arguments]]sh [options] [file [arguments]] Linux, . bash 7 bash: .
bash
batch [options] [time]
, .
, , -
(. . 0,8). -, at, -, . -
. at.
-f file , .
-
-
.
batch
60 3. Linux
batch -q letter ,
(letter), letter- [a-z] [A-Z]. ( - ). - .
V . , -
.
be be [options] [files]
be ( ), . be . -
,
, . -
.
-
. (file) . be - quit EOF.
1, mathlib -
.
s, standard
POSIX.w, warn
-
POSIX -.
q, quiet .
V, version .
61
. -
, -
. -
. -
, . -
.
,
. , -
:
.
x[i] i. i 2047 .
(,) . .
-
ibase, obase, scale last .
.
. A-F - 10-15.ibase =
(, ) - ( = 10).
obase =
( = 10). : ibase obase , .
scale = ,
( - 0, . . -). scale .
last .
be
62 3. Linux
be
. -
.
if (rel-expr) {statements} [else {statements}] (statements), rel-expr . , -
else, . -:
i f (x==y) { 1 = 1 + 1 } else { 1 = 1 - 1 }
while (rel-expr) {statements} (statements), rel-expr . :
while (i>0) {p = p * n ; q = / ; 1 = 1 - 1 }
for (exprl; rel-expr; expr2) {statements} while. , - , , 5, :
for ( 1 = 1 ; 1
63
b (backspace)f (form feed) (newline) (carriage return)q (double quote)t (tab)\ (backslash)
continueGNU-. for.
haltGNU-. be.
limitsGNU-. ( be).
define f(args) { /, - args. . - . -
}.auto x,
-
, -
0. - .
return(e^pr) . -
return 0, . .
sqrt(expr) .
lengih(expr)
.
be
64 3. Linux
be scale(expr)To , length, - .
read()GNU-. -. , -
ibase.
be 1. - scale 20.s(angle)
(angle); .
c(angle) (angle); - .
() .
() ().
1() ().
j(n, ) .
. -
, , -
.
+ - * / %
-++
=+ =_ =* =/ =% =- =
< >= == !=
65
/* */ .
() -, , -
. , -
, -
.
{} .
[] .
"text" (text).
, ( -) , - .
ibase = 8 20 16 -
obase = 2 , -
20 10000 ibase = scale = 3 8/7 1.001001000 !
?obase = 10 -
, .
8/71.142 ,
3 .
be
66 3. Linux
be :
def ine p(r, ) { auto vv = r"n
return (v)}scale = 5x=p(2.5, 2)x6.25
length(x)3
scale(x)2
= 2,5-2
biff biff [arguments} -
, biff . -, comsat(8). - biff , a biff n .
.
bison bison [options] f i l e -
(file), -- .
file.c. .
.,
- . -
( ) + .
b prefix, file-prefix=pre/ix -
fix.d, defines
file.h, #define, - bison , - .
67
, raw
file.fi , -- .
k, token-table file.c YYNTO-KENS, YYNNTS, YYNRULES YYNSTATES.
1, no-lines #line file.c ( - ).
n, no-parser -
, . -
switch - file.act.
file, output-file=/j/e .
prefix, name-prefix=pre/ijc (prefix) .
-t, debug .
-v, verbose . -
file.output.V, version
bison.
-, , fixed-output-files
.
bison
bootpd [options] [configfile [dumpfile]] TCP/IP. (Internet Boot Protocol), bootpd /etc/in-etd /etc/inetd.conf:
bootps dgram udp wait root /etc/bootpd bootpd
bootpd
68 3. Linux
bootpd bootpd , .
.
bootpd /etc/bootptab ( configfile, - ), BOOTREQUEST. /etc/services bootpd , . : bootps -- bootp bootpc - , - .
bootpd -DDEBUG, - SIGUSR1 /etc/bootpd.dump - dumpfile.
- directory bootpd.
d level . level , - 1.
t timeout .
.
bootpd -, -
. -
. :
hostname: tg=value\ tg=value: tg=value
hostname - - bootp, a tg - , - value. .
bf .bs 512 .cs cookie.ds (DNS).
69
gw .ha .hd .hn .ht (. RFC Assigned
Numbers - ).im .ip IP- .lg log-.1 1-.ns IEN-116.! -
.
sm .
tc .to UTC ( ).ts .vm cookie .
, -
( RFC 1048). -
, ASCII-, - .
bootpd
bootpgw [options] server (Internet BootProtocol Gateway). , server bootpd. -OTREPLY, BOOTREQUEST. bootpgw /etc/inetd /etc/inetd.conf - :
bootps dgram udp wait root /etc/bootpgw bootpgw
bootpgw - , bootpgw , bootpd, -.
bootpgw
70 3. Linux
bootptest bootptest [options] server [template] TCP/IP. bootpd server 10 . template, .
-{file .
h , IP-.m magic-number
magic-number - .
bzip2 bzip2 [options] filenamesbunzip2 [options] filenamesbzcat [option] filenamesbzip2recover filenames , gzip, -
. bzip2 - , -
.2. bunzip2 -, bzip2 ( ), bzcat , a bzip2recover -
.
-
.
-dig - dig . 100 , dig - 1 9.
, stdout
.
d, decompress .
71
f , force . -
. -
.
k, keep .
L, license, V, version , -
.
q, quiet .
s, small ,
.
t, test , .
-v, verbose .
. -
-v .
z, compress ,
bunzip2 bzcat. repetetive-fast, repetetive-best
0.9.5 ( - ) -
.
++ [options] files. g++.
cal [-jy] [[month] year]
12 ( ) - .
(month) 1 12, (year) - 1 9999. - .
bzip2
++
cal
72 3. Linux
cal j (
1 365, ). ,
- .
cal 12 1995cal 1994 > year_fi le
cardctl cardctl [options] command . -
PCMCIA . , -
, ( - /etc/pcmcia). scheme .
PCMCIA- , , .
config [socket} .
eject [socket] ( - ).
ident [socket] -
.
insert [socket] .
reset[socket] .
resume [socket]
.
scheme [name]
().
73
status [socket] .
suspend [socket] -
.
directory -
/etc/pcmcia.-f file
-
, /var/run/pcmcia-scheme.s f i l e
-
, /var/'run/stab.
cardctl
cardmgr [options]
, PCMCIA.cardmgr PCMCIA . ,
( /etc/pcmcia/config). - cardmgr - .
,
. ,
, - , -
. , -
. -
/var/'run i'stab.
- directory -
directory /etc/pcmcia.-d PCMCIA- -
modprobe insmod.
cardmgr
74 3. Linux
cardmgr f ,
.
mdirectory PCMCIA- - , /lib/modules/ \
, -
.
-pfile cardmgr - , /var/run/cardmgr.pid.
q He .sf i le
-
, /var/'run/stab.v .
V .
cat cat [options] [files] (files) - .
, -
. EOF. -
> - .
, show-all , vET.
-b, number-nonblank
. 1. , vE.
-, show-ends $ .
n, number . 1.
75
s, squeeze-blank -
.
t To , vT.-, show-tabs
(TAB) 1. ,
Unix-.-v, show-nonprinting
,
(LINEFEED) (TAB).
cat ch1
cat ch1 ch2 ch3 > all
cat notesS notes cat > tempi ,
EOF
cat > temp2 STOP , STOP
[options] files. gee.
cfdisk [options] [device]
. -
. device /dev/hda ( ), /dev/hdb, /dev/sda,/dev/sdb, /dev/sdc, /dev/sdd. . fdisk.
- , -
.
cylinders
.
cat
cfdisk
76 3. Linux
cfdisk h heads .
s sectors .
z ; .
format : ( ), s ( ) t ( ).
.
.
b (bootable) .d ( ,
).g . -
, (, h s, ).
h .m -
.
.
.
.
q .t . (, -
, ).W . ,
.
chattr chattr [options] mode files .
Linux (Second Extended Filesystem). - chmod - +, - =. (mode) . . Isattr.
77
R -.
-V . version
version.
+ .
.
= ( , ).
.
.
.
.
d dump.i .
.
s ; -.
.
S .
chattr +a myfi le ,
chattr
chfn [options] [username] , /etc/passwd finger. (options), chfn - . , -
.
. -
-
.
chfn
78 3. Linux
chfn f, full-name
.
h, home-phone .
, office .
, office-phone .
u, help -
.
, version .
chfn -f "Ellen Siever" ellen
chgrp chgrp [options] newgroup fileschgrp [options]
files. -- (newgroup) , , /etc/groups. -
-.
, changes .
f, silent, quiet , -
.
help -
.
R, recursive , -
.
79
reference=filename chgrp filename. newgroup .
V, verbose .
version .
chmod [options] mode fileschmod [options] reference=/itename files (mode) (files).
. (mo-de) (who opcode permission), . -
() - . -
mode, .
-, changes , -
.
f, silent, quiet , chmod - .
help -
.
-R, recursive ,
.
reference=/ri/ename filename.
-v, verbose ,
, -
.
chmod
80 3. Linux
chmod version .
.
g . .
( ).
+ .
.
= ( ).
.
w .
.
s ().t . ()
().
.
g .0 . -
.
, - ,
- .
:
4 .2 .1 .: , , - . -
:
4 , , , -
.
81
2 , , ,
.
1 .
(execu-te-by-user permission):
chmod u+x file
, -
(7), (5) (1) a (file):
chmod 751 filechmod u=rwx, g=rx, o=x file
(file):chmod =r filechmod 444 filechmod a-wx, a+r file
, -
, , -
- :
chmod 4755 file
chmod
chown [options] newowner f i l e schown [options] reference=filename files (files) - (newowner). -
, /etc/passwd. chown - : .. -. -
, .
,
, .
.
chown
82 3. Linux
chown , changes
, -
.
dereference .
f, silent, quiet , -
- .
h, no-dereference ( - ), , .
, verbose , -
, .
R, recursive , -
.
reference=filename filename .
help -
.
version chown .
chpasswd chpasswd [option] . -
, chpasswd username.-password ( ). , (password) - .
.
83
chroot newroot [command] . -
command , ,
.
. -
/ newroot . -
newroot. .
chroot
chsh [options][username]
,
,
. /etc/shells, . . chsh .
.
-1, list-shells , -
/etc/shells, .
s shell, shell shell , -
.
-u, help -
.
, version chsh .
chsh -s /bin/tcsh
chsh
84 3. Linux
cksum cksum [files] (CRC) (files) . -
, .
, -
( , ).
clear clear
.
[options] filel file2 [skipl [skip2]] filel file2. - - , -
. . comm diff. - . skipl skip2 -
.
, print-chars .
-i , ignore-initial=nu7n .
-1, verbose .
s, quiet, silent ; , - :
0 .1 .2 .
,
( 0):cmp -s old new && echo 'no changes'
85
col [options] escape- -
tbl nroff , .
(backspace); - (manpages). ,
. ( - -
.)
. -
128. , col , - , -
.
.
f i l e tbl nroff -
col :tbl myfile | nroff | col | more
man- (manpage) Is out.print, (backspace), ".
man Is | col -b > out.print
col
-f
-Ira
-x
colcrt [options] [files] escape-, -
tbl nroff , -. (, -) ( ) - .
.
2 -.
colcrt
86 3. Linux
colrm colrm [start [stop]] , -
.
,
. 1; start () - stop (). - start stop; (backspace) 1.
colrm 3 5 < testl > test2
column column [options] [files] (files), . -
, .
() .s char
char. t.
t . - , -
-s.
, -
.
comm comm [options] filel file2
filel file2.
: , -
, ,
. comm diff, . . - . comm - uniq. , comm - -
, uniq - .
87
.
. -
, .
help .
version -
.
, :
comm -12 slskel_top10 ebert_top10
comm
compress [options] files .
.Z. -, ,
. -
. , -
, . . gzip.
-b maxbits .
,
.Z.
d , . - uncompress.
f , .
-
.
.
V , , .
compress
88 3. Linux
[options] filel file2 [options] files directory filel file2 files directory. , -; , - ( ).
, archive -
. , -dpR.b, backup
.
d, no-dereference ,
.
f, force
.
i, interactive -
.
-1, link
( )., preserve
, -
.
, parents -
.
. ,
parents jphekman/book/ch1 newdir jphekman/booh/chl /newdir/jphekman/book/chl, -.
89
, R, recursive .
-S backup-suffix, su f f i x=backup-su f f ix , -
.
SIMP-LE_BACKUP_SUFFIX. - ~(). , - (. . .bak, bak).
s, symbolic-link
. -
.
u, update , -
( ) ., verbose
.
V type, version-control=fype .
VERSI-ON_CONTROL. existing. :
t, numbered .
nil, existing
, ,
.
never, simple .
, one-file-system ,
.
cpio flags [options] ( ) ( ) . - (flags) -i, -p .
90 3. Linux
i, extract [options] [patterns] , -
(patterns). -
. ( , -
cpio.) , . -
( - ).
, create [options] , -
.
, pass-through [options] directory (directory) .
.
, -
i, , . .
i: bcdf mnrtsuv SVCEHMR IF: vABL VC HM 0 Fp: Oa d 1m uv L V R
-0, null ,
, -
, -
.
, reset-access-time ( ) .
, append ( ). - F.
91
b, swap -
32- .
-,
5120 ( 512).blocksize=size
(blocksize) / - size x 512 .
ASCII-. - .
, io-size==rc , -
.
d, make-directories .
file, pattern-file=/iZe file.
f, nonmatching : , -
patterns.-F file, f i le=fi le
file, - (stdin) (stdout). ,
user@hostname:file ( user ).
force-local, ( F, I -) ,
:.
type, format=type type. - bin. -:
bin .ode (POSIX.1) .
92 3. Linux
newc
(SVR4) .
(SVR4) , .
tar-.
ustar POSIX.1 ( , GNU- tar).
hpbin HP-UX ( -, ).
hpodc HP-UX.
-I file (file) . - (. - -F).
-k , -.
-1, link .
-L, dereference .
-m, preserve-modification-time .
-M msg, message=msg msg .
%d, . - -
I .-n, numeric-uid-gid
-
.
no-absolute-filenames
.
93
no-preserve-owner , , -
.
.
- file (file). - (. F).
only-verify-crc CRC- CRC -, .
quiet .
.
-R [user][:group], owner [user][:group] , -
. -
.
s, swap-bytes .
S, swap-half-words .
sparse -
-
.
-t, list ( - -). v - Is 1.
u, unconditional ; , .
v, verbose .
-V, dot () ( - cpio, ).
94 3. Linux
version -
.
find , - .old. cpio:
find . -name "*.old" - print | cpio -ocBv > /dev/rst8 , -
save ( ):cpio -icdv "save*" < /dev/rst8
:
find . -depth -print | cpio -padm /mydir
cpp cpp [options] [if He [ of He ]]
GNU- . - -
gcc. - , gcc, - , ifile ofile , , -
; .
-$ $ .
. -
#define, - .
-dD dM,
.
idirafter dir dir, .
95
imacros f i l e f i l e - .
include f i l e file .
ipre f iK prefix iwithprefix (prefix).
iwithprefix dir dir , - ,
. -
-iprefix, dir.lang-c, -lang-c++, -lang-objc, -lang-objc++
, C++, Objective Objective C++, .
-lint lint : #pragma lint command.
nostdinc -
, .
-nostdinc++ , -
C++ .pedantic
.
pedantic-errors , -
-pedantic .traditional
, ANSI .undef
.
A name[=def] def, - #assert.
96 3. Linux
- ( , ). - .
Dname[=def\ def ( #define). (=def), 1. D, U.
( - ) .
-Idir
dir #include, /, .
,
/, - , -
, I, .
- [-MG] .
make, - . MG, , -
.
-MD file , -
.
-
. ,
#include "file".-MMD file
MD, .
-
, -
.
97
\lname , -
-
, -
D. , - Intel, - unix 1386.
Wcomment, Wcomments .
Wtraditional , ANSI - , .
-
. :
DATE ( Oct 10 1997).
FILE__ ( ).
LINE ( ).
TIME ( 12:00:00).
-
, ,
. -
#line.
# . -
# -. :
#assert name (string) string. - (assertions) #if. - #system,#cpu #machine.
98 3. Linux
#unassert name .
#define name token-string token-string. - token-string.
#define name(arg arg) token-string . -
token-string. - token-string.
#undef name . -
#undef.#ident string
string - .
#include "filename"', #include filename .
" > .
#line integer-constant "filename" -
.
,
(integer-constant) filename. - filename . - -
.
#endif, , -
(#if, #ifdef #ifndef). .
#ifdef name, -
#endif #else, #elif, , . -
.
99
#ifndef name, -
#endif #else #elif, , .
.
#if constant-expression, -
#endif #else #elif, , constant-expression .
#elif constant-expression #elif #if, #ifdef #ifndef - #else #endif. , #elif #else, #elif #endif, - , -
-
#elif , - constant-expression . #elif #else .
#else, -
#endif, -, -
#elif . -
#else .#
.
#warning , .
. -
. -
, -
/etc/cron/tabs. - .
crontab.
100 3. Linux
crontab crontab [options] [file], -
crontab. - crontab , u user. crontab ( ), .
. , ,
:
0-590-231-311-12Jan, Feb, Mar,0-6, 0 Sun, Mon, Tue, . , .
,
,
- (*). , crontab :
59 3 * * 5 find / -print | backup_program00 1,15 * * echo "Timesheets due" | mail user
3:59 , 1- 15- . -
crontab . - /etc/cron.allow, , - - /etc/cron.deny. , .
, 1 , .
crontab ( , -).
1 crontab - .
101
crontab .u user
,
crontab.
crontab
csh [options] [file [arguments]] (C-shell), . -
8 csh tcsh.
csh
csplit [options] file arguments
( < 100). , -
. . split.
.
b suffix, suffix-format=sw//ir (suffix). - . -
, ,
. -
:
% d .% i , % d.% .% .% .% X , % .
-f prefix, pref ix=pref ix prefixOO prefixn ( ).
k, keep-files , -
( ). , {}, -
csplit
102 3. Linux
csplit out of range ( )
.
, digits=raum
. = 2.s, -q, silent, quiet
.
z, elide-empty-files . -
, .
. , -
, .
/expr/ [offset} , -
,
. (offset) + , - .
%expr%[offset] //, , - , .
. -
({}) - .
{} .
. -
, ,
. -
*, , -
.
20 - novel.csplit -k -f chap, novel '/CHAPTER/' '{20}'
103
100 ( - 99), , address_list.
csplit -k address_list 4 {99}
csplit
ctags [options] files ,
, C++, FORTRAN,Java, Perl, yacc . ( - tags) :
file context
name - , file - , , a context - - , , -
name. () vi :
:set tags=tagsfiJe: tag name
vi , - tagsfile ( - t).etags - Emacs.
-, append .
-d, defines -
.
i file, mcliide=file tags file, - .
-1 language, language=language , ,
language. h -
.
file, output=file file.
ctags
104 3. Linux
ctags -rregexp, regex=regexp , -
regexp. , .
-R, no-regex ,
. ,
.
-t, typedefs type-defs.
-u, update , -
(, ). , .
-v, vgrind () ,
( 64 ).-w, no-warn
.
-, cxref , ,
.
-, backward-search .
-, ++
, . . C++, .
-, -h, help .
-S, ignore-indentation ctags ; - .
-, typedefs-and-c++ typedef, struct,enum, union - C++.
105
V, version
.
ctags
cut options [files} -
.
(list) - . , -
(, 1-10,15,20 50). . paste join.
-b list, bytes list list ; , .
list, characters list .
d , delimiter f ( - ). (-, ) .
-flist, fields list , list.
- , ,
-s, only-delimited -f .
output-delimiter=srmg
. -
, .
help -
.
version cut .
cut
106 3. Linux
cut
/etc/passwd:
cut -d: -f1,5 /etc/passwd
, (- ):
, who | cut -d" " -f1 (file) - :
cut -c4 file | paste - file
date date [options] [+format] [date] .
(format). , ( - ), , . -
.
.
+format , -
:
X date +" Xj X n X k %p"Tuesday 24815
% % b % % % Z% Y, . . Tue Sep 5 14:59:37 EDT 2000.
d date, date date date ( ), - d days months d days - , . ago , .
(. ).
f datefile, file=datefile -d datefile.
107
I [timespec], iso-8601[=f imespec] ISO-8601. timespec, : date ( ), hours, minutes,seconds. .
- f i l e , reference=/4te .
-R, rfc-822 RFC 822.
help .
version .
s date, set date .
-u, universal (Greenwich Mean Time), a .
% %. ( -
)._ ( - ).% .% .% .%d (01-31).% h % b.% j (001-366).% k 24-
(0-23).%1 12-
(1-12).% (01-12).% .
date
108 3. Linux
date
%r%s
%y%z
%p : a.m. - . . - ( AM ). 12- % I:% M:% S%p. , , . .
00:00:00 UTC 01.01.1970 ( - ).
%t .%w ( Sunday = 0).% .
(00-99). , RFC 822.
% .% .% D % m/% d/% .% 24- (00-23).%1 12- (01-12).% (00-59)%S (00-59).% % : % : % S.% U (00-53), -
.
% V (0152), - .
% W (00-53), - .
% X .% Y (, 1996).% Z .
, ,
. ,
MMDDhhmm[[CC]YY][.ss]. , ,
.
time hhmm: 24- - .
109
day date
MMDD - . - .
year ( ) - . - -
.
: 1 (0701), 4 (0400), 1995 (95):
date 0701040095
date +"HelloXt Date is X D X n X t Time is XT"
:
Hello Date is 05/09/93Time is 17:53:39
dd [option=value]
(if) - , ( , of ). , of if - , .
dd , -
.
bs=ra
;
ibs obs.
cbs=ra
( - ) . ascii, ebcdic, ibm, block unblock.
dd
110 3. Linux
dd conv=flags -
( ) . - flags .ascii
EBCDIC ASCII.ebcdic
ASCII EBCDIC.ibm
ASCII EBCDIC IBM.
block (. . , ) - .
unblock .
lease .
ucase
.
.
notrunc .
swab .
sync , -
ibs.
.
ibs=n (512 ).
if=file file ( ).
111
dd (512 ).
of=file file ( ).
seek=n ( - , obs) .
skip=n ( - , ibs) .
help dd -.
version dd .
() 1024, 512 2, , , k, b w. -
.
:
dd if=caps_file of=small_file conv=lcase
( - data_retrieval_cmd) out, - :
data_retrieval_cmd \ dd of=out conv=sync,block
debugfs [[option] device]
. -
ext2. device , , -
ext2 (, /dev/hda3).
w .
debugfs
112 3. Linux
debugfs cat file
inode- -.
cd directory .
chroot directory inode-.
close -
.
clri file inode-, file.
dump f i l e out_file inode- out_file.
expand_dir directory .
find_free_block [goal] , goal ( -), .
find_free_inode [dir [mode]] inode- .
freeb block block .
freei file inode-, file.
help debugfs.
icheck block inode-.
initialize device blocksize ext2 .
kill_file file .
113
In source_file dest_file .
Is [pathname] Is.
modify_inode f i l e inode-, .
mkdir directory .
mknod f i l e [ [[ | b] major minor]] .
ncheck inode inode- > .
open [w] device .
pwd .
quit debugfs.
rm file .
rmdir directory .
setb block .
seti file inode-, - .
show_super_stats .
stat file inode-, .
testb block, .
debugfs
114 3. Linux
debugfs testi block, inode-, - .
unlink file .
write source_file file file - source_file.
depmod depmod [options] modules
. -
(mo-dules). - modprobe . depmod /sbin/depmod - - /etc/rc.d, .
,
/etc/conf.modules.d . -
.
(unresolvedsymbols).
v .
/etc /conf. modules , ,
.
/sbin/insmod, /sbin/rmmod, depmod.
115
df [options] [name] -
(name), df .
-
1 512 ( - POSIXLY_CORRECT). () (, /dev/hd*), (, /usr) - ( df , ).
, all
.
block-size=n .
h, human-readable , (. .1,9 1967156).
, si h, - 1000, 1024.
i, modes -
mode, -.
k, kilobytes , 512 .
1, local
.
m, megabytes .
no-sync sync ( ) .
.
df
116 3. Linux
df , portability POSIX (-
).sync
sync ( ) .
-t type, type^type -
(type)., print-type
-
.
type, exclude-type=fype , -
type.help
.
version .
diff diff [options] [diroptions] filel file2 , diff - filel file2. - ,
filel . - ed (, d), - filel file2. - - , -
. ,
diff , (, diff my_dirjunk diff my_dir/junk junk). - , diff , (, olddir/program newdir/program). , diff , -
, . . .
117
-, text .
.
b, ignore-space-change -
; .
, ignore-blank-lines .
: .
- , context[=n] : .
-d, minimal , -
,
, ,
.
Dsymbol, i fdef=symbol
,
, #ifdef #ifn-def, .
-, ed (, d), filel file2 ed.
F regexp, show-function-lme[=regexp] diff - , -
regexp, .
- , -
-
; .
diff
118 3. Linux
diff help .
horizon-lines=/i -
, -
.
-i, ignore-case . -
-
.
-I regexp, ignore-matching-lines=regexp ,
regexp.-1, paginate
, .
-L label, label label, label=label diff - label . -
, , , - .
left-column (-) - .
-, res
diff RCS.-N, new-file
.
-, show-c-function ,
- Java, , . -
-,
diff.-, unidirectional-new-file
-
, -
.
-q, brief , .
119
, recursive .
-s, report-identical-files .
-S filename, startmg-file=filename filename, ,
.
suppress-common-lines (-) .
t, expand-tabs -
.
-, initial-tab -
.
diff: - , -
.
-U , unified[=ra] diff: -
. -
3 .-v, version
diff.w, ignore-all-space
.
W , width=ra (-) - .
130.- regexp, exclnde=regexp
, -
regexp.
diff
120 3. Linux
diff -X filename, exclude-from=/t/enameHe , -, filename.
, side-by-side .
-
. -
-U.
diff3 diff3 [options] filel file2 fileS .
- ( ). :
.
_^ -jfilel , file2 fileS .
====2file2 , filel fileS .
====3fileS , filel file2 .
diff3 - (, - ,
). diff3 - , -
-
. (-merged changes),
. -
-
(merged changes). , , -
(overlapping change). , -
(file2) - (fileS), filel.
121
-3, easy-only ed, filel -, file2 fileS.
, text .
-, show-all ed, filel -, .
, ed ed, filel - file2 fileS.
, show-overlap ed, filel - , -
.
-, overlap-only ed, filel - .
X -, .
m, merge , ( ed).
L label, label=ZabeZ label .
i (w) (q) ed.
-, initial-tab ( ) -.
V, version
.
diffS
122 3. Linux
dip dip [options] [chat scriptfile] . -
, dip - , . -
-
. dip - -
diplogiii diplogini.
-
. diplogini.i .
diplogin.k dip , -
, 1.1 device
k .
m mtu
(MaximumTransfer Unit). 296.
protocol : SLIP, CSLIP, TERM.
t . .
V .
-
, .
beep times -
.
bootp IP-, .
break BREAK.
123
chatkey keyword code ( ) .
config [interface | routing] [pre | up | down | post] arguments (interface) (routing) : (), (up), (down) - (post). , - if config route.
databits 718 .
dec $variable[value] variable value. 1.
default IP- , - .
dial phonenumber [timeout] phonenumber. - ,
timeout . $errlvl - .
echo on | off .
exit [n] -
.
flush .
get $variable [ask | remote [timeout]] value variable value. ask, -. remote, . -
timeout .goto label
label.
dip
124 3. Linux
dip help .
if expr goto label label, -.
: =, !=, ,=.
inc $variable [value} variable value. - 1.
init string , -
. QO VI XI.mode protocol
. :SLIP, CSLIP, TERM. - SLIP.
netmask mask .
parity E | | N : (even), (odd) ().
password .
ARP- .
print $variable variable.
psend command
. -
.
port device , -
.
quit . -
.
125
reset
.
securid System Secu-relD - .
securidf prefix System Se-curelD.
send string string .
shell command , -
.
skey [timeout] S/Key, . . -
, timeout. dip - S/Key.
sleep time time .
speed bits-per-second . 38400.
stopbits 1 1 2 .
term . -
.
timeout time , -
.
wait text [timeout] timeout text . ,
.
dip
126 3. Linux
dirname dirname pathname
pathname, . - . -
/ , dirname - . ( ). . basename.
dmesg dmesg [options] . -
.
-
() , -, .
.
n level -
.
dnsdomainname dnsdomainname
TCP/IP. DNS ( ).. hostname.
domainname domainname [name] NFS/NIS. - NIS-. - . , -
, ; - .
dosfsck dosfsck [options] devicefsck.ext2 [options] device . fsck, MS-DOS. MS-DOS - fsck. dosfsck - , .
127
,
.
MS-DOS Atari.-d file
-
. ,
.
,
, dosfsck .-1 file
.
.
.
.
t .
V . .
size, size; , .
-F .-L file
f i l e -.
dosfsck
du [options] [directories] -
(. . 1 ), - ( ).
-, all ,
.
du
128 3. Linux
du -b, bytes .
-, total -
.
-D, dereference-args ,
.
-h, human-readable .
-, si h, - 1000, 1024.
-k, kilobytes ( ).
-1, count-links , ,
.
-L, dereference .
eTtclude=pattern , -
pattern.max-depth=/mm
,
, -
.
-m, megabytes ,
-s, summarize -
.
-S, separate-dirs -
.
129
, one-file-system
.
-X, exclude-from=/zZe , -
- file.help
.
version -
.
du
dumpe2fs device
. -
device .
dumpe2fs
dumpkeys [options]
. -
key tables.
1, separate-lines / ,
plain.ccharset, charset=charset
, -
. - iso-8859-1. - help.
compose-only compose-.
1 compose- .
dumpkeys
1 , -
- , -
(, . .). - . . .
130 3. Linux
dumpkeys -f, full-table : , -
.
funcs-only -
; - .
-h, help .
-i, short-info . -
, , -
, -
(, ) - .
keys-only ; - .
-1, long-info , short-info, -
.
-n, numeric -
; - .
-S , shape=/m/n -
. :
0 .1 , full-table.2 , separate-lines.3 -
, /.
131
e2fsck [options] devicefsck.ext2 [options] device ,
fsck, - Linux. e2fsck fsck ext2fs.
-b superblock
.
d .f , -
.
e2fsck , .
-1 file f i l e - .
- .
.
. .
t .
.
.
- size size; , .
-F .-L file
-
.
e2fsck
echo [-n] [string]
/bin/echo. echo, - shell bash. - :
\ .
echo
132 3. Linux
echo \b .\c .\f ( ).\ .\ .\t .\v .\\ .\
ASCII- .
escape- (. ) .
.
escape-. -
.
help
.
version
.
/bin/echo "testing printer" | lp/bin/echo "TITLE\nTITLE" > file; cat dod doc2 file/bin/echo "Warning: ringing bell \a"
egrep egrep [options} [regexp] [files] (files) , regexp. egrep : \(, \), \, \, \{ \}. - , +, ?, | ( ). , -. 9 . egrep: 0 - - , 1 - , 2 - .
133
. egrepgrep. . fgrep. egrep, , .
Victor Victoria :egrep ' V i c t o r ( i a ) * ' f i l eegrep ' ( V i c t o r [ V i c t o r i a ) ' f i l e
, old.docl new.doc2, :
egrep -n ' (o ld |new)\ .doc? ' files
emacs [options] [files] emacs .
Emacs 10 Emacs.
env [options] [variable=value ...] [command] , -
(variable), (value) -. (command), - .
-, i, ignore-environment .
-u name, unset name .
help .
version -
.
env
etags [options] files ,
, Pascal,FORTRAN, yacc flex. ( tags) :
etags
134 3. Linux
etags name file context , file - , , a context - - , , -
. () Emacs :
ESC-x visit-tags-table
Emacs ; TAGS. ,
tagsfile, :ESC-x find-tag
, , ctags vi.
, append .
d, defines
.
i file, include=/i/e , -
file.1 language, language=language
, ,
language. - h -
.
file, output=file file.
regexp, regex=regexp , -
regexp, , .
-, ++
, . . C++, .
135
D, no-defines -
.
, h, help etags.
R, noregex , -
, ,
.
-S, ignore-indentation etags ; - .
-V, version etags.
etags
ex [options] f i l e .
11 !.
expand [options] files -
, , -
, . -
.
.
-tabs, t, tabs tabstabs - , ,
. -
, -
. -
8 . - t tabs , .
expand
136 3. Linux
expand i, initial ,
.
help .
version -
.
expr argl operator arg2 [operator arg3...] , ,
.
.
,
. -
: , . .
: 0 - , 1 - ,2 - .
:
+ arg2 argl. arg2 argl.* .
/ argl arg2.% argl arg2.
-
, .
*
,
( \ ).
.
, -
(locale). -, 1, - 0. >
137
.
!= .> , argl arg2.>= , argl 2.< , argl , arg2.
138 3. Linux
expr match string regex string: regex.
quote token token , - .
substr string start length (string), start,length - . -
start length -.
; 10:
5 + 1 0 / 2
; 7 (7,5):
\( 5 + 10 \) / 2 1 i. - -
:
i = ' $1 + 1' 1 (), hello:
$ = hello 1 (), b 5 10:
$ + 5 \>= 10 5-, 6- 7- character:
substr character 5 3
version.100. - :
$ : ' . * ' 11
:
139
$ : ' \ ( - * \ ) ' : version.100 :
$ : '[a-z]*' : 7 :
$ : '\([a-z]*\)' : version $, $ 5 ; - $ ( - ,
, . . -
.) $ : '\( '
. -
.
mv $ ' $ : '\( ..... \)' \l $'( , mv -i.)
false false
.
( 0). bash. . true.
fdformat [options] device .
(device) /dev/fdO /dev/fdl.
-
.
fdformat
fdisk [options] [device]
. -
, fdisk - , ,
.
fdisk
140 3. Linux
fdisk , - .
. -
Linux - 40 . (device) - /dev/hda, /dev/hdb, /dev/sda, /dev/sdb, /dev/hdc, /dev/hdd . . . cfdisk.
-1 .spartition
partition, DOS.
bootable () .
d .1 .m .
; .
-
.
q .t .
/ (- ).
v , - ( - ) .
w .
fetchmail fetchmail [options] [servers...]
.
-
, fetchmail 2, , IMAP2bis IMAP4. SMTP 25 (-, sendmail),
141
. fetchmail -/.fetchmailrc. - ( , .fetchmailrc).fetchmail popclient, - ,
.
-, all , ,
, .
.
-A type, auth type , type password, kerberos_v5 kerberos. fetchmail , .
- , fetchlimit n , -
.
- , batchlimit n , -
SMTP-. -
.
0 ( ).-, check
. -
IMAP, ( ).
-D [domain}, smtpaddress [domain} , RCPT - SMTP. - (localhost).
header, envelope header , -
( X-Envelope-to:), Kaheader.
fetchmail
142 3. Linux
fetchmail , expunge n IMAP- EXPUNGE, , .
0 . , expunge .
-F, flush : .
-f file, fetchmailrc file fetchmail.
-I specification, interface specification,
IP- ( IP-) . (specification) interface/ipaddress/mask. TCP- (slO, pppO . .), - IP-, - IP, - 255.255.255.255.
-, nokeep .
-k, keep .
-1 size, limit size -
. , ,
.
- interface, monitor interface --
- -
, .
-,
.
-m command, mda command -
, 25 . command - , , /usr/lib/sendmail -oem. - % -, a %F - .
143
, norewrite
. -
.
, port n .
.
pproto, protocol proto , .
prof :2 Post Office Protocol 2. Post Office Protocol 3.APOP MD5.RPOP RPOP. Kerberos v4 1109.IMAP
IMAP2bis, IMAP4 IMAP4revl. fetchmail - .
IMAP-K4IMAP4 IMAP4revl Kerberos v4.
IMAP-GSSIMAP4 IMAP4revl GSSAPI.
ETRN ESMTP.Q string, qvirtual string
string, - , -
(, Delivered-To:).- folder, folder folder
folder .
s, silent -
.
-U, uidl
.
fetchmail
144 3. Linux
fetchmail -u name, username name
.
-V, version fetchmail . -
.
, verbose -
. , q.Z , antispam nnn
SMTP-, , - - .
= 1, .
fgrep fgrep [options] pattern [files] files , - pattern. : 0 - ,
, 1 - , 2 - .
grep. . egrep.
f i l e , :f g r e p -v ' ' f i l e
file, spell_list:fgrep -f spell_list file
file file [options] files ,
. file (, /usr/share /magic), - .
b - .
145
( files - ). - .
- f f i l e ,
(file).L .
.
m file
/usr/share/magic.-
.
s .
V file.7 .
file . ,
, :
ascii text program textc-shell commandsdataemptyiAPX 386 executabledirectory[ntjroff, tbl, or eqn input textshell commandssymbolic link to ../usr/etc/arp
, -
trof f /nrof f:
file * | grep roff
file
find [pathnames] [conditions]
(. ).find , pathname
find
146 3. Linux
find , - (conditions). - .
: print ( , ), -name type( ), exec -size ( -), mtime -user ( ). : - \( \), ! (\! shell), - ( ) ( ; - name, type, perm). - , -
. . , ctime , atime -mtime.
atime + | \ , -
(+) (-) , . -, find , .
ctime + \ \ , (+) () , . , -
, , -
chmod.-depth
( ). - , ,
(, find cpio).
exec command {} \; command , - find ( find, . . 0). command . -
\;.
147
-follow ,
( type 1).-group gname
, gname. gname - , .
inum n , inode .
links n , .
mount, -xdev ,
, .
mtime +n\n n , -
(+) () , .
.
name pattern ,
(pattern). - \.
newer file , ,
(file); mtime. follow , .
ok command { } \; exec, - .
perm nnn , -
(, rwx) (-, -rwrw-r 664). ,
(, -perm -600 -rw******, * ).
find
148 3. Linux
find -print -
. - true.
-regex pattern -path, - grep -, -name -path.
size n[c] , , -
, .
-type
. : (- ), ( ), d (), ( ), 1 ( ), s () f ( ).
user user
, user ( ).
daystart .
-maxdepth
.
mindepth , -
.
noleaf find , - , -
( .), . . , . -
-noleaf find ,
-Unix ( - , -
). Unix .
149
amin +\-\ , -
(+) () , .
anewer file , -
f i l e , follow ,
.
cmin +n\n , (+) () , - .
cnewer file ,
f i l e , -follow , -
.
empty , .
.
-false false .
-fstype type , -
type. : mi-nix, ext, ext2, xia, msdos, umsdos, vfat, proc, nfs, iso9660,hpfs, sysv, smb ncpfs.
gid , -
.
-ilname pattern Iname.
iname pattern -name,
-ipath pattern path.
find
150 3. Linux
find iregex. pattern regex.
Iname pattern , -
pattern. -
/ () . () .mmin + \ \
, -
(+) () , .
nouser
-
.
nogroup -
.
path pattern , pat-tern. - , . . / () . () .
( ) -:
find $HOME -print
chapter 1 /work:
f ind /work -name chapterl -print
, memo, :
find /work -name 'memo*' -user ann -print
( ), (manpages):
find / -type d -name 'man*' -print
,
, :
151
f ind . \! -name '[A-Z]*' -exec Ipr {} \; ,
find
gzip 'find . \! -name '* .gz ' -print' ( -):
find / -size 0 -ok rm {} \; ,
( ):find / -mtime -2 -print
(grep) :find /book -print | xargs grep ' [Nn]utsheir
ktl kt2, :
$ find . -name 'kt[0-9]'./kt1./kt2
, -
./, -path:
$ find . -path './kt[0-9]'./kt1./kt2
regex, path, -, -
, ( ):
$ find . -regex './kt[0-9]',/ktt./kt2
finger [options'] users
,
, .plan .project - . (us-ers) - ( - ). user@host @host.
finger
152 3. Linux
finger -1 ( -
): , s, - , , -
, ,
.plan, .project .forward.-m .
- .plan .project.s : , -
, , -
, ,
.
fingerd in.fingerd [option] TCP/IP. -, fingerd finger. TCP- finger - , fin-ger, , - , fingerd inetd - /etc/inetd.conf.
w , -
.
flex flex [options] [file]flex (Fast Lexical Analyzer Generator) - lex. flex - ( lex.yy.c), , -
. . bison, yacc (John Levine), (Mason) (Doug Brown) lex & yacc, O'Reilly.
b lex.backup.d .
153
f ( ).h flex.i .1 lex. f i l e
f i l e , lex.yy.c. .
s , - .
t ( - lex.yy.c),
v .
w .
( ) .F , .I ( ).L #line lex.yy.c.. prefix
() prefix .
V flex.7 7- .8 8- ( ).I- C++. ,
.
-
-
. , -
.
-
. -
, -
( ).-Cf
().
flex
154 3. Linux
flex -CF -
F.-Cm
( -).
-
/; read().
fmt fmt [options] [files]
( , ). , - , , -
. ,
. fmt, , -
.
, crown-margin ,
-
.
- prefix, pref ix=pref ix , -
(prefix).s, spit-only
.
t, tagged-paragraph . -,
.
,
.
u, uniform-spacing
.
155
w width, \viAth=width (width) . 75.
help .
version
.
fmt
fold [options] [files]
, -
(80 ), fold , -
. ,
.
b, bytes , -
(. . , ).
s, spaces -
.
w, width width width. 80.
fold
formail [options] , -
, .
, formail foo@bar. From - > .
+skip (skip) .
formail
156 3. Linux
formail -total -
(total) .-a headerfield
headerfield; - , -
. Message-ID Resent-Message-ID, .
- From.- -
, .
d He , .
, -
.
f He , . formail From .
i headerfield headerfield , - . headerfi-eld Old-headerfield, .
k . - , .
m minfields -
(minfields). - 2 .
-
formail. prefix
prefix
q He , Content-Length. q .
,
X-Loop,
157
.
i .s ; ,
s, . ^
-
( ) - .
t , - ( formail - ).
u headerfield , headerfield.
headerfield headerfield .
-z -
. .
A headerfield headerfield, -.
, BABYL- rmail.
D maxlen idcache idcache, maxlen. . -
true -. , -
.
I headerfield headerfield, - . .
R oldfield new field oldfield new field.
U headerfield , -
headerfield.Y ,
. . Content-Length.
formail
158 3. Linux
formail -X headerfield headerfield .
free free [options] -
: , , , , , , -
.
b .k .
.
.
( -/+ buffers).-s time
-
time .t -
.
V free.
fsck fsck [options] [filesystem] ... . -
-
. , -
, -
. , fsck
. fsck -, ,
:
1 .2 .4 , .8 fsck.
16 fsck.128 .
159
. -
, fsck. ; -
.
s .
-t fstype . -
.
, -
/etc/f stab.N ; -
, .
R : - , /etc/fstab, -.
.
V .
fsck
fsck.minix [options] device . fsck, -
MINIX.
-
.
f , - , fsck.minix ,
.
1 . mode not cleared
MINIX.- ;
- .
-s .
V .
fsck.minix
160 3. Linux
ftp ftp [options] [hostname], -
, hostname - . ftp . - , . -
, . .
, , -
, .
d .g .i .
.
-v , , - .
\[command [args]] .
, -
,
.
$ macro-name [args] macro-name, - macdef. - ,
.
account [passwd] , -
. -
,
( ).append local-file [remote-file]
. (remote-file), , -
ntrans . , , -
.
161
ASCII
ASCII ().
bell -
.
binary .
bye , ftp.
case
-
. -
. , -
mget
.
cd remote-directory re-
mote-directory.cdup
, -
.
chmod [mode] [remote-file] (remote-file) - . , -
.
close FTP - .
-
ASCII.delete remote-file
remote-file .debug [debug-value]
. -
debug-value, -.
ftp
162 3. Linux
ftp dir [remote-directory] [local-file] (remote-directory) - -
(local-file). , -
. ( ), .
disconnect close,
form format (format). (file).
get remote-file [local-file] (remote-file) - .
(local-file), -, , -
case, ntrans . -, -
.
glob
mdelete, mget input. , - -
.
hash # .
help [command] (command).help ftp.
idle [seconds] ( ) (seconds) . -
.
image binary.
163
led [directory] .
, -
.
Is [remote-directory] [local-file]
, ftp-. (remote-directory), - .
macdef macro-name .
macro-name; . $i,
. $ \.mdelete remote-files
(remote-files) -.
mdir remote-files local-files dir - .
mget remote-files remote-files , -
get.mkdir directory-name
(directory-name) .mis remote-files local-file
nlist .
.
mode [mode-name] .
- stream ().modtime [file-name]
.
ftp
164 3. Linux
ftp