Вы находитесь на странице: 1из 211

1.

Linux
Open Source.........................................................................................................................................................................7
GNU Project ..........................................................................................................................................................................7
Linux ...............................................................................................................................................................7
Linux ..........................................................................................................................................................8
Linux .........................................................................................................................................8
Linux .......................................................................................................................................................9

2. Linux
..................................................................................................................................................... 10
CD/DVD- ....................................................................................................................................... 10
1. ............................................................................................................................ 10
2. - ...................................................................................................... 11
3. ....................................................................................................................................................... 11
4. ................................................................................................................................ 11
5. ......................................................................................................................... 12
6. ............................................................................................................... 12
7. ............................................................................................................ 12
8. ............................................................................................................................... 13
9. ..................................................................................................................... 13
10. ..................................................................................................... 14
11. ......................................................................................................................................... 15
12. ...................................................................................................................................................... 15
13. .............................................................................................................. 15
14. ............................................................................................ 16
15. ......................................................................................................................... 16
16. ? ...................................................................................... 16
17. 1 ........................................................................................................ 17
18. 2 ........................................................................................................ 17
19. Gateway DNS- ................................................................................................... 17
20. .............................................................................................................................. 18
21. ..................................................................................................................... 18
22. ............................................................................................................................ 18
23. ................................................................................................................ 19
24. ......................................................................................................................................... 19
25. .................................................................................................................................. 20
26. ..................................................................................................................... 20
27. ............................................................................................................................................. 21

3. Linux
........................................................................................................................................................ 22
init ................................................................................................................................................................ 22
login ............................................................................................................................................................ 23
................................................................................................................................................ 24
.............................................................................................................................................. 24
GRUB .............................................................................................................................................................. 27
GRUB ..................................................................................................................................... 27
GRUB ........................................................................................................................................ 29
GRUB ............................................................................................................. 31

4.
.................................................................................................................................. 32
Filesystem Hierarchy Standard ................................................................................................................................... 33
ext3 ............................................................................................................................................... 34
ext3 ........................................................................................................... 36
......................................................................................................................................................................... 36
Inode .................................................................................................................................................................................... 37
.................................................................................................................................................................... 38
............................................................................................................................................. 39
SUID ............................................................................................................................................................................ 40
SGID ............................................................................................................................................................................. 41
Sticky .......................................................................................................................................................................... 41
................................................................................ 42
mount ............................................................................................................................................................... 42
umount ............................................................................................................................................................ 43
/etc/fstab ................................................................................................................................................................ 44
/etc/mtab ............................................................................................................................................................... 45
/etc/ilesystems .................................................................................................................................................... 46
/proc ............................................................................................................................................. 46
: , , , .................................................... 48
: , , , ............................................. 50
ls: ......................................................................................................... 51
cd: ...................................................................................................................................... 53
pwd: ..................................................................................................... 54
cat: .............................................................. 54
grep: ........................................................................................................................... 55
chmod: ....................................................................................................... 55
chown: ....................................................................................... 57
umask: .................... 58
mkdir: ..................................................................................................................... 59
rmdir: ........................................................................................................................ 60
rm: ....................................................................................................... 60
cp: ............................................................................................... 60
mv: .............................................. 61
ln: ................................................................................................. 61
touch: .................................................. 62
df: .............................................................. 62
du: ................................................ 63
echo: ....................................................................................................... 63
wc: , ................................................. 64
head: .......................................... 65
tail: ........................................ 65
less: .................................................................. 65
ind: .................................................................................................................................... 66
.............................................................................................................................. 68

5. BASH
........................................................................................... 69
BASH .......................................................................................................................... 73
.................................................................................................................................................... 73
Bash .......................................................................................................................... 73
........................................................................................................................................................... 73
..................................................................................................................................................... 74
....................................................................................................................................... 74

............................................................................................................................................................. 75
/........................................................................................................................... 76
........................................................................................................................................................................ 79
Builtin ........................................................................................................................................................... 79
................................................................................................................................................................... 81
............................................................................................................................................ 82
............................................................................................................................................. 83
................................................................................................................................................... 85
.................................................................................................................................................................. 86
.......................................................................................................................................................... 87
................................................................................................................... 87
echo ESC- .................................................................................................................................. 87

6.
.................................................................................................................................................... 89
UID GID ............................................................................................................................................................................ 89
/etc/passwd ....................................................................................................................................................................... 89
/etc/shadow ...................................................................................................................................................................... 90
/etc/group .......................................................................................................................................................................... 91
/etc/gshadow.................................................................................................................................................................... 91
/sbin/nologin .................................................................................................................................................................... 92
.............................................................................. 92
/etc/login.defs ...................................................................................................................................................... 93
useradd: .................................................................................. 94
usermod: .............................................. 95
userdel: ...................................................................................... 95
groupadd: ............................................................................................... 96
groupmod: ....................................................................................................... 96
groupdel: .................................................................................................................... 97
gpasswd: /etc/group /etc/gshadow ..................................... 97
pwck: ............................................................................ 98
grpck: ................................................................................. 99
.................................................................................................................................................................. 99

7.
? .....................................................................................................................................................101
(PID) .............................................................................................................................101
(PPID) ..........................................................................................101
(UID) ...................................................................................................................102
(EUID) ...................................................................................102
(GID) .................................................................................................................................102
(EGID) .................................................................................................102
...............................................................................................................................................102
...................................................................................................................................................102
.....................................................................................................................................103
............................................................................................................................................................................104
kill: ........................................................................................................105
killall: .......................................................................107
. nice renice..................................................................107
fg, bg jobs: ..............................................................................................108
ps: .....................................................................................................110
nohup: HUP.....................................................113
top: ......................................................113
top .....................................................................................................................................114

vmstat: ........................................................................................115
free: ................................................................................................117

8.
RPM.....................................................................................................................................................................................118
RPM ....................................................................................................................................................118
RPM ...........................................................................................................................................................118
........................................................................................................................................................118
rpm: RPM Package Manager ..................................................................................................................119
rpm- .............................................................................................................................................120
rpm- ..............................................................................................................................................120
rpm-..............................................................................................................120
RPM- ............................................................................121
....................................................................................................122
RPM- ........................................................................122
Yellowdog Updater Modiied (YUM) ......................................................................................................................123
..........................................................................................................................................................124
...........................................................................................................................................................124
......................................................................................................124
.....................................................................................................................................125
..........................................................................................................................125
...................................................................................................................125
.............................................................................................126
yum.conf ....................................................................................................................127
chkconig: .......................................................................................................................128
..........................................................................................................129

9. VIM
vim....................................................................................................................................................131
vim ......................................................................................................................................................131
vim .............................................................................................................................................................131
vim ...................................................................................................................................................................132
vim .............................................................................................................................................................132
vim...................................................................................................................................133
................................................................................................................133
vim ..................................................................................................133
...........................................................................................................................133
............................................................................................................................................................133
.................................................................................134
............................................................................................................................................................134
(cut-paste) ...........................................................................................................................134
(copy-paste) .........................................................................................................................135
..........................................................................................................................................136
................................................................................................................................................................................136
...........................................................................................................................................................136
.....................................................................................................................................137
................................................................................................................................137
.....................................................................................................................................137
.........................................................................................................................................137
.....................................................................................................................................138
vim...............................................................................................................................................................138
......................................................................................................................................................138
.vimrc...........................................................................................................................139

10. Linux
..........................................................................................................................140
....................................................................................................................................142
network, ifdown, ifup ...............................................................................................................................143
ifconig ...........................................................................................................................................................143
...........................................................................................................................................................144
....................................................................................................................................146
..........................................................................................................................................................148
netstat .......................................................................................................................148
netstat .....................................................................................................................................................149
......................................................................................................................................................149
traceroute .....................................................................................................................................................150
..............................................................................................................................150
.....................................................................................................................................151
(hostname) ....................................................................................................................151
system-conig-* ........................................................................152
adsl-* ADSL- ..................................................................................152

11.
NFS .............................................................................................................................................................154
..................................................................................................................155
NFS- ................................................................................................................................156
......................................................................................................................156
........................................................................................................................................157
..............................................................................................................................158

12.
man.....................................................................................................................................................................................159
whatis ................................................................................................................................................................................160
apropos .............................................................................................................................................................................160
info ......................................................................................................................................................................................161
help.....................................................................................................................................................................................161
locate .................................................................................................................................................................................161
which .................................................................................................................................................................................162
..........................................................................................................................................................162

13. Linux
................................................................................................................164
crontab- ..............................................................................................................................................164
crontab-...............................................................................................................................................................165
crontab...........................................................................................................................................................166
......................................................................................................................................168
mc ..........................................................................................................................................171
ssh: .........................................................................................172

14.
....................................................................................................................................................175
Syslog.................................................................................................................................................................................175
(facilities) Syslog ...............................................................................................................176
(priorities) Syslog.......................................................................................................177
Syslog...................................................................................................................................177
............................................................................................................................................................178

........................................................................................................................................178
logrotate ...........................................................................................................................................................................178
/etc/logrotate.conf ............................................................................................................178
logger .............................................................................................................................................................179
..............................................................................................180
.............................................................................................................................180
.......................................................................................180
S.M.A.R.T. - .................................................................................181
Linux ..................................................................................................................181
........................................................................................................182
.................................................................................................................183
..........................................................................183
.....................................................................................................184
..........................................................................184
DNS- ..........................................................................185
proftpd ............................................................................185
....................................................................................................................186
-.........................................................................186

15.
...................................................................................................................187
........................................................................................................................................................187
? ..................................................................................................................188
..............................................................................................................................................188
...........................................................................................................................188
.......................................................................................................190
..........................................................................................................................................190
6 ....................................................................................................................................................191
sysctl: .................................193

16. Linux
/etc/ .......................................................................................................................194
................................................................................................198
.............................................................................................198
........................................................................................199
................................................................................................................200
, ..........................................................................200
............................................................................................................................................201
..............................................................................................................................................................203
.............................................................................................................................................203
..........................................................................................................................................203
......................................................................................................................204
..........................................................................................................................................205
.....................................................................................................................................205
............................................................................................................................205
...................................................................................................................206
................................................................................................................................................206
............................................................................................................................................206
.........................................................................................................................................................207
.................................................................................................................................207
..............................................................................................................................................................209
...............................................................................................................................................................210
...............................................................................................................................................................................210

1. Linux
Open Source
Open Source 1998 ,
, OSI (Open Source Initiative),
Open Source.
Open Source
:
;
;
.

GNU Project
1984

GNU system (GNU .
GNU`s Not Unix GNU UNIX!). GNU
(tar, sed, make, bash, ) .
.
1991
Linux- .
GNU ,
. GNU/Linux
GNU .
Linux .
Linux
. Linux
.

Linux
1. ;
2. Linux ;
3.
;
1. Linux

4. ;
5. Linux: .

Linux
1. Linux
(, X Window)
;
2. Linux .
.
-
;
3. ;
4.
;
5.
.
;
6.
;
7. TCP/IP;
8. Windows:
DOS, FAT, NTFS;
SAMBA ;
Wine Windows- Linux;
TCP/IP
, FTP.
9. .

Linux
Linux .
Windows, .
8

1. Linux

.
, .
.

Linux
Linux ( 100),
, ,
.
:
1. Debian deb (Debian,
Knoppix, Ubuntu);
2. Ubuntu,
Debian (Kubuntu, Xubuntu, Mint);
3. Red Hat
RPM (Red Hat, CentOS, Fedora Core, Suse);
4.
VectorLinux);

Slackware

(Zenwalk,

MOPSLinux,

5. (Gentoo, Arch
Linux).
.

1. Linux

2. Linux
Linux:
1. CD/DVD-.
;
2. ;
3. FTP, HTTP NFS.

CD/DVD-
1

BIOS CD/DVD-,
BIOS, Linux.
.
Linux:
1. .
<ENTER>;
2. .
linux text <ENTER>.
,
linux text <ENTER>.
10

2. Linux

-
, .
, .
<Skip> .

. <OK>.

,
.
2. Linux

11

.
.

,
.

,
. :
12

2. Linux

Remove all partitions on selected drives and create default layout


.
Remove linux partitions on selected drives and create default layout
linux
.
Use free space on selected drives and create default layout
.
Create custom layout .
.
<OK>.

,
. , (
) <Yes>.


. <Yes>
.
2. Linux

13

10

.
.
,
.
:
1. swap RAM,
1 , swap 2.
, .
2. ,
.

:

1. . /home
;
2. .

.

.
;
3. .
<OK>.

14

2. Linux

11

.
lilo GRUB.
Use GRUB Boot Loader <OK>.

12


. <OK>.

13

.
. <OK>.
2. Linux

15

14

,
. <OK>.

15

.
Master Boot Record <OK>.

16


. 99 % . <Yes>.
16

2. Linux

17

Activate on boot
. Enable IPv4 support, IPv6
. <OK>.

18


.
DHCP, ,
.

19

(Gateway), DNS-
(Primary DNS) DNS- (Secondary DNS).
2. Linux

17

20

hostname ( ).
DHCP, hostname
.

21

timezone ( ) <OK>.

22

root` ().
6.
18

2. Linux

23

.
, Desktop KDE
Server .
,
Customize software selection. ,
Linux .

24


install.log
<OK>.

2. Linux

19

25

<Reboot>.

26


. :
1. SELinux: Firewall Coniguration -> SELinux: Disabled
2. Firewall Coniguration -> Customize
iptables (Firewall).

system-conig-securitylevel.

<Exit> .
20

2. Linux

27

Linux !

2. Linux

21

3. Linux

1. BIOS irst stage boot loader (
);
2. irst stage boot loader
second stage boot loader ( ) /boot ;
3. second stage boot loader Linux ,

;
4. /sbin/init;
5. /sbin/init , user-space
/etc/fstab;
6. .

init
init ( , initialization )
. init ,
. init
, PID (ProcessID, )
1.
init:
1. SysV-style. init initdefault
/etc/inittab, runlevel .
runlevel ,
. SysVinit Red Hat CentOS.
2. BSD-style.
/etc/rc, getty (
get teletype),
. login
.
init runlevel , init
/etc/rc.
22

3. Linux

init, upstart Ubuntu Linux, init


Gentoo Linux.

login


login.
: login:
login:
1. init mingetty;
2. mingetty login;
3. shell;
4. init mingetty;
5. shell 1.

root.
,
.

3. Linux

23



-,
/. 6
(text-based) (X Window System).
Linux :
1. ( )
2. ( display managers)
.
.
Red Hat CentOS X
Window System Xorg.

Ctrl+Alt+F [16].
3 Ctrl+Alt+F3,
5 Ctrl+Alt+F5. .

Ctrl+Alt+F7

. ,
(/etc/inittab).


Linux ,
runlevels. C runlevels ,
.
,
.

,
.
,
init. runlevel 1 (single user
mode) , runlevel 3 .
24

3. Linux

Red Hat
:

Halt

Single-user text mode

Not used (user-deinable)

Full multi-user text mode

Not used (user-deinable)

Full multi-user graphical


mode (with an X-based
login screen)

Reboot

S s

Scripts

runlevel`, 3
5 .
runlevel
/etc/inittab :
id:5: initdefault:

id: runlevel.
,
.
SysVinit /etc/rc.d/
rc, rc.local, rc.sysinit rc.serial
, ,
.
init.d/rc0.d/rc1.d/rc2.d/rc3.d/rc4.d/rc5.d/rc6.d/

K ,
(Kill), S ,
3. Linux

25

(Start).
.
lrwxrwxrwx 1 root root 19 Sep 15 19:43 K35 vncserver ->../init.d/vncserver

lrwxrwxrwx 1 root root 19 Sep 15 19:38 S99 firstboot ->../init.d/firstboot


lrwxrwxrwx 1 root root 11 Sep 15 19:33 S99 local ->../rc.local
lrwxrwxrwx 1 root root 16 Sep 15 19:34 S99 smartd ->../init.d/smartd

init.d /sbin/init
.
.
runlevel :
[root@linuxbox ~]# who -r

[root@linuxbox ~]# runlevel


:
[root@linuxbox ~]# telinit

[root@linuxbox ~]# init

/etc/rc.d/rc.local /sbin/init
runlevel`.
/.
.
chkconig.
runlevels :
1. /sbin/chkconig ;
2. /usr/sbin/ntsysv ncurses (,
) ,
chkconig
runlevels;
26

3. Linux

3. system-conig-services Services Coniguration Tool,


. X Window.
runlevel .
GRUB a,
runlevel, ,
single mode :
grub append> ro root=/dev/VolGroup00/LogVol00 rhgb quiet 1

GRUB
,
(boot loader).


.
GRUB.
3 .
20/ 21 lilo,
.

GRUB (The GNU GRand Uniied Boot loader).
Microsoft Windows MBR,
.
, Microsoft Windows .
GRUB
/sbin/grub-install :
[root@linuxbox ~]#/sbin/grub-install /dev/hda

/dev/hda master IDE primary IDE .

GRUB
GRUB 3:
1. . .
, <Enter>
.
3. Linux

27

/ . e
c .
2. . e
GRUB. GRUB
( o
, O ,
e d ).
b .
<ESC>.
3. . c
GRUB. .
GRUB
<Enter>.
.

boot
chainloader </
//>
displaymem

initrd <///
initrd>

install <1><installdisk><2>pconig-ile
kernel <///
l><1><-N>

28



.
,
chainloader +1

BIOS .


RAM .
,

(,
ext3)
GRUB MBR. install
MBR

. <///
> ,
root. <-1>
, ,
root, , root=/dev/
VolGroup00/LogVol00.
,
3. Linux

root (<_
><_
>,
<>)
rootnoverify (<_
><_
>,
<>)
reboot


GRUB, :
root (hd0,0)

root,

helpall

GRUB
GRUB /boot/grub/grub.conf.
,
( title).
Linux
Microsoft Windows 2000 .
default=0
timeout=5
splashimage= (hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18128.el5)
root (hd0,0)
kernel/vmlinuz-2.6.18128.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd/initrd-2.6.18128.el5.img
title Windows
rootnoverify (hd0,0)
chainloader +1

Linux ,
5.
GRUB
3. Linux

29

Linux. GRUB
. , (hd0,0)/grub/
splash.xpm.gz /grub/ (hd0,0),
/boot/.

.

default=<>

<> title

timeout=<>

,
title,
default

splashimage=<__
>
GRUB
hiddenmenu

GRUB.
, timeout,

( default)

title <_
>

root (<_

><_ GRUB, :
>,<>)
root (hd0,0)
kernel <///
l><1><-N>

initrd <///initrd>

RAM .
,

(,
ext3)

rootnoverify (<_

><_ root,
>,<>)
30

3. Linux

chainloader <///
>

.
,
chainloader +1

password=<>


GRUB

color <_
><_>


. ,
:
color red/black green/blue

fallback=<>

<> title
, ,

GRUB
[root@linuxbox ~]# info grub

3. Linux

31

4.

.
().
.

/, root- (
/root,
root) .
.
, UNIX-like (slash) /
, Windows
(backslash) \

UNIX/Linux- ( Windows).
:
file.txt

32

4.


FILE.txt

,
.
255
1023.

Filesystem Hierarchy Standard


CentOS Filesystem Hierarchy Standard (FHS)
. ,
. Linux

. Filesystem Hierarchy Standard .

:

bin
boot
dev
etc
lib
media
mnt
opt
sbin
srv
tmp
usr
var
home
lib<qual>
root








(add-on`s)





()

()
root ()

:
1. (shareable unshareable);
4.

33

.
, .
2. .
, ,
.
,
.
.

static
variable

shareable
/usr
/opt
/var/mail
/var/spool/news

unshareable
/etc
/boot
/var/run
/var/lock


, .
,
read only read write,
.

ext3
ext3 .
ext3 Linux 2.4.16,
CentOS. ,
,
.
, .
,

.
ext3 ext2 :
1. ;
( unclean system shutdown)
ext2,
e2fsck .
ext3
34

4.

.
, ,
. ext3
.

.
2. ;
ext3 (
). ext3
.
.
3. ;
ext3 ext2.
4. .
ext2 ext3
,
tune2fs.
ext3 1
4.
ext3 :
1. writeback: ,
.
ext2.
2. ordered: , writeback,
.
.
3. journal: , . , .

mount, :
[root@linuxbox ~]# mount/dev/sda4/mnt/sda4-t ext3-o data=<>

4.

35

ext3
ext3 :
1. parted fdisk;
2. ext3 mkfs -t ext3;
3. e2label;
4. (
, mkdir);
5. /etc/fstab,
.

,
(). :
;
;
;
;
;
- ;
-
;
- , .

, ,
.
dumpe2fs,
:
[root@linuxbox ~]# dumpe2fs /dev/sda1 | grep superblock

36

4.

dumpe2fs 1.39 (29-May-2006)


Primary superblock at 1, Group descriptors at 2-2
Backup superblock at 8193, Group descriptors at 8194-8194
Backup superblock at 24577, Group descriptors at 24578-24578
Backup superblock at 40961, Group descriptors at 40962-40962
Backup superblock at 57345, Group descriptors at 57346-57346
Backup superblock at 73729, Group descriptors at 73730-73730

:
1. Rescue disk / Live CD ( CentOS ).
.
2. :
[root@linuxbox ~]# fsck -y -b 8193 /dev/sda1

3. .
sb, :
[root@linuxbox ~]# mount sb=8193 /dev/sda1 /mnt

, .
4. /etc/fstab sb (sb=8193)
(
).

Inode
,
inode (. Information
NODE ). Inode
. inode
40 (),
.
:
4.

37

;
;
(, , );
;
;
(ctime), (mtime)
(atime);
.
inode
, *nix ,
. ,
, .

ls -i ls l.


:
1. ;
.
.
, rm.
2. ;
.
, . ..,
. .
.. ..
mkdir, rm -rf ( ) rmdir
( ).
3. - () ;
- , , ,
, ,
. mknod,
38

4.

rm.
4. - () ;
- , ,
. mknod,
rm.
5. ;
,
, .
socket.
, rm
unlink.
6. (named pipe);
,
, .
mknod, rm.
7. .
,
.
.
,
: , .
,
, . .
,
,
.
ln, ( )
ln -s. unlink rm.


.
,
. 9 .
3 (SUID, SGID, Sticky) , . 12
.
chmod.
4.

39

SUID
SUID ( 4000) ,
, ,
. ?
.
passwd. passwd
/etc/passwd root.
(..
) passwd SUID.
s passwd , SUID.
[root@linuxbox ~]# ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 22984 Jan 6 2007 /usr/bin/passwd

SUID ( SUID + 775):


[root@linuxbox ~]# chmod 4775 file.txt
[root@linuxbox ~]# ls -l file.txt
-rwsrwxr-x 1 user user 0 Aug 2 22:00 file.txt

40

4.

SGID
SGID ( 2000) SUID,
.
SGID ,
,
. SGID
. , developers
/dir1
developers.
SGID
,
.
SGID ( SGID + 775):
[root@linuxbox ~]# mkdir /dir1
[root@linuxbox ~]# chmod 2775 /dir1
[root@linuxbox ~]# chown root:developers /dir1
[root@linuxbox ~]# ls -ld /dir1
drwxrwsr-x 2 root developers 4096 Oct 11 03:54 /dir1/

developers,
developers
developers.

Sticky
Sticky ( 1000)

, root.
. Sticky
/tmp .
.
80-90- . .
Sticky ( Sticky + 775):
[root@linuxbox ~]# chmod 1775 file.txt
[root@linuxbox ~]# ls -l file.txt
-rwxrwxr-t 1 user user 0 Aug 2 22:00 file.txt

4.

41


UNIX

. ,
.


mount umount .

mount

mount

.
.
, /etc/mtab
mount [] [] [_]
mount
mount
.
/dev/cdrom ( /dev/hdc)
_ ,

DVD- /mnt ( ):
[root@linuxbox ~]# mount -t iso9660 /dev/cdrom /mnt/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@linuxbox ~]# ls -Fl /mnt/
total 472
drwxr-xr-x 2 user user 407552 Mar 21 18:05 CentOS/

42

4.


drwxr-xr-x 4 root root
drwxr-xr-x 2 root root
drwxr-xr-x 2 root root

drwxr-xr-x 2 root root

2048 Mar 21 18:04 images/


2048 Mar 21 17:46 isolinux/
12288 Mar 17 04:30 NOTES/
2048 Mar 21 17:35 repodata/

( fdisk -l
):
[root@linuxbox ~]# mount -t ext3 /dev/hdb1 /mnt

-o loop ISO-:
[root@linuxbox ~]# mount -o loop -t iso9660 ~/dvddisk.iso /mnt/iso

-t ,
, :
Linux: ext3, reiserfs
CD/DVD: iso9660
(NFS): nfs
Windows: vfat, ntfs
SAMBA: smbfs/cifs
BSD- (FreeBSD, OpenBSD, NetBSD..., Solaris): ufs
mount:

-a
-r
-w
-t
-o

/etc/fstab
read
read/write

(
mount man mount)

umount
umount .
, /etc/mtab
.
4.

43

:
umount [] [] [_]
umount
umount

_

, :
[root@linuxbox ~]# umount /mnt

/dev/hdb1 (
mount -t ext3 /dev/hdb1 /mnt)
umount:

-n
-a
-f
-l

/etc/mtab
/etc/mtab

Lazy unmount.
,

mount/umount :
/etc/fstab, /etc/mtab, /etc/ilesystems

/etc/fstab

-a
mount. .
/etc/fstab. /etc/fstab
mount
.
6 ,
.
44

4.

:
[] [ ] [ ] [] [ dump] [ fsck]
:
/dev/hdb1

/mnt

ext3 defaults

00

/dev/hdb1
/mnt
ext3
defaults (rw, suid, dev, exec, auto, nouser async)
0 dump.
Linux, . .
0 fsck.
fsck -A
, . ,
.
, .
, .
, .

.

/etc/mtab
mount ,
/etc/mtab. umount
, .
.
/etc/mtab:
[root@linuxbox ~]# cat /etc/mtab
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0

4.

45

sysfs /sys sysfs rw 0 0


devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/hda1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/hdb1 /mnt ext3 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0

/etc/filesystems
, -t,
.
[root@linuxbox ~]# cat /etc/filesystems
ext3
ext2
nodev proc
nodev devpts
iso9660
vfat
hfs
hfsplus

/proc
/proc
. ,

. ,
. /proc
.
46

4.

:
/proc/cpuinfo - ( , , ,
..)
/proc/meminfo - RAM, ..
/proc/mounts -
/proc/devices -
/proc/ilesystems -
/proc/modules -
/proc/version -
/proc/cmdline - , .
cat,
:
[root@linuxbox ~]# cat /proc/cpuinfo
processor

:0

vendor_id

: GenuineIntel

cpu family

:6

model

: 15

model name

: Intel(R) Core(TM)2 Duo CPU

E6750 @ 2.66GHz

[ ]

,
:
[root@linuxbox ~]# hostname
localhost.localdomain
[root@linuxbox ~]# echo 'new-hostname' > /proc/sys/kernel/hostname
[root@linuxbox ~]# hostname
new-hostname

4.

47

/proc
. /proc ,
.
hostname /etc/sysconig/network

: , , ,

:
1. . CentOS 1
vi/vim.
2. echo ( cat):
ile.txt text:
[root@linuxbox ~]# echo 'text' > file.txt

C ile.txt text.
.
.
, :
[root@linuxbox ~]# echo 'text' >> file.txt

text ile.txt
.
.
3. cp:
[root@linuxbox ~]# cp file.txt myfiles/file2.txt

cp ,
.
4. touch :
[root@linuxbox ~]# touch file.txt

48

4.

:
1. . CentOS 1
vi/vim.
2. cat:
[root@linuxbox ~]# cat file.txt
text

.
.
3. / less.
.
less more. less .
4. head 10 .
-n . :
[root@linuxbox ~]# head -n 20 /etc/login.defs

5. tail 10 .
-n . :
[root@linuxbox ~]# tail -n 20 /etc/login.defs

6. nl ()
. :
[root@linuxbox ~]# nl /etc/login.defs
1 # *REQUIRED*
2 # Directory where mailboxes reside, _or_ name of file, relative to the
3 # home directory. If you _do_ define both, MAIL_DIR takes precedence.
4 # QMAIL_DIR is for Qmail
5 #
6 #QMAIL_DIR
7 MAIL_DIR

Maildir
/var/spool/mail

4.

49

8 #MAIL_FILE

.mail

[ ]

. Linux
vi/vim, : emacs, nano, ee
mc.
rm.

: , , ,
mkdir, :
[root@linuxbox ~]# mkdir /files

-p ,
.
[root@linuxbox ~]# mkdir -p /files/documents/fromwork

fromwork documents /
iles/documents, .
ls, :
[root@linuxbox ~]# ls -l /root
total 64
-rw-------

1 root root

1119

Jul 28 02:21

anaconda-ks.cfg

-rw-r--r--

1 user user

Aug 5 03:34

ile.txt

-rw-r--r--

1 root root

30116

Jul 28 02:21

install.log

-rw-r--r--

1 root root

4286

Jul 28 02:19

install.log.syslog

drwxr-xr-x

2 root root

4096

Aug 5 01:17

tes

mv, :
[root@linuxbox ~]# mv tes tes2

50

4.

,
.
.
rm -rf ( ) rmdir
( ).
[root@linuxbox ~]# rm -rf /root/tes2

, , ,
rmdir:
[root@linuxbox ~]# rmdir /root/tes2

ls:
ls (
) .
: ls [] []
ls:
[root@linuxbox ~]# ls
anaconda-ks.cfg dir file.txt install.log install.log.syslog

ls
,
.
:
[root@linuxbox ~]# ls -l /root
total 60
-rw-------

1 root root

1119

Jul 28 02:21 anaconda-ks.cfg

drwxr-xr-x

3 user user

4096

Aug 3 20:08 dir

-rwxrwxr-x

1 user user

Aug 2 21:59 file.txt

-rwxrwxr-x

1 root root

30116

Jul 28 02:21 install.log

4.

51

-rw-r--r--

1 root root

4286

Jul 28 02:19

install.log.syslog

. ,
.
.
. .
. .
.
. -a:
[root@linuxbox ~]# ls -la /root
total 148
drwxr-x--- 5 root root

4096 Aug 3 20:08 .

drwxr-xr-x 23 root root

4096 Aug 4 18:02 ..

-rw-------

1 root root

1119

-rw-------

1 root root

-rw-r--r--

1 root root

-rw-r--r--

Jul 28 02:21
1 23:34

.bash_history

Jan

6 2007

.bash_logout

1 root root

191 Jan

6 2007

.bash_profile

-rw-r--r--

1 root root

176

Jan

6 2007

.bashrc

-rw-r--r--

1 root root

100

Jan

6 2007

.cshrc

3 20:08

dir

drwxr-xr-x 3 user user

555 Aug

anaconda-ks.cfg

24

4096 Aug

. ...
. ..
. .
ls:

-a
, ( )
human readable format,
-h
( )
-i
inode
-l

-R
.
52

4.

ls:


()

()

b
s
p
l

, cp .
mkdir

rmdir, rm -r

mknod

rm

mknod

rm

socket(2)
mknod
ln -s

rm
rm
rm

rm

ile ls -l, :
[root@linuxbox ~]# file /dev/sda
/dev/sda: block special (8/0)
[root@linuxbox ~]# ls -l /dev/sda
brw-r----- 1 root disk 8, 0 Oct 11 00:53 /dev/sda

cd:
cd (change directory) .
( ).
,
, .
:
[root@linuxbox ~]# cd /usr/share/doc/

. ,
/usr/share/yum-cli/ /usr/
share/doc/

4.

53

[root@linuxbox ~]# cd ../doc/

~ .
/root.
, :
[root@linuxbox ~]# cd ~/myfiles/docs/

: cd /root/myiles/docs/

pwd:
pwd (print working directory)
.
: pwd []
[root@linuxbox ~]# pwd
/root

cat:
cat
.
-, cat .
: cat [] []...
ile.txt (
-n )
[root@linuxbox ~]# cat file.txt

ile1.txt ile2.txt ile3.txt


[root@linuxbox ~]# cat file1.txt file2.txt > file3.txt

ile1.txt ile2.txt
[root@linuxbox ~]# cat file1.txt >> file2.txt

54

4.

ile.txt :
[root@linuxbox ~]# cat - >> file.txt
< >
< Enter>
< Ctrl+C>

grep:
grep
.
: grep [] [...]
grep /etc/resolv.conf
nameserver .
[root@linuxbox ~]# grep nameserver /etc/resolv.conf
nameserver 192.168.79.2
[root@linuxbox ~]#

grep .
[root@linuxbox ~]# rpm -qa | grep chk
chkconfig-1.3.30.1-2
chkfontpath-1.10.1-1.1
[root@linuxbox ~]#

chmod:
chmod (change mode) ,
.
: chmod [] []
, 9 .
4.

55

: ,
. :
, . r (. read),
w (. write) x (. executable).
,
:

r
w
x


4
2
1

chmod
,
.
, ls -l
[root@linuxbox ~]# ls -l file.txt
-rwxrwxr-x 1 user user 0 Aug 2 22:00 file.txt

ile.txt :
-rwxrwxr-x

3 :

. -,
.
( 3 ): rwx, .
(read, write, executable)
: rwx, .
user
(read, write, executable).
: r-x, .
( user, user
root) (read,
executable).
56

4.

, , :
[root@linuxbox ~]# chmod 775 file.txt


, .
, 4, 2, 1.

chmod? . .
4,
4+1 = 5,
4+2+1 = 7.
, :

, , .
-rwxr-x--- 750
, .

, .
-rw------- 600
.

, , .
-rwxr-xr-x 755
, .
,
SUID. , ,
. ,
-rwsr-xr-x 4755
.
,
chmod:

-v
-R

chown:
chown / .
,
4.

57

, .
.
: chown [] []:[]
ile.txt user2:
[root@linuxbox ~]# chown user2 file.txt

ile.txt user2 group2


:
[root@linuxbox ~]# chown user2:group2 file.txt

/dir
user2 group2 :
[root@linuxbox ~]# chown -R user2:group2 /dir

ile.txt group2:
[root@linuxbox ~]# chown :group2 file.txt

chown:

-v

chown

-R
.

umask:

umask
. umask 777 ,
666 , . :
[root@linuxbox ~]# umask 022

, 755 (rwxr-xr-x)
644 (rw-r--r--). umask.
58

4.

umask
0
1
2
3
4
5
6
7


rwx
rwr-x
r--wx
-w--x
---

umask = 022,
rwxr-xr-x rw-r--r- umask :
[root@linuxbox ~]# umask
0022

umask
~/.bash_proile ,
: umask 077.

mkdir:
mkdir (make directory) .
: mkdir []
, mkdir
, :
[root@linuxbox ~]# mkdir testdir

mkdir . -m
, :
[root@linuxbox ~]# mkdir -m 700 testdir

-p ,
,
:
[root@linuxbox ~]# mkdir -p /root/documents/fromwork

4.

59

rmdir:
rmdir .
: rmdir []
.
:
[root@linuxbox ~]# rmdir ~/emptydir

rm -rf

rm:
rm .
.
: rm []
.
-r .
-f
.
:
[root@linuxbox ~]# rm -f badfile.txt

badiles root
.
[root@linuxbox ~]# rm -rf ~/badfiles/

cp:
cp (copy) .
: cp [] [] [_]

.
60

4.

ile.txt /home/user/
[root@linuxbox ~]# cp file.txt /home/user/
cp: overwrite `/home/user/file.txt'? y

myiles /home/user/
[root@linuxbox ~]# cp -R myfiles/ /home/user/

myiles /home/user
[root@linuxbox ~]# cp -R myfiles/* /home/user/

mv:
mv .
: mv [] [] [_]

.
ile.txt /home/user/
[root@linuxbox ~]# mv file.txt /home/user/

mydir newdir
[root@linuxbox ~]# mv mydir/ /home/user/newdir

ln:
ln .
: . ,

.
.
, :
, . ,
,
. .
4.

61

, ,

.
: ln [] [] [_]
ln -s.
linktotestile testile.txt:
[root@linuxbox ~]# ln -s testfile.txt linktotestfile

unlink:
[root@linuxbox ~]# unlink linktotestfile

ln .
ile.txt
[root@linuxbox ~]# ln file.txt file2.txt

inode .
[root@linuxbox ~]# ls -li
786434 -rw-r--r-- 2 root root 0 Aug 7 21:20 file2.txt
786434 -rw-r--r-- 2 root root 0 Aug 7 21:20 file.txt

touch:
touch .
(atime, -a) (mtime,
-m). .
: touch []
:
[root@linuxbox ~]# touch ~/file.txt

df:
df
62

4.

.
.
: df [] []
:
[root@linuxbox ~]# df -h
Filesystem

Size Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00
7.2G 2.5G 4.3G

37% /

/dev/hda1

99M 12M 82M 13% /boot

tmpfs

125M

0 125M

0% /dev/shm

-h
(, ..)

du:
du
. -h
(, ..) -s

.
: du [] []
/usr/share/
[root@linuxbox ~]# du -sh /usr/share/
1.4G /usr/share/

echo:
echo .
: echo [] []
4.

63

:
[root@linuxbox ~]# echo 'blablabla'
blablabla
[root@linuxbox ~]#

C -n :
[root@linuxbox ~]# echo -n 'blablabla'
blablabla[root@linuxbox ~]#

echo .
ile.txt:
[root@linuxbox ~]# echo 'blablabla' > file.txt

wc: ,
wc ,
.
: wc [] []
-c
-m
-l
-L
-w
:
[root@linuxbox ~]# wc -l /etc/login.defs
58 /etc/login.defs

64

4.

head:
head
. 10 .
-n .
: head [] []
20 /etc/login.defs:
[root@linuxbox ~]# head -n 20 /etc/login.defs

tail:
tail
. 10 .
-n .
: tail [] []
20 /etc/login.defs:
[root@linuxbox ~]# tail -n 20 /etc/login.defs

less:
less , , , Page Up-Page Down.
more .
: less
:
[root@linuxbox ~]# less /etc/login.defs

q
:
[root@linuxbox ~]# less --help

4.

65

find:
ind .
:
ind [_] [_] [] [_]
ind

-name

-type

-type f
-type d
-type b
-type c
-type p
-type l
-type s
-size
.
-size +1024 1024*512
-mtime

-ctime

-atime

-print

-exec

ind
passwd.
. ,
-print .
[root@linuxbox ~]# find / -name passwd
/etc/pam.d/passwd
/etc/passwd
/usr/bin/passwd
/usr/share/doc/nss_ldap-253/pam.d/passwd
[root@linuxbox ~]#

66

4.

( ind
shell). syslogd
[root@linuxbox ~]# find / -name syslogd*
/selinux/booleans/syslogd_disable_trans
/var/run/syslogd.pid
/usr/share/man/man8/syslogd.8.gz
/usr/share/logwatch/default.conf/services/syslogd.conf
/usr/share/logwatch/scripts/services/syslogd
/sbin/syslogd
[root@linuxbox ~]#

.
-type d. pam.
[root@linuxbox ~]# find / -name pam -type d
/usr/share/locale/pam
[root@linuxbox ~]#

. ind
. core
/tmp rm. xargs
.
[root@linuxbox ~]# find /tmp -name core -type f -print | xargs /bin/rm -f

. /etc/
777.
[root@linuxbox ~]# find /etc/ -perm 777 -type f
/etc/badfile
[root@linuxbox ~]#

root badile.
[root@linuxbox ~]# find ~/ -name badfile -exec rm -f {} \;

4.

67


/dev/random /dev/urandom
.

(entropy pool).
.
/dev/null .
.
.
[root@linuxbox ~]# > /dev/null 2>&1

/dev/zero .
.
[root@linuxbox ~]# dd if=/dev/zero of=file.iso bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.00673231 seconds, 156 MB/s
[root@linuxbox ~]# ls -lh
total 1.1M
-rw-r--r-- 1 root root 1.0M Sep 16 17:34 file.iso
[root@linuxbox ~]#

68

4.

5.
BASH
Linux
.

, . 6
1 .

getty ( get teletype). CentOS
getty mingetty.
[root@linuxbox ~]# ps aux | grep mingetty
root

2806 0.0 0.1 1656 432 tty1

Ss+ 03:44 0:00 /sbin/mingetty tty1

root

2807 0.0 0.1 1656 436 tty2

Ss+ 03:44 0:00 /sbin/mingetty tty2

root

2808 0.0 0.1 1656 436 tty3

Ss+ 03:44 0:00 /sbin/mingetty tty3

root

2809 0.0 0.1 1656 436 tty4

Ss+ 03:44 0:00 /sbin/mingetty tty4

root

2810 0.0 0.1 1656 436 tty5

Ss+ 03:44 0:00 /sbin/mingetty tty5

root 17903 0.0 0.2 3912 668 pts/0 R+ 04:13 0:00 grep mingetty

,
login, .

Ctrl+Alt+[F1-F6].
ttyN, N .
Ctrl+Alt+F7.

Ctrl+Alt+[F1-F6].


/
.
. :

5. BASH

69

, ,
.
, ssh-,
.

.
<Enter>.
.
[root@linuxbox ~]# whoami
root
[root@linuxbox ~]#

whoami ,

. .
.
[root@linuxbox ~]# cat
text1 <Enter>
text1
text2 <Enter>
text2
[Ctrl+C Ctrl+D]

[root@linuxbox ~]#

cat
()
(). [Enter] cat

. text1 text2
.
Ctrl+C Ctrl+D.
, .
( GNU Readline Library)
.
70

5. BASH

CTRL- ( Ctrl,
^):
Ctrl + a
Ctrl + b
Ctrl + c ( SIGINT)
Ctrl + d .
,
Ctrl + e
Ctrl + f
Ctrl + g
Ctrl + h ( backspace)
Ctrl + i Tab
Ctrl + j
Ctrl + k
Ctrl + l
Ctrl + m Enter
Ctrl + n
Ctrl + p
Ctrl + q
Ctrl + r
Ctrl + s
Ctrl + t
Ctrl + u
Ctrl + v
(Ctrl+D ^D, Ctrl + c ^C ..)
Crtl + w
Ctrl + x
Ctrl + y Ctrl + K
Ctrl + z

Alt-
Alt + <
Alt + >
Alt + ?
Alt + *
Alt + / (
)
Alt + .
Alt + b
Alt + c ( )
5. BASH

71

Alt + d
Alt + f
Alt + l

Alt + n [Enter]
Alt + p
Alt + r
Alt + t
Alt + u

Alt + BackSpace

Tab-
2T Tab
2T
net<2T> net
/2T . ./2
*2T ,
~2T , /etc/passwd
~uT , /etc/passwd, u
$2T
@2T /etc/hosts
=2T ls dir
Esc-
Esc + d
Esc + f
Esc + b
Esc + t ( )

!!
!com , com
!a:p , a
!n n-
!$
!^
^abc^xyz abc xyz
: man readline, man bash
72

5. BASH

BASH

().
bash.
shell.


, shell .
,
.

.
.
#
$
:
[user@linuxbox root]$

:
[root@linuxbox ~]#

Bash
[root@linuxbox ~]# echo $BASH_VERSION
3.00.15(1)-release

[root@linuxbox ~]# echo $BASH


/bin/bash


bash :
5. BASH

73

< > <> <()>


:
ls -la /usr
ls , -la (- ,
, l a), /usr .
,
.
.



source ., :
[root@linuxbox ~]#./myscript.sh


$PATH .
echo.
[root@linuxbox ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


, bash
. .
,
.
.
:
.bash_logout .
- .
.bash_history ,
.
74

5. BASH

.bash_proile .
.bash_login
.bashrc
shell. shell. X
Window .
:
/etc/proile
/etc/bashrc
.
/etc/proile ~/.bash_proile
.
bash
.
env, typeset.
.


,
history.
$HISTSIZE 1000.
[root@linuxbox ~]# echo $HISTSIZE
1000
[root@linuxbox ~]#


.
[root@linuxbox ~]# history 5
642 netstat -nr
643 echo $HISTSIZE
644 cat /etc/resolv.conf
645 env

5. BASH

75

646 history 5
[root@linuxbox ~]#

, ~/.bash_history
,
.
history

history N

history -d N

N, ,

!!

!N

!string

,
string

/

.
3
:

stdin

stdout

stderr


,
.
,
.


. stdout.

stdin stdout . stderr


. stderr
. stdout
.
.
76

5. BASH

[root@linuxbox ~]# ls ~

file1 file2

[root@linuxbox ~]# cat file1 file3

[ ]
cat: file3: No such file or directory

[root@linuxbox ~]#

1: ;
2: ile1 ile2;
3: cat stdout;
4: ile1
, ile3 , 2 ;
5: stdout ,
.
. ,
stderr 2.
[root@linuxbox ~]# cat file1 file3 2> err_file
[ ]
[root@linuxbox ~]#

5. BASH

77

ile1
, err_ile
[root@linuxbox ~]# cat err_file
cat: file3: No such file or directory
[root@linuxbox ~]#


. 24
.
( ),
.

stdout

stdout
stderr
stdout stderr
stdout
stdout stderr
stderr
stdout stderr

stderr

stderr
stdout
( )
, :
[root@linuxbox ~]# date > date.txt

date.txt
.
>>:
[root@linuxbox ~]# ls -l >> file.txt

<, :
[root@linuxbox ~]# vi <(ls /etc/)

,
, :
[root@linuxbox ~]# echo -e `ls -l /etc/[^a-w]*.conf`\n

78

5. BASH

-rw-r--r-- 1 root root 585 Jan 21 2009 /etc/yp.conf


-rw-r--r-- 1 root root 333 Jan 22 2009 /etc/yum.conf

[root@linuxbox ~]#

,
,
|. .
[root@linuxbox ~]# ls /usr/share/ | wc -l
191
[root@linuxbox ~]#

ls ,
,
, wc -l,
.
ls,
.
,
.
, ,
.
,
, .

Builtin-
bash builtin-,
.
. bash
3.2.25 58 . enable.
[root@linuxbox ~]# enable

5. BASH

79

enable .
enable :
enable [
enable alias
enable bg
enable bind
enable break
enable builtin
enable caller
...
[ ]

builtin-
builtin- , $PATH,

.
.
[root@linuxbox ~]# pwd --help
bash: pwd: --: invalid option
pwd: usage: pwd [-LP]
[root@linuxbox ~]# /bin/pwd --help
Usage: /bin/pwd [OPTION]
Print the full filename of the current working directory.

--help display this help and exit


--version output version information and exit

NOTE: your shell may have its own version of pwd, which usually supersedes

80

5. BASH

the version described here. Please refer to your shell's documentation


for details about the options it supports.

Report bugs to <bug-coreutils@gnu.org>.

, ?
. builtin- bash,
GNU. builtin .
[root@linuxbox ~]# enable -n pwd
[root@linuxbox ~]# pwd --help
Usage: pwd [OPTION]
Print the full filename of the current working directory.
...
[ ]

. .
pwd bash, .
[root@linuxbox ~]# enable pwd

:
enable .
enable -a ( )
enable -n
enable -n <builtin->
enable <builtin->


bash :
--> -->
5. BASH

81



.
.
, :
[root@linuxbox ~]# value=10


.
. export.
[root@linuxbox ~]# export value=10

unset.
[root@linuxbox ~]# unset value

env. ,
typeset ( declare)
, .
, :
[root@linuxbox ~]# export value=10

.
#!/bin/bash

echo $value
[root@linuxbox ~]# chmod 755 test.sh
[root@linuxbox ~]#./test.sh
10
[root@linuxbox ~]#

82

5. BASH

.
[root@linuxbox ~]# unset value
[root@linuxbox ~]# value=10
[root@linuxbox ~]# echo $value
10
[root@linuxbox ~]#./test.sh

[root@linuxbox ~]#

,
. shell

.
.
.

HOSTNAME

SHELL

USER

PATH

.


PWD

HOME

UID


.
,

.

5. BASH

83

.
- .
,
, .
Bash $0 , $1
$2 , 10-
{}, ${10}.
test.sh:
#!/bin/bash
echo - $0
echo - $1
echo - $2

:
[root@linuxbox ~]#./test.sh start stop
./test.sh
- start
- stop

$#

$* ,

$@ $*,
,
$-
$! PID
$_
$? - ,
$$ PID
84

5. BASH

$PS1
$PS2 ,
. >
$PS3
select
$PS4 ,
-x. +



,
.
*
?
[] .
. ^ ,
.

/etc host
[root@linuxbox ~]# ls -l /etc/host*
-rw-r--r-- 1 root root 17 Jul

23

2000

/etc/host.conf

-rw-r--r-- 1 root root 187 Jul

28

02:10

/etc/hosts

-rw-r--r-- 1 root root 161 Jan

13

2000

/etc/hosts.allow

-rw-r--r-- 1 root root 347 Jan

13

2000

/etc/hosts.deny

[root@linuxbox ~]#

/etc a-w
.conf
[root@linuxbox ~]# ls -l /etc/[^a-w]*.conf
-rw-r--r-- 1 root root

585

Jan

21

2009

/etc/yp.conf

5. BASH

85

-rw-r--r-- 1 root root

333

Jan

22

2009

/etc/yum.conf

[root@linuxbox ~]#

/etc 7
.conf
[root@linuxbox ~]# ls -l /etc/???????.conf
-rw-r--r-- 1 root root 18484

Feb

28

02:00

/etc/dnsmasq.conf

-rw-r--r-- 1 root root

658

Mar

02:55

/etc/initlog.conf

-rw-r--r-- 1 root root

2506

May

25

2008

/etc/libuser.conf

-rw-r--r-- 1 root root

4453

May

24

2008

/etc/oddjobd.conf

-rw-r--r-- 1 root root

12

Jan

2007

/etc/pam_smb.conf

-rw-r--r-- 1 root root

973

Sep 1

2008

/etc/prelink.conf

,
( ).
. :
| & ; ( ) < >
,
.
(\), ,

.
.
| . ,
.
(()),
, .
< > .
/etc/host.conf
ile.txt
86

5. BASH

[root@linuxbox ~]# cat /etc/host.conf > file.txt

vi /etc
[root@linuxbox ~]# vi <(ls /etc/)

;
. 2
1.
1; 2
& .
&, , ,
,
.
1& 2
&& . 2
, 1
.
1 && 2
|| . 2
, 1 .
1 || 2


/,
~ (
$HOME).


= , $
.
echo ESC-
5. BASH

87

echo , :
[root@linuxbox ~]# echo just text
just text
[root@linuxbox ~]#

, echo ESC-.
-e, :
[root@linuxbox ~]# echo -e just text\n\n
just text

[root@linuxbox ~]#

\n ,
( ). ESC- .
\a
\b
\c
\f
\n
\r
\t




( )


-n echo
.
[root@linuxbox ~]# echo -n just text
just text[root@linuxbox ~]#

88

5. BASH

6.

Linux. ,
.
.
.
root.
Linux user private group (UPG)
.
.

.
32-
UID (user ID) GID (group ID). UID
500 ( 500 )
60000. /etc/login.defs
Linux :
1. , root. UID
0. , root
/root
2. . UID 500
/home/< >
Linux . /etc/
passwd .
,
/etc/shadow MD5 .
/etc/group, /etc/gshadow. ,

,
. shell (7- /etc/
passwd) /sbin/nologin.

/etc/passwd
.
6.

89

, .
7 :.
login:password:UID:GID:GECOS:home:shell

1. ;
2. x , shadow-
;
3. UID;
4. GID;
5. GECOS ( , , ..);
6. ;
7. .
.
/etc/shadow

/etc/shadow
.
MD5-. MD5- $1$

1. ;
2. . 8
.;

90

6.

3. . 1- 1970 ;
4. ;
5. (
);
6. ,
;
7.
. ;
8. Expire. ,
. .

/etc/group
.

1. ;
2. . , .
x;
3. (GID);
4. .

/etc/gshadow
.

1. ;
6.

91

2. ;
3. ;
4. .
.

/sbin/nologin
- .

.


.
.
useradd, usermod, userdel ,
.
groupadd, groupmod, groupdel ,
.
gpasswd /etc/group
pwck, grpck /etc/passwd /etc/
group

92

6.

/etc/login.defs
#
MAIL_DIR

/var/spool/mail

# Password aging controls:


#
# PASS_MAX_DAYS
#

# PASS_MIN_DAYS
#

# PASS_MIN_LEN
# PASS_WARN_AGE
#

PASS_MAX_DAYS
PASS_MIN_DAYS
PASS_MIN_LEN
PASS_WARN_AGE

99999
0
5
7

# UID
# useradd
UID_MIN
UID_MAX

600
60000

# GID
# groupadd
GID_MIN
GID_MAX

600
60000

#
# ,
#
#USERDEL_CMD /usr/sbin/userdel_local
# useradd
# . -m
# useradd
CREATE_HOME

yes

# umask. 022.
UMASK

022

# userdel
#
USERGROUPS_ENAB yes
# : MD5 DES? CentOS
# MD5.
MD5_CRYPT_ENAB yes

6.

93

useradd:
useradd .
: useradd []
:
[root@linuxbox ~]# useradd user3

.
passwd:
[root@linuxbox ~]# passwd user3
Changing password for user user3.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@linuxbox ~]#

useradd:

-c <> .

-d<home-dir>
(
/home/)
-e<date>
, ,
YYYY-MM-DD
-f<days>

, .
0
.
-1 ,

-g<group-name>
GID.
.
-G<group-list>

.

94

6.

-m
-M
-n
-r
-p<password>
-s
-u<uid>

UID 500

crypt
shell ( /bin/
bash)
UID .
499

usermod:
.
: usermod []
shell /bin/bash /bin/tcsh
[root@linuxbox ~]# usermod -s /bin/tcsh user3

-d

-s

shell

-p

-g

-G

userdel:
userdel .
: userdel []
[root@linuxbox ~]# userdel user3

6.

95

-f

-r


.

(mail spool) .


.
,
,

groupadd:
groupadd .
: groupadd []
:
[root@linuxbox ~]# groupadd newgroup

groupadd:

-g<gid>

Group ID .
499
-r
GID 499
-f
GID -g

GID
-o
GID
-K KEY=VALUE
/etc/login.defs (GID_MIN, GID_MAX ..)

groupmod:
GID .
: groupmod []
justgroup newgroup GID 501 510:
96

6.

[root@linuxbox ~]# cat /etc/group

justgroup:x:501:
[root@linuxbox ~]# groupmod -g 510 -n newgroup justgroup
[root@linuxbox ~]# cat /etc/group

newgroup:x:510:
[root@linuxbox ~]#

groupmod:

-g

group ID.
-o.

-n new_group_name

groupdel:
groupdel .
.
: groupdel
[root@linuxbox ~]# groupdel justgroup

gpasswd: /etc/group /etc/gshadow


gpasswd /etc/group /etc/gshadow.
, .
: gpasswd []

-a

6.

97

-d
-R
-r
-A
-M



newgrp



[root@linuxbox ~]# gpasswd newgroup

user user2
[root@linuxbox ~]# gpasswd -a user user2
Adding user user to group user2
[root@linuxbox ~]# cat /etc/group

user:x:500:
user2:x:501:user
[root@linuxbox ~]#

pwck:
pwck /etc/passwd /etc/shadow
.
: pwck [] [passwd shadow]
:
[root@linuxbox ~]# pwck
user adm: directory /var/adm does not exist
user news: directory /etc/news does not exist

98

6.

user uucp: directory /var/spool/uucp does not exist


user gopher: directory /var/gopher does not exist
user user2: program /bin/bash1 does not exist
pwck: no changes
[root@linuxbox ~]#

pwck:

-q

-r
pwck read-only
-s
/etc/passwd /etc/shadow

grpck:
grpck /etc/group /etc/gshadow
.
: grpck [-r] [group shadow]
:
[root@linuxbox ~]# grpck
user2 is a member of the user group in /etc/gshadow but not in /etc/group
user is a member of the user2 group in /etc/gshadow but not in /etc/group
[root@linuxbox ~]#

,
.
-r read-only,
, .


passwd.

.
6.

99

: passwd []
[root@linuxbox ~]# passwd user2
Changing password for user user2.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@linuxbox ~]#


:
[root@linuxbox ~]# passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


.

passwd.

, root .

100

6.

7.
,
,
-.
, .
,
(process ID, PID).
ps:
[root@linuxbox ~]# ps -ef
UID

PID

PPID

C STIME TTY

TIME

root

root

CMD

0 16:19

00:00:01 init [3]

0 16:19

00:00:00 [migration/0]

root

0 16:19

00:00:00 [ksoftirqd/0]

root

0 16:19

00:00:02 [watchdog/0]

root

0 16:19

00:00:00 [events/0]

root

0 16:19

00:00:00 [khelper]

PID
.
:

(PID)

.
,
.
.

(PPID)
*nix ,
.
7.

101

, .
, .
PID PPID
, . init
.

(UID)
UID (User ID) ,
, EUID .

(EUID)
EUID .

.
UID EUID (
,
SUID).
.

(GID)
GID .

(EGID)
EGID GID EUID UID.



. ,
.
.
nice

. nice .


.
102

7.

1. ;
2. ;
3. ;
4. .
,
.


( , ..)

.
,
, , .

. .


init
fork ( init ).
fork .


(). PPID PID .
fork
exec*.
_exit()
. _exit()

. ,
.

wait.
.

.

. .

wait
-.
7.

103

, wait
- init,
wait.

.
.
:
-
;
-
Ctrl+C Ctrl+Z;
- kill;
-
.
C SIG, SIGHUP,
kill HUP, kill
-HUP [PID]
Linux kill -l:
[root@linuxbox ~]# kill -l

1) SIGHUP
5) SIGTRAP
9) SIGKILL
13) SIGPIPE
17) SIGCHLD
21) SIGTTIN
25) SIGXFSZ
29) SIGIO
35) SIGRTMIN+1
39) SIGRTMIN+5
43) SIGRTMIN+9
47) SIGRTMIN+13
51) SIGRTMAX-13
55) SIGRTMAX-9
59) SIGRTMAX-5
63) SIGRTMAX-1

2) SIGINT
6) SIGABRT
10) SIGUSR1
14) SIGALRM
18) SIGCONT
22) SIGTTOU
26) SIGVTALRM
30) SIGPWR
36) SIGRTMIN+2
40) SIGRTMIN+6
44) SIGRTMIN+10
48) SIGRTMIN+14
52) SIGRTMAX-12
56) SIGRTMAX-8
60) SIGRTMAX-4
64) SIGRTMAX

3) SIGQUIT
7) SIGBUS
11) SIGSEGV
15) SIGTERM
19) SIGSTOP
23) SIGURG
27) SIGPROF
31) SIGSYS
37) SIGRTMIN+3
41) SIGRTMIN+7
45) SIGRTMIN+11
49) SIGRTMIN+15
53) SIGRTMAX-11
57) SIGRTMAX-7
61) SIGRTMAX-3

4) SIGILL
8) SIGFPE
12) SIGUSR2
16) SIGSTKFLT
20) SIGTSTP
24) SIGXCPU
28) SIGWINCH
34) SIGRTMIN
38) SIGRTMIN+4
42) SIGRTMIN+8
46) SIGRTMIN+12
50) SIGRTMAX-14
54) SIGRTMAX-10
58) SIGRTMAX-6
62) SIGRTMAX-2

[root@linuxbox ~]#

104

7.


:
.
. ,
.
,
.

.
. SIGKILL (
kill -9 [PID]) SIGSTOP.

(: man 7 signal), .

SIGHUP

SIGINT
SIGQUIT
SIGKILL
SIGTERM

SIGCONT
SIGSTOP
SIGTSTP


1

.
,

( ).
2
.
CTRL+C
3

quit
9
.
.
15
.

.
18

SIGSTOP
19
.

20
.
CTRL+Z

kill:
kill .
: kill [] [PID]
7.

105


. PID ,
ps.

kill.
loop.sh:
#!/bin/bash
while true; do true; done

loop.sh
[root@linuxbox ~]# chmod +x loop.sh

loop.sh ,
.
[root@linuxbox ~]#./loop.sh &
[1] 3444
[root@linuxbox ~]#

PID 3444.
[root@linuxbox ~]# ps -f
UID

PID PPID C STIME TTY

TIME CMD

root

3068 3066 0

20:40 pts/0 00:00:00 -bash

root

3444 3068 96

22:16 pts/0 00:01:10 /bin/bash ./loop.sh

root

3471 3068 0

22:17 pts/0 00:00:00 ps -f

[root@linuxbox ~]#

,
, .
[root@linuxbox ~]# kill 3444
[root@linuxbox ~]# ps -f
UID

PID PPID C STIME TTY

root

3068 3066 0 20:40 pts/0

106

TIME CMD
00:00:00 -bash

7.

root

3478 3068 0 22:20 pts/0

[1]+ Terminated

00:00:00 ps -f

./loop.sh

kill
TERM (SIGTERM) .

killall:
: killall [] [_]
killall .
SIGTERM
.
killall -l:
[root@linuxbox ~]# killall -l
HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM
TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM
PROF WINCH IO PWR SYS UNUSED
[root@linuxbox ~]#

process1.
[root@linuxbox ~]# killall process1

. nice renice
nice ( )

. nice, .
-20 ( )
19 ( )
. : nice
renice. nice
. renice
. .
nice .
[root@linuxbox ~]#./loop.sh &

7.

107

[1] 4379
[root@linuxbox ~]# ps -C loop.sh -o ni=
0
[root@linuxbox ~]#

,
, 15 (
19). .
[root@linuxbox ~]# nice -n 15 ./loop.sh &
[1] 4347
[root@linuxbox ~]# ps -C loop.sh -o ni=
15
[root@linuxbox ~]#

,
renice.
PID .
[root@linuxbox ~]# ps -C loop.sh -o pid=
4379
[root@linuxbox ~]# renice -10 4379
4379: old priority 0, new priority -10
[root@linuxbox ~]# ps -C loop.sh -o ni=
-10
[root@linuxbox ~]#

80-90-
,
-.

fg, bg jobs:

108

7.

(job control),
.
fg, bg jobs bash (shell builtins).
:
bg [ ]
fg [ ]
fg (foreground) , bg
(background) ,
jobs .
,
PID,
1. 2 ..
, ,
loop.sh
[root@linuxbox ~]#./loop.sh

loop.sh
, .

. CTRL+Z
STOP .
[root@linuxbox ~]#./loop.sh

[1]+ Stopped

./loop.sh

[root@linuxbox ~]#

jobs .
[root@linuxbox ~]# jobs
[1]+ Stopped

./loop.sh

[root@linuxbox ~]#

loop.sh ,
.
7.

109

[root@linuxbox ~]# ps -C loop.sh -o stat=


T
[root@linuxbox ~]#

T STAT , ( ps
).
bg,
.
.
[root@linuxbox ~]# jobs
[1]+ Stopped

./loop.sh

[root@linuxbox ~]# bg
[1]+ ./loop.sh &
[root@linuxbox ~]# jobs
[1]+ Running

./loop.sh &

[root@linuxbox ~]#

( )
.

fg.
.
[root@linuxbox ~]# fg
./loop.sh


CTRL+Z bg,
.

ps:
ps .
,
110

7.

.
: ps []

ps aux:
USER

PID %CPU %MEM

VSZ

RSS TTY STAT START

TIME COMMAND

root

0.3

0.2

2064

652

Ss

21:54

0:05

init [3]

root

0.0

0.0

S<

21:54

0:00

[migration/0]

root

0.0

0.0

SN

21:54

0:00

[ksoftirqd/0]

root

0.0

0.0

S<

21:54

0:00

[watchdog/0]

root

0.0

0.0

S<

21:54

0:00

[events/0]

ps ,
.
ps aux (BSD-style)
ps lax ps aux,

ps -ejH
ps -C <> -o <>

ps aux | grep < >
, :
[root@linuxbox ~]# ps aux | grep syslogd
root

1939 0.0 0.2 1820 696 ?

Ss Aug25 0:00 syslogd -m 0

root

6107 0.0 0.2 3912 668 pts/0 R+ 00:38 0:00 grep syslogd

[root@linuxbox ~]#

7.

111

ps aux:

USER

PID

%CPU
( ),

%MEM
( ),

VSZ

RSS
.
( )
TTY

STAT
:
D , I/O
R
S ,

T
W (
2.6.xx)
X ( )
Z (defunct)
BSD-
:

ps

<
N
L

s
)

l -
+
START

TIME
,
COMMAND
112

7.

nohup: HUP
nohup
(HANGUP).
.
.
: nohup []
loop.sh hangup.
[root@linuxbox ~]# nohup ./loop.sh &
[1] 6322
[root@linuxbox ~]# nohup: appending output to `nohup.out

[root@linuxbox ~]#

, .

top:
ps .
top.
.
3 , -d
.
: top []
top :
top - 01:50:55 up 12 min, 2 users, load average: 0.00, 0.15, 0.18
Tasks: 76 total, 2 running, 74 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 98.7%id, 0.0%wa, 0.0%hi, 1.3%si, 0.0%st
Mem: 255556k total, 156840k used, 98716k free, 54352k buffers
Swap: 524280k total,

0k used, 524280k free, 58544k cached

7.

113

PID USER
2913 root

PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND


15

0 2196 992 800 R

0.3

0.4

0:00.02 top

0 2064 624 536 S

0.0

0.2

0:04.11 init

root

15

root

RT -5

0 S

0.0

0.0

0:00.00 migration/0

root

34 19

0.0

0.0

0:00.00 ksoftirqd/0

root

RT -5

0.0

0.0

0:00.55 watchdog/0

root

10 -5

0.0

0.0

0:00.10 events/0

root

10 -5

0.0

0.0

0:01.05 khelper

top uptime,
, ,
1, 5 15 .
:
, , ,
, -.

. :
us
( nice);
sy ;
id ;
wa I/O (-);
st .
:
RAM, , , .
swap`: ,
, .

top
, .
.
114

7.

h
k
n
u
M
P
1
r
q


. PID

.




CPU SMP-

top

top -b -n1 top


. , ,
.
top
htop. EPEL:
[root@linuxbox ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
[root@linuxbox ~]# yum -y install htop

vmstat:
vmstat , ,
, -, .
: vmstat []
vmstat.
[root@linuxbox ~]# vmstat
procs -----------memory------------- --swap-- -----io---- --system-- -------cpu------r b swpd
00

free

buff cache

si so

bi bo

in cs us sy id wa st

0 115556 44112 58300

0 0

45 10

1008 25 0 1 98 1 0

[root@linuxbox ~]#

7.

115

vmstat ,
.
2 .
[root@linuxbox ~]# vmstat 2

[root@linuxbox ~]# watch -n 2 vmstat

vmstat

procs

memory

b
swpd
free
buf
cache
inact

swap

active
si swap`

IO

so swap
bi

system

bo
in

cpu

cs
us

sy

id
wa
-

116

7.

free:
free .
: free []
free:
[root@linuxbox ~]# free
total
Mem:

used

255556 142296

-/+ buffers/cache:
Swap:

free

524280

113260

37948
0

shared

buffers
0

cached

44160

60188

217608

524280

[root@linuxbox ~]#

Mem: ,
, , .
-/+ bufers/cache:
.
Swap: .
free
watch:
[root@linuxbox ~]# watch -n 1 -d free
Every 1.0s: free Wed Aug 26 18:22:27 2009

Mem:

total

used

free

shared

buffers

cached

255556

142296

113260

44164

60200

37932

217624

524280

-/+ buffers/cache:
Swap:

524280

-n , -d
watch .
Ctrl+C.

7.

117

8.

RPM
RPM Package Manager (RPM) .
rpm ,
. ,
, . RPM

.

RPM
1. , ;
2. RPM
RPM ;
3. .
/ ;
4. GPG.

RPM
1. RPM
;
2. .


:
<>-<>-<>.<>.rpm
:
vim-6.3-1.i386.rpm
(SRPM),
118

8.

src:
vim-6.3-1.src.rpm

( .spec) rpm- rpmbuild
. .
# mkdir -p /usr/src/redhat/{SOURCES,BUILD,SRPMS,RPMS/i386}

# rpm -Uvh http://mirror.corbina.net/pub/Linux/centos/5.2/updates/SRPMS/


postfix-2.3.3-2.1.el5_2.src.rpm

# cd /usr/src/redhat/SPECS/

# rpmbuild -ba postfix.spec

# rpm -Uvh /usr/src/redhat/RPMS/i386/postfix-2.3.3-2.1.i386.rpm

rpm: RPM Package Manager


rpm , ,
rpm-.
: rpm [] []

-v
-i
-U

-F
. ,

-e

-q

-p <package> <package>
-a

8.

119

-h

50 .
-v
rpm
<ile>
,
,

,

-f <ile>
-i
-l
-R

rpm-
.
[root@linuxbox ~]# rpm -ivh nginx-0.6.38-1.el5.i386.rpm

-i -U. ,
.

rpm-
.
[root@linuxbox ~]# rpm -e synaptics-0.14.4-8.fc6

: error: Failed dependencies:


. ,
.
--nodeps.

rpm-
rpm -qi
.
[root@linuxbox ~]# rpm -qi openssh-4.3p2-29.el5
Name

: openssh

Version

: 4.3p2

Release

: 29.el5

Relocations: (not relocatable)


Vendor: CentOS
Build Date: Tue 03 Mar 2009 09:08:12 PM MSK

Install Date: Tue 28 Jul 2009 02:13:17 AM MSD


Group

120

: Applications/Internet

Build Host: chamkaur.karan.org

Source RPM: openssh-4.3p2-29.el5.src.rpm

8.

Size

: 743486

License: BSD

Signature : DSA/SHA1, Mon 09 Mar 2009 04:48:50 AM MSK, Key ID a8a447dce8562897


Packager : Karanbir Singh <kbsingh@karan.org>
URL

: http://www.openssh.com/portable.html

Summary

: The OpenSSH implementation of SSH protocol versions 1 and 2

Description :
SSH (Secure SHell) is a program for logging into and executing
commands on a remote machine. SSH is intended to replace rlogin and
rsh, and to provide secure encrypted communications between two
untrusted hosts over an insecure network. X11 connections and
arbitrary TCP/IP ports can also be forwarded over the secure channel.

OpenSSH is OpenBSDs version of the last free version of SSH, bringing


it up to date in terms of security and features, as well as removing
all patented algorithms to separate libraries.

This package includes the core files necessary for both the OpenSSH
client and server. To make this package useful, you should also
install openssh-clients, openssh-server, or both.
[root@linuxbox ~]#

RPM-
[root@linuxbox ~]# rpm -qa
basesystem-8.0-5.1.1.el5.centos
cracklib-dicts-2.8.9-3.3
iso-codes-0.53-1
termcap-5.5-1.20060701.1
gnome-backgrounds-2.15.92-1.fc6

8.

121


[root@linuxbox ~]#

.

. wc -l.
[root@linuxbox ~]# rpm -qa | wc -l
743
[root@linuxbox ~]#


rpm -qf
.
[root@linuxbox ~]# rpm -qf /usr/bin/passwd
passwd-0.73-1
[root@linuxbox ~]#

RPM-
[root@linuxbox ~]# rpm -ql iproute-2.6.18-9.el5
/etc/iproute2
/etc/iproute2/ematch_map
/etc/iproute2/rt_dsfield
/etc/iproute2/rt_protos
/etc/iproute2/rt_realms
/etc/iproute2/rt_scopes
/etc/iproute2/rt_tables
/etc/sysconfig/cbq

122

8.

rpm- -p.
[root@linuxbox ~]# rpm -qpl /home/datastore/ispell-3.1.20-5.i386.rpm

Yellowdog Updater Modified (YUM)


yum RPM-.
RPM-.
.
:
1. ;
2. , ;
3. ;
4. / .
yum.
: yum <> <> < >
.

install
update



.


check-update
upgrade
update --obsoletes. upgrade
Linux

remove

list

yum list
yum list installed
yum list available

8.

123

provides
search

info
clean
repolist
-y



.
,


yum
.


install ,
. ,
.
[root@linuxbox ~]# yum -y install spamassassin


remove ,
. ,
.
[root@linuxbox ~]# yum -y remove spamassassin


list .
. .
, ,
, .
installed.
[root@linuxbox ~]# yum list

124

8.



, .
[root@linuxbox ~]# yum search captcha
python-tgcaptcha.noarch : A TurboGears CAPTCHA widget for forms
perl-Authen-Captcha.noarch : Perl extension for creating captchas
[root@linuxbox ~]#


info .
, , Epoch (, RPM
), , ,
, .
[root@linuxbox ~]# yum info squid
Installed Packages
Name : squid
Arch : i386
Epoch : 7
Version: 2.6.STABLE6
Release: 5.el5_1.3
Size

: 3.3 M

Repo : installed
Summary: The Squid proxy caching server.


provides
.
[root@linuxbox ~]# yum provides /usr/bin/passwd

8.

125

passwd.i386 : The passwd utility for setting/changing passwords using PAM


passwd.i386 : The passwd utility for setting/changing passwords using PAM
[root@linuxbox ~]#


, yum .

. ,
.

. yum
repolist.
[root@linuxbox ~]# yum repolist
repo id

repo name

status

addons

CentOS-5 - Addons

enabled

base

CentOS-5 - Base

enabled

extras

CentOS-5 - Extras

enabled

updates

CentOS-5 - Updates

enabled

[root@linuxbox ~]#

CentOS 3000 .
[root@linuxbox ~]# yum list | wc -l
2925
[root@linuxbox ~]#

,
,
.
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
rpm -Uvh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.
rf.i386.rpm

126

8.

rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/i386/rpmfusion-freerelease-5-0.1.noarch.rpm


rpm -Uvh http://download1.rpmfusion.org/nonfree/el/updates/testing/5/i386/rpmfusionnonfree-release-5-0.1.noarch.rpm
rpm -Uvh http://repo.redhat-club.org/redhat/5/i386/redhatclub-repository-release-5-4.el5.
rhc.noarch.rpm

,
.
[root@linuxbox ~]# yum list | wc -l
10077
[root@linuxbox ~]#

, ,
.

yum.conf
yum yum.conf.
, [main]
, [server]
. [server] .

[main]

cachedir
keepcache
debuglevel
logile
distroverpkg
tolerant
exactarch
obsoletes
gpgcheck


(1) (0)
. 2


(1)
(0)

(1) (0)
,

GPG (1) (0)

8.

127

plugins
metadata_expire
installonly_limit

(1) (0)


installonlypkgs-
.

(kernel, kernel-smp, kernel-bigmem
..)

[server]

.
[server] :
[serverid]
name=< >
baseurl=< >
gpgcheck=[1|0]
gpgkey=< >

[server]

serverid
name
baseurl
gpgcheck
mirrorlist
gpgkey
enabled



url
GPG (1) (0)
URL , baseurl
GPG-
(1) (0)

chkconfig:
chkconig .
runlevel .
: chkconig [] [_] [on|of|reset]
128

8.


--list
[root@linuxbox ~]# chkconfig --list

winbind 2-5.
[root@linuxbox ~]# chkconfig winbind on


--level
[root@linuxbox ~]# chkconfig winbind off
[root@linuxbox ~]# chkconfig --levels 23 winbind on

.
.
[root@linuxbox ~]# chkconfig winbind off


RPM-
.
.
.
.

. ,
90% ,
.
1

wget http://www.sai.msu.su/apache/httpd/httpd-2.2.13.tar.gz

tar xzvf httpd-2.2.13.tar.gz

cd httpd-2.2.13

less README INSTALL

./configure

make

make install

8.

129

1. : .
tar.gz;
2. : ;
3. : ;
4. : README INSTALL.
, .
;
5. :
conigure.
--help: ./conigure --help.

;
6. : .
make
. ;
7. : .

. -
.

130

8.

9. VIM
vim (Vi improved) ,
vi .

.

vim
vim :
1. (Command mode).
copy-paste,
;
2. (Insert mode).
. ,
, ;
3. Ex . :.
, .
.
Insert i Insert Ex : (Shift+:).
ESC
ESC ESC

vim
: ;
: ;
: vim Linux.

vim
: vim .
9. VIM

131

vim
,
vim-enhanced.
[root@linuxbox ~]# which vim
/usr/bin/vim
[root@linuxbox ~]# yum provides /usr/bin/vim
vim-enhanced.i386 : A version of the VIM editor which includes recent
enhancements.
vim-enhanced.i386 : A version of the VIM editor which includes recent
enhancements.
[root@linuxbox ~]#

: vim <> <>

vim
vim ,
Ex :help
:help <Enter>

:
:help < > <Enter>

Ctrl+D
:help <> <Ctrl+D>
vimtutor
[root@linuxbox ~]# vimtutor

man vim
[root@linuxbox ~]# man vim

132

9. VIM

vim

vim,
vim < >.
.
[root@linuxbox ~]# vim textfile

vim ,
.
Insert , i Insert.
vim
vim .
vim ,
:e Ex .
:e anotherfile <Enter>


,
ESC :, wq <Enter>.
w , , q
.
, :w .
:w textfile2 <Enter>


!, :wq! vim
.
,
:
:q
E37: No write since last change (add ! to override)

,
9. VIM

133

.
!
:q! <Enter>


.
:r < >
:r textfile3 <Enter>



x. ,
dd.
,
ESC, v ,
d.
(cut-paste)
.
vi.
1. , ;
2. m a.
;
3. , ;
4. d, a. a
.
() ,
da;
5.
p.
.

134

9. VIM

.
1. , ;
2. ESC v.
;
3. ,
;
4. d, ;
5.
p. .

(copy-paste)
.
vi.
1. , ;
2. m a, a;
3.
;
4. y, a.
a;
5. ,
p. .
.
1. , ;
2. ESC v ;
3. , .
;
4. y ;
5.
p. .
9. VIM

135



, .
Woosd Woods.
ESC, s xp. s d
Woods.

ESC, /
/woods <Enter>.
, /
<Enter>.


.
woods woodz:
:s/woods/woodz/g <Enter>

:
s substitute ()
/woods
/woodz
g ,

woods
woodz:
:1,3s/woods/woodz/g <Enter>

woods woodz:
:%s/woods/woodz/g <Enter>

136

9. VIM



ESC, : .
.
:10 <Enter>

g g


, ESC u.


Ctrl+R


:
b
h
u
t
y
o
a
l
c
i

.
:
1. , ;
2. m a, a
9. VIM

137

;
3. , ;
4. !asort.
vim ,
UNIX . a ,
a. UNIX sort. :
a
b
c
h
i
l
o
t
u
y



.
Ctrl+w, s
Ctrl+w, v
Ctrl+w,

.

vim

vim , Ex :set
138

9. VIM

:set <Enter>

.
:set all
:set all <Enter>

.
:set ts=20 <Enter>

:help option-list
:help option-list <Enter>

.vimrc

vim.
vim .
[root@linuxbox ~]# vim ~/.vimrc

.
set ts=20

9. VIM

139

10. Linux
:
1. ;
2. ;
3. (hostname).


3
:
1. IP-;
2. ;
3. Gateway ().

:
/etc/hosts
<IP-> <>

DNS-
. DNS- nameserver
/etc/resolv.conf

/etc/modprobe.conf
. .
/etc/hosts ip- .
DNS- .
/etc/resolv.conf nameserver
DNS .
/etc/host.conf
.
140

10. Linux

/etc/hosts DNS-.
/etc/init.d/network
Linux. service, :
[root@linuxbox ~]# service network restart

/proc/sys/net/ipv4/ip_forward .
.
1 .
[root@linuxbox ~]# echo 1 > /proc/sys/net/ipv4/ip_forward

, /etc/sysctl.
conf
net.ipv4.ip_forward = 0


net.ipv4.ip_forward = 1

/etc/sysconig/network :
- , ;
- (hostname);
- Default gateway ( ifcfg-<>).

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME= linuxbox.company.ru
GATEWAY

.
IPv4
IPv6

/etc/sysconig/network-scripts/
, .
/etc/sysconig/network-scripts/ifcfg-* ifcfg-*
. eth<x>, x 0
, 1 .. loopback /etc/sysconig/network-scripts/ifcfg-lo
10. Linux

141


DHCP iface

DHCP , DHCP
iface.
BOOTPROTO=dhcp (ifcfg-<>).
:

DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:43:5B:3D
ONBOOT=yes


DHCP
MAC-

?

Custom iface
DHCP iface,
custom-, .
.
/etc/sysconig/network-scripts/ifcfg-<_>

DEVICE=eth0
HWADDR=00:0C:29:43:5B:3D
IPADDR=192.168.146.130
NETMASK=255.255.255.0
BROADCAST=192.168.146.255
GATEWAY=192.168.146.2
ONBOOT=yes


MAC-
IP-




?

loopback iface
loopback . IP- 127.0.0.1
. .
/etc/sysconig/network-scripts/ifcfg-lo
142

10. Linux


DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback


IP-

IP-


?
.
ifconig
DEVICE

network, ifdown, ifup



-.
Linux network:
[root@linuxbox ~]# /etc/init.d/network restart

[root@linuxbox ~]# service network restart

Linux
.
ifdown ifup. ifdown ,
ifup .
[root@linuxbox ~]# ifdown eth0
[root@linuxbox ~]# ifup eth0

ifconfig
,
.
[root@linuxbox ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:43:5B:3D
inet addr:192.168.146.130 Bcast:192.168.146.255 Mask:255.255.255.0

10. Linux

143

inet6 addr: fe80::20c:29ff:fe43:5b3d/64 Scope:Link


UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1327 errors:0 dropped:0 overruns:0 frame:0
TX packets:1340 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:149547 (146.0 KiB) TX bytes:232486 (227.0 KiB)
Interrupt:59 Base address:0x2000
...

MTU:1500 Maximum Transfer Unit.


.
,
. Ethernet- MTU 1500 .
Metric:1
. , .
.
ollisions:0 ,
.
RX bytes
TX bytes

: ifconig < >,
[root@linuxbox ~]# ifconfig eth0

-a ifconig
.
[root@linuxbox ~]# ifconfig -a


. ,
.
144

10. Linux

netstat -r
Kernel IP routing table
Destination

Gateway

192.168.146.0 *
default

Genmask

Flags MSS Window irtt Iface

255.255.255.0 U

192.168.146.2 0.0.0.0

UG

eth0

eth0

.
.
/etc/sysconig/network ,
default, . ,
,
. default gateway 192.168.146.2
netstat -r :
. 192.168.146.0
(*), .
default, .
.
Genmask ,
.
Flags: U UP, .
Flags: UG UP, Gateway. gateway
.
MSS Maximum Segment Size,
.
Window . ,
.
irtt initial round trip time,
. Round trip time
,
, .
Iface .
10. Linux

145



.
. eth0 eth1. eth0

. eth1
192.168.147.0/24 , 192.168.147.1
192.168.148.0/24
.

:
[root@linuxbox ~]# netstat -r
Kernel IP routing table
Destination

Gateway

Genmask

Flags MSS Window irtt Iface

192.168.147.0 *

255.255.255.0

eth1

192.168.146.0 *

255.255.255.0

eth0

192.168.148.0 192.168.147.1

255.255.255.0

UG

eth1

default

0.0.0.0

UG

eth0

192.168.146.2

192.168.148.0/24 eth1 -> 192.168.147.1,


.
. .

146

10. Linux


[root@linuxbox ~]# cat /etc/sysconfig/network
...
GATEWAY=192.168.146.2
...

eth0
[root@linuxbox ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:43:5B:3D
IPADDR=192.168.146.130
NETMASK=255.255.255.0
BROADCAST=192.168.146.255
ONBOOT=yes

eth1
[root@linuxbox ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
HWADDR=00:0c:29:43:5b:47
IPADDR=192.168.147.2
NETMASK=255.255.255.0

eth1
192.168.148.0/24 route:
[root@linuxbox ~]# route add -net 192.168.148.0/24 gw 192.168.147.1

10. Linux

147

.
/etc/
sysconig/network-scripts/route-<>.
. /etc/sysconig/network-scripts/route-eth1
:
192.168.148.0/24 via 192.168.147.1

.
.

:
[root@linuxbox ~]# service network restart


,
DHCP.

.

, .

netstat

r

IP-.
n
,
a
.
.
.
t
tcp
u
udp
i

l
LISTEN,
p
PID (process ID)

148

10. Linux

netstat
- 25- ?
[root@linuxbox ~]# netstat -nlp | grep :25


[root@linuxbox ~]# netstat -nt
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0

::ffff:192.168.146.130:22 ::ffff:192.168.146.1:2642 ESTABLISHED

tcp 0 132 ::ffff:192.168.146.130:22 ::ffff:192.168.146.1:2027 ESTABLISHED

/
[root@linuxbox ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q

Local Address

Foreign Address State

PID/Program name

tcp

0.0.0.0:111

0.0.0.0:*

LISTEN

2480/portmap

tcp

127.0.0.1:631

0.0.0.0:*

LISTEN

2762/cupsd

tcp

127.0.0.1:25

0.0.0.0:*

LISTEN

2786/sendmail: acce

tcp

0.0.0.0:991

0.0.0.0:*

LISTEN

2505/rpc.statd

tcp

:::22

:::*

LISTEN 2747/sshd


ESTABLISHED
SYN_SENT
SYN_RECV
FIN_WAIT1

10. Linux

149

FIN_WAIT2
TIME_WAIT , -
CLOSED
CLOSE_WAIT ,
LAST_ACK .
LISTEN
CLOSING ,
UNKNOWN

traceroute
traceroute
. ICMP- ,
.
[root@linuxbox ~]# traceroute www.ru
traceroute to www.ru (194.87.0.50), 30 hops max, 40 byte packets
1 192.168.79.2 (192.168.79.2) 0.140 ms 0.062 ms 0.114 ms
2 www.ru (194.87.0.50) 21.104 ms 24.591 ms 26.570 ms
[root@linuxbox ~]#



:
[root@linuxbox ~]# less /usr/share/doc/initscripts-*/sysconfig.txt

,
/etc/sysconig/
150

10. Linux


date.
.
[root@linuxbox ~]# date
Wed Sep 2 15:48:01 MSD 2009
[root@linuxbox ~]#

, date
, , , , ,
[[]].
1. 14 10 30 15 2010
[root@linuxbox ~]# date 121514102010.30
Wed Dec 15 14:10:30 MSK 2010
[root@linuxbox ~]#

2. 19 35 25 2 2009
[root@linuxbox ~]# date 090219352009.25
Wed Sep 2 19:35:25 MSD 2009
[root@linuxbox ~]#

(hostname)
/etc/
sysconig/network HOSTNAME .
[root@linuxbox ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=linuxbox.company.ru
[root@linuxbox ~]#

10. Linux

151

system-config-*
system-conig-* 30 .

. system-conig-* Red Hat
.
ncurses,
. X Window
,
. X
Window .
.

setup

.

. ,
irewall, , , timezone, X Window
.
authconig

authconig-tui


ncurses
system-conig-securitylevel irewall/SELinux
system-conig-date
timezone
system-conig-keyboard

system-conig-language

system-conig-network
DNS
system-conig-printer
. X Window


yum:
[root@linuxbox ~]# yum list | grep system-config

, .
[root@linuxbox ~]# yum -y install system-config-keyboard

adsl-* ADSL-
adsl-* ADSL-.
152

10. Linux


adsl-setup

. /,
.
/etc/sysconig/network-scripts/
ifcfg-ppp0
adsl-start PPPoE-
adsl-status
adsl-stop

adsl-setup
LOGIN NAME
INTERFACE ADSL-
Do you want the link to come up on demand, or stay up continuously?
.

.
<Enter>.
DNS DNS-.
server
PASSWORD
USERCTL
ADSL-?
FIREWALLING :
NONE . .
STANDALONE
MASQUERADE
Do you want to start this connection at boot time?
?

10. Linux

153

11.
Network File System
Sun Microsystems 1984 . NFS
, . NFS

,
.
.

NFS
NFS .
.
[root@linuxbox ~]# chkconfig --list nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off


[root@linuxbox ~]# chkconfig nfs on


[root@linuxbox ~]# service nfs start

nfs
[root@linuxbox ~]# yum -y install nfs-utils

154

11.

NFS RPC-
portmapper (
RPC Calls).
[root@linuxbox ~]# rpcinfo -p localhost | grep nfs
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
[root@linuxbox ~]#

rpcinfo , NFS- NFS 2,


3 4 ().


/etc/exports
, NFS
.

.
/etc/exports .
[ ] [ ] []
/etc/exports:
[root@linuxbox ~]# cat /etc/exports
/home 192.168.79.130(rw,no_root_squash)

/home 192.168.79.130 rw
! . /home
192.168.79.130 (rw) 192.168.79.130 /home
ro, rw. 192.168.79.130(rw) 192.168.79.130
rw, .
11.

155

.
[root@linuxbox ~]# exportfs -r


[root@linuxbox ~]# exportfs
/home

192.168.79.130

NFS-
192.168.79.130 /home
linuxbox.

[root@system5 ~]# mkdir /mnt/nfs

mount.
-t .
.
mount -t nfs <>:<_NFS_> <_>
IP- hostname , NFS-
_NFS_ /home
NFS-
[root@system5 ~]# mount -t nfs 192.168.79.132:/home /mnt/nfs
rw.
24
/etc/fstab
.
/etc/fstab :
192.168.79.132:/home /mnt/nfs nfs defaults
/etc/exports
156

11.


ro
rw
root_squash



root root ,
nobody
no_root_squash
root
.
.

all_squash
,
.

anonuid/anongid UID GID

sync
,
,
. ,

async
,
, .
,
insecure
1024
no_subtree_check ,
, , ,

.
.
,


1. hostname IP-;
2. *, . *.fasttech.ru
testers.fasttech.ru alex.testers.fasttech.ru
*.*.fasttech.ru;
3. ?, (
IP-);
11.

157

4. , 192.168.146.32/27;
5. NIS-, @nisgroup2.


[root@linuxbox ~]# man nfs
[root@linuxbox ~]# man exports
[root@linuxbox ~]# man exportfs

exports exportfs. exports , exportfs


.

158

11.

12.
man
Linux
, ,
.
man (on-line manual pages). man-
/, man
.
: man [ ]
: man cat
man
. man-
, :
1. , ;
2. ;
3. ;
4. ;
5. ;
6. ;
7. .
man- 8 .
,
, . :
man 7 signal man signal .
1. (ls, mkdir, env);
2. (poll, chown, chroot);
3. (CGI, fclose, getpwent);
4. (tty, zero, vesa);
5. (crontab, nfs, yum.conf);
12.

159

6. ;
7. (boot, icmp, wireless);
8. (iptables, lsof, fdisk).
man- .
man- / ,
( /). /
. ( )
?, :
/concatenate concatenate
?concatenate concatenate

whatis
whatis whatis
.
[root@linuxbox ~]# whatis cat
cat

(1) - concatenate files and print on the standard output

cat

(1p) - concatenate and print files

[root@linuxbox ~]#

makewhatis.

apropos
apropos whatis
.
[root@linuxbox ~]# apropos Hardware
hal

(rpm) - Hardware Abstraction Layer

hwdata

(rpm) - Hardware identification and configuration data

kudzu

(rpm) - The CentOS hardware probing tool.

[root@linuxbox ~]#

160

12.

info
info
info. ,
.
: info emacs
info info info:
[root@linuxbox ~]# info info

help
bash help,
builtin- bash.
[root@linuxbox ~]# help unset
unset: unset [-f] [-v] [name ...]
For each NAME, remove the corresponding variable or function. Given
the `-v, unset will only act on variables. Given the `-f flag,
unset will only act on functions. With neither flag, unset first
tries to unset a variable, and if that fails, then tries to unset a
function. Some variables cannot be unset; also see readonly.
[root@linuxbox ~]#

locate
locate
updatedb .
[root@linuxbox ~]# locate crontab
/etc/anacrontab
/etc/crontab

12.

161

/usr/bin/crontab
/usr/share/man/man1/crontab.1.gz
/usr/share/man/man1p/crontab.1p.gz
/usr/share/man/man5/anacrontab.5.gz
/usr/share/man/man5/crontab.5.gz
/usr/share/vim/vim70/syntax/crontab.vim
[root@linuxbox ~]#

updatedb.
-S
[root@linuxbox ~]# locate -S
Database /var/lib/mlocate/mlocate.db:
9,998 directories
119,567 files
5,832,849 bytes in file names
2,513,667 bytes used to store database
[root@linuxbox ~]#

which
which .
[root@linuxbox ~]# which passwd
/usr/bin/passwd
[root@linuxbox ~]#


,
162

12.

-h --help.
[root@linuxbox ~]# cat --help
Usage: cat [OPTION] [FILE]...
Concatenate FILE(s), or standard input, to standard output.

-A, --show-all

equivalent to -vET

-b, --number-nonblank number nonblank output lines


-e

equivalent to -vE

[root@linuxbox ~]#

12.

163

13. Linux

cron .
/etc/cron.allow
cron . /etc/cron.
allow /etc/cron.deny.
cron,
. cron
, /etc/cron.deny
/etc/cron.allow. .

crontab-

:
: 0 59
: 0 23
_: 1 31
: 1 12 ( jan dec)
_: 0 6 (0 7 )
( sun sat)
*,
.
. .
/ (slash).
164

13. Linux

crontab-
, cron :
1. crontab- /var/spool/cron/
2. crontab- /etc/cron.d/
3. crontab- /etc/crontab
cron ,
.
crontab- :
[root@linuxbox ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
[root@linuxbox ~]#

:
SHELL
. shell /etc/passwd
, .
PATH PATH.
MAILTO .

13. Linux

165

HOME .
, SHELL
HOME , , /etc/passwd.
.
/etc/cron.hourly

/etc/cron.daily

/etc/cron.weekly
22- 4-

/etc/cron.monthly
42- 4-

/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
root .
.

crontab
crontab
crontab. ,
cron.

crontab -e
crontab -l
crontab -r
crontab -u

166

crontab-
crontab-
crontab-
,
.
root
crontab -u username -e
crontab -u username -l
crontab -u username -r
13. Linux

crontab- .
ile
[user1@linuxbox ~]$ cat file
0-59 * * * * /bin/true
[user1@linuxbox ~]$ whoami
user1
[user1@linuxbox ~]$

crontab-,
crontab
[user1@linuxbox ~]$ crontab file

/var/spool/cron/
.
[root@linuxbox ~]# ls -l /var/spool/cron/
total 8
-rw------- 1 root root

19

Sep

12

22:56

root

-rw------- 1 user1 root

23

Sep

13

18:44

user1

[root@linuxbox ~]# cat /var/spool/cron/user1


0-59 * * * * /bin/true
[root@linuxbox ~]#

crontab

0-59 * * * * /bin/true

15
*/15 * * * * /bin/true


0 0 * * * /bin/true

13. Linux

167

0:30, 2:30, 4:30, 6:30 ..


30 */2 * * * /bin/true

23 59 31
59 23 31 dec * HappyNewear.sh


tar
. tar
, , gzip
bzip2.
: tar [] [_-] [/]
tar

-c
-j
-z
-v
-f
-x


bzip2
gzip


tar-
[root@linuxbox ~]# du -sh /etc/
57M

/etc/

[root@linuxbox ~]# tar cvf etc.tar /etc/


[root@linuxbox ~]# ls -lh
total 48M
-rw-r--r-- 1 root root 48M Sep 13 23:30 etc.tar
[root@linuxbox ~]#

168

13. Linux

, tar-
.
z.
tar- gzip
[root@linuxbox ~]# du -sh /etc/
57M

/etc/

[root@linuxbox ~]# tar czvf etc.tar.gz /etc/


[root@linuxbox ~]# ls -lh
total 4.8M
-rw-r--r-- 1 root root 4.8M Sep 14 13:29 etc.tar.gz
[root@linuxbox ~]#

gzip,
10 .
tar- bzip2
tar bzip2
z j.
[root@linuxbox ~]# du -sh /etc/
57M

/etc/

[root@linuxbox ~]# tar cjvf etc.tar.bz2 /etc/


[root@linuxbox ~]# ls -lh
total 3.2M
-rw-r--r-- 1 root root 3.2M Sep 14 13:41 etc.tar.bz2
[root@linuxbox ~]#

bzip2 /etc/ .
tar.gz-
[root@linuxbox ~]# tar xzvf etc.tar.gz

13. Linux

169


[root@linuxbox ~]# ls -l
total 4868
drwxr-xr-x 84 root root
-rw-r--r--

4096 Sep 14 13:24 etc

1 root root 4965172 Sep 14 14:59 etc.tar.gz

[root@linuxbox ~]#


. / (slash)
, tar , -
.
[root@linuxbox ~]# tar xzvf etc.tar.gz etc/shells etc/profile etc/vimrc
etc/shells
etc/vimrc
etc/profile
[root@linuxbox ~]# ls -l etc/
total 12
-rw-r--r-- 1 root root 937 Jan 31 2006 profile
-rw-r--r-- 1 root root 69 Sep 6 23:21 shells
-rw-r--r-- 1 root root 1488 Nov 25 2008 vimrc
[root@linuxbox ~]#

bz2-
bz2- tar xjvf
bzip2 -d
[root@linuxbox ~]# tar xjvf etc.tar.bz2
[root@linuxbox ~]# ls -l
total 3268

170

13. Linux

drwxr-xr-x 84 root root


-rw-r--r--

4096 Sep 14 13:24 etc

1 root root 3337026 Sep 14 15:16 etc.tar.bz2

[root@linuxbox ~]#


. / (slash)
, tar , -
.
[root@linuxbox ~]# tar xjvf etc.tar.bz2 etc/shells etc/profile etc/vimrc
etc/shells
etc/vimrc
etc/profile
[root@linuxbox ~]# ls -l etc/
total 12
-rw-r--r-- 1 root root 937 Jan 31 2006 profile
-rw-r--r-- 1 root root

69 Sep

6 23:21 shells

-rw-r--r-- 1 root root 1488 Nov 25 2008 vimrc


[root@linuxbox ~]#

mc
mc (Midnight Commander)
ncurses (). mc
: , , ,
, , ..
F1
F2
F3
F4
13. Linux

171

F5
F6
F7
F8
F9
F10
Tab

ssh:
ssh (Secure Shell)
Unix/Linux .
telnet, ssh . ssh
ssh-,
ssh-, (
22) . ,

.
.
172

13. Linux

ssh.
: ssh [] [_]@[_]
user1 192.168.79.129
[admin@system5 ~]# ssh user1@192.168.79.129
The authenticity of host 192.168.79.129 (192.168.79.129) cant be established.
RSA key fingerprint is 39:4a:e8:5f:b7:33:14:e6:29:7f:12:08:da:06:77:38.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.79.129' (RSA) to the list of known hosts.
user1@192.168.79.129's password:
[user1@linuxbox ~]$

,
.
yes
~/.ssh/known_host
.

Ssh .
Identity/Pubkey, ,
. ~/.ssh/authorized_
keys .
, ,
.
:
ssh []@[]
ssh-keygen.
[user@system5 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory /home/user1/.ssh.
Enter passphrase (empty for no passphrase):

13. Linux

173

Enter same passphrase again:


Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
96:3f:3e:df:bd:4b:db:0d:97:3f:bb:b7:b0:c1:72:04 user1@linuxbox.company.ru
[user@system5 ~]$

ssh-copy-id
.
[user@system5 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub user2@192.168.79.129
27
The authenticity of host 192.168.79.129 (192.168.79.129) cant be established.
RSA key fingerprint is 39:4a:e8:5f:b7:33:14:e6:29:7f:12:08:da:06:77:38.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 192.168.79.129 (RSA) to the list of known hosts.
user2@192.168.79.129s password:
Now try logging into the machine, with ssh user2@192.168.79.129, and check in:
.ssh/authorized_keys
to make sure we havent added extra keys that you werent expecting.
[user@system5 ~]$

.
[user@system5 ~]$ ssh user2@192.168.79.129
[user2@linuxbox ~]$

ssh- Windows
Windows ssh-
putty, :
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
174

13. Linux

14.

log-
.
.
:
1. ;
2. log-;
3. log-.

/var/log/messages
/var/log/.
.

messages
audit/audit.log
cron
dmesg
wtmp
yum.log
secure
maillog
lastlog



cron

.
yum



, mysqld.log, httpd.log, proftpd.log.

Syslog

Syslog.
Syslog .

14.

175

. Syslog

.
.
Syslog .
[root@linuxbox ~]# ps aux | grep syslogd
root

2474 0.0 0.2 1716 564 ?

Ss 16:17 0:00 syslogd -m 0

root

6976 0.0 0.2 3912 648 pts/0 R+ 19:38 0:00 grep syslogd

[root@linuxbox log]#

Syslog syslogd,
/etc/syslog.conf
:
cron
/var/log/cron
cron.*

/var/log/cron

( Syslog)
.
, Syslog ,
,
. * none,
.
.
: .
.
(facilities) Syslog

auth
authpriv
cron
daemon
kern
176



cron


14.

lpr
mail
mark

news
Usenet
syslog
Syslog
user

uucp
UUCP
local0 local7 . Red Hat local7

*

(priorities) Syslog

emerg
alert
crit
err
warning
notice
info
debug

Syslog

_
@_
@IP_
1,
2,
*

syslogd

IP

14.

177


syslogd
, .

=
!

mail.*
mail.=info
mail.info;mail.!err


info
info, notice
warning
mail.debug;mail.!=notice ,
notice

logrotate

,
-
.
.
,
. Linux logrotate.
cron
/etc/logrotate.conf
/etc/logrotate.conf

weekly
rotate 4
create
compress
include
178

,

4



14.

/etc/logrotate.d/ logrotate
. syslog.
/etc/logrotate.d/syslogd
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/
boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

,
( ).

sharedscripts

,

postrotate endscript postrotate endscript
bash, .
syslogd rsyslogd
HUP,

logger
logger shell.
/etc/syslog.conf
local0.notice /tmp/myscript.log

syslog
[root@linuxbox ~]# service syslog restart

14.

179


[root@linuxbox ~]# touch /tmp/myscript.log

logger local0 notice


my own notice message. Syslog,
local0 notice /tmp/
myscript.log
[root@linuxbox ~]# logger -p local0.notice my own notice message


[root@linuxbox ~]# cat /tmp/myscript.log
Sep 4 20:35:10 linuxbox root: my own notice message
[root@linuxbox ~]#



5
.
[root@linuxbox ~]# du -cms /home/* | sort -rn | head -6
8200 total
6100 /home/james
900 /home/ronaldo
570 /home/neo
420 /home/tester
210 /home/mybestuser

james 6.1 ..


.
180

14.

ulimit
10.
[root@linuxbox ~]# ulimit -f 10000
[root@linuxbox ~]# yes 'some shit' > shit.txt
File size limit exceeded
[root@linuxbox ~]# ls -l
total 10016
-rw-r--r-- 1 root root 10240000 Mar 14 21:36 shit.txt

,
,
, ,
shell ..

[root@linuxbox ~]# ulimit -a

,
.

S.M.A.R.T.-
[root@linuxbox ~]# smartctl -a /dev/sda

S.M.A.R.T. Self-Monitoring, Analysis and Reporting Technology.


, .

.
HDD
fdisk -l.

Linux

[root@linuxbox ~]# netstat -nlp | grep :8080

14.

181

tcp

:::8080 :::*

LISTEN

2697/httpd

, 8080 - Apache.

[root@linuxbox ~]# netstat -tlnp


lsof, .

[root@linuxbox ~]# lsof

IPv4
[root@linuxbox ~]# lsof -i 4
COMMAND

PID

USER FD TYPE

DEVICE SIZE NODE

NAME

portmap

2341

rpc

3u IPv4

6692

UDP

*:sunrpc

rpc.statd

2366

root

7u IPv4

6748

TCP

*:852 (LISTEN)

cupsd

2657

root

3u IPv4

7392

TCP

localhost.localdomain:ipp

cupsd

2657

root

5u IPv4

7395

UDP

*:ipp

php-cgi

2662

nginx

0u IPv4

7415

TCP

localhost.localdomain:..

nginx

3915

nginx

5u IPv4

10864

TCP

*:https (LISTEN)

nginx

3915

nginx

6u IPv4

10865

TCP

*:http (LISTEN)

NFS
[root@linuxbox ~]# lsof -N

/var/log/
+d +D
.
[root@linuxbox ~]# lsof +d /var/log

182

14.

COMMAND PID USER FD TYPE DEVICE SIZE

NODE

NAME

syslogd

2289

root 1w REG 253,0 382311 3047763

/var/log/messages

syslogd

2289

root 2w REG 253,0

/var/log/secure

syslogd

2289

root 3w REG 253,0

6285

3047765

/var/log/maillog

syslogd

2289

root 4w REG 253,0

7348

3047768

/var/log/cron

syslogd

2289

root 5w REG 253,0

3047766

/var/log/spooler

syslogd

2289

root 6w REG 253,0

1532

3047767

/var/log/boot.log

acpid

2590

root 2w REG 253,0

3374

3047640 /var/log/acpid

nginx

3914

root

3398

3047715 /var/log/nginx.er

2u REG 253,0

25939 3047764


[root@linuxbox ~]# lsof -u james



[root@linuxbox ~]# ps -eF


[root@linuxbox ~]# ps -ejH


top ,
CPU , ,
PID (Process ID), ,
.
[root@linuxbox ~]# top

htop .
htop EPEL,
.
14.

183

[root@linuxbox ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/


i386/epel-release-5-3.noarch.rpm
[root@linuxbox ~]# yum -y install htop
[root@linuxbox ~]# htop


[root@linuxbox ~]# df -h
Filesystem

Size

Used

Avail

Use%

/dev/sda1

7.8G

1.6G

5.9G

21%

tmpfs

25M

125M

0%

Mounted on
/
/dev/shm

[root@linuxbox ~]#


ntop.
EPEL .
[root@linuxbox ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/
i386/epel-release-5-3.noarch.rpm
[root@linuxbox ~]# yum -y install ntop

ntop, .
[root@linuxbox ~]# ntop

ntop CTRL+C
/etc/ntop.conf IP-
ntop --http-server --https-server
ntop
[root@linuxbox ~]# service ntop start

ntop.
184

14.

ntop 3000.
ntop
http://192.168.146.132:3000/

iftop. EPEL.
[root@linuxbox ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/
i386/epel-release-5-3.noarch.rpm
[root@linuxbox ~]# yum -y install iftop
[root@linuxbox ~]# iftop

DNS-
dnstop dns-.
[root@linuxbox ~]# rpm Uvh ftp://fr.rpmfind.net/linux/dag/redhat/el5/en/i386/
dag/RPMS/dnstop-0.0.20070510-1.el5.rf.i386.rpm

dnstop .
[root@linuxbox ~]# dnstop eth0

dnstop
.
:
s ;
d , ;
t .
man dnstop

proftpd
[root@linuxbox ~]# ftptop

14.

185


[root@linuxbox ~]# vmstat

-
sysstat ( sa, mpstat, iostat, sar)
[root@linuxbox ~]# yum -y install sysstat

-
[root@linuxbox ~]# iostat


[root@linuxbox ~]# mpstat



who.
[root@linuxbox ~]# who
root

pts/0

2009-09-05 12:57 (192.168.79.1)

[root@linuxbox ~]#


,
last.

[root@linuxbox ~]# last

10
[root@linuxbox ~]# last | head -n 10

186

14.

15.
.
,
. ,
.
:
( root) ( ).

UNIX/Linux- :
1. ;
2. ;
3. .


Linux ,
,
.
.

.

.
15.

187

?
:
1. ;
2. .
- .
,
.


.
1. .
.
;
2. . ,
, ,
GRUB . .



uname -r:
[root@linuxbox ~]# uname -r
2.6.18-92.el5
[root@linuxbox ~]#

, CentOS.
[root@linuxbox ~]# yum list | grep kernel
kernel.i686

2.6.18-92.el5

installed

kernel.i686

2.6.18-128.7.1.el5

updates

kernel-PAE.i686

2.6.18-128.7.1.el5

updates

kernel-PAE-devel.i686

2.6.18-128.7.1.el5

updates

kernel-devel.i686

2.6.18-128.7.1.el5

updates

188

15.

kernel-doc.noarch

2.6.18-128.7.1.el5

updates

kernel-headers.i386

2.6.18-128.7.1.el5

updates

kernel-xen.i686

2.6.18-128.7.1.el5

updates

kernel-xen-devel.i686

2.6.18-128.7.1.el5

updates

[root@linuxbox ~]#

1 2.
kernel.i686

2.6.18-92.el5

installed

kernel.i686

2.6.18-128.7.1.el5

updates

(installed).
.
yum install
[root@linuxbox ~]# yum -y install kernel

GRUB
:
title CentOS (2.6.18-128.7.1.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-128.7.1.el5 ro root=LABEL=/
initrd /boot/initrd-2.6.18-128.7.1.el5.img

,
. .
[root@linuxbox ~]# shutdown -r now

.
[root@linuxbox ~]# uname -r
2.6.18-128.7.1.el5
[root@linuxbox ~]#

15.

189

kernel

. x86
4 .
4 kernel-PAE
kernel-devel
make- kernel
kernel-PAE
Physical Address Extension,
4

kernel-PAE-devel make-
kernel-PAE
kernel-doc

kernel-headers

Linux
kernel-xen
Xen
kernel-xen-devel make-
kernel-xen


,
:
1. gcc ( yum -y install gcc);
2. ncurses-devel ( yum -y install ncurses-devel).
/usr/src/ .
[root@linuxbox ~]# cd /usr/src/

kernel.org .
2.4.x 2.6.x
2.6.x .
[root@linuxbox src]# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux2.6.30.5.tar.bz2

.bz2 tar xjvf


190

15.

[root@linuxbox ~]# tar xjvf linux-2.6.30.5.tar.bz2

.
[root@linuxbox ~]# cd linux-2.6.30.5

README,
.
[root@linuxbox linux-2.6.30.5]# less README

1.

.
make menuconig
ncurses.
make xconig
X Window.
make conig .
X Window xconig .
menuconig.
[root@linuxbox linux-2.6.30.5]# make menuconfig

, ,
:
M .
.
* built-in
.

<Exit>. .

2.
make clean
15.

191

[root@linuxbox linux-2.6.30.5]# make clean

3.
[root@linuxbox linux-2.6.30.5]# make bzImage

4.
[root@linuxbox linux-2.6.30.5]# make modules

5.
[root@linuxbox linux-2.6.30.5]# make modules_install

6.
[root@linuxbox linux-2.6.30.5]# make install

/boot :
System.map-< > ;
initrd-< >.img RAM disk
;
vmlinuz-< > Linux.
/boot/grub/grub.conf
. .
.

. .
[root@linuxbox linux-2.6.30.5]# shutdown -r now

.
192

15.

[root@linuxbox ~]# uname -r


2.6.30.5
[root@linuxbox ~]#

! :)

sysctl:
sysctl .
/proc/sys/.

sysctl :
[root@linuxbox ~]# sysctl -a

hostname .
[root@linuxbox ~]# hostname
linuxbox.company.ru
[root@linuxbox ~]# sysctl -a | grep kernel.hostname
kernel.hostname = linuxbox.company.ru
[root@linuxbox ~]# sysctl -w kernel.hostname=newbox.company.ru
kernel.hostname = newbox.company.ru
[root@linuxbox ~]# hostname
newbox.company.ru
[root@linuxbox ~]# sysctl -a | grep kernel.hostname
kernel.hostname = newbox.company.ru
[root@linuxbox ~]#

.
[root@linuxbox ~]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
[root@linuxbox ~]#


/etc/sysctl.conf =.
15.

193

16. Linux

/etc/

/etc/aliases

/etc/anacrontab

/etc/at.deny

/etc/bashrc

/etc/blkid/blkid.tab
/etc/crontab

/etc/cron.deny

/etc/cron.hourly/
/etc/cron.daily/

194

MTA (Mail Transfer Agent)


sendmail.
newaliases

anacron.
anacron
.
cron,
24
at. at
. /etc/at.allow
at ,
. /etc/
at.allow
/etc/at.deny
at
bashrc,
.

bash
- blkid,


cron. cron

cron. /etc/cron.
allow crontab
, .
/etc/cron.allow
/etc/cron.deny

crontab
cron

cron

16. Linux

/etc/cron.weekly/
/etc/cron.monthly/
/etc/cups/
/etc/exports

/etc/ilesystems

/etc/fstab
/etc/group

/etc/grub.conf
/etc/gshadow
/etc/host.conf

/etc/hosts
/etc/hosts.allow

/etc/hosts.deny

/etc/inittab
/etc/inputrc
/etc/issue

cron

cron

- CUPS
NFS,

mount.

,



,
. :
< >:< >:<GID>:<
>
/boot/grub/grub.conf.
GRUB

.
.
/etc/
hosts DNS-
<IP-> <
>

tcpd.

INET

tcpd.

INET
, INIT
runlevel


mingetty
welcome

16. Linux

195

/etc/issue.net

/etc/login.defs
/etc/logrotate.conf

/etc/logrotate.d/
/etc/logwatch/

/etc/mail/
/etc/man.conig
/etc/mime.types

/etc/modprob.conf

/etc.modprobe.d
/etc/motd
/etc/mtab
/etc/nsswitch.conf

/etc/ntp.conf
/etc/pam.conf
/etc/pam.d
/etc/passwd
/etc/printcap
/etc/proile

196

mingetty
welcome
telnet

(shadow)
logrotate,
,

logrotate
logwatch. logwatch
,

sendmail
man
MIME- (Multipurpose Internet Mail
Extension,
Internet) - CUPS
modprobe,
/


modprobe
.




,


ntpd (Network Time
Protocol Daemon)
pam - Pluggable
Authentication Modules for Linux

.
- CUPS
.


16. Linux

/etc/protocols
/etc/rc.d/
/etc/redhat-release
/etc/resolv.conf
/etc/securetty
/etc/services
/etc/shadow
/etc/shells
/etc/skel/

/etc/ssh/
/etc/sudoers

/etc/syslog/
/etc/sysctl.conf
/etc/syslogd.conf
/etc/termcap
/etc/vimrc
/etc/wgetrc
/etc/X11/
/etc/xinetd.d/
/etc/yum.conf
/etc/yum.repos.d/



Linux
DNS-


root


(shells)

SSH

.

visudo


syslogd

vim
wget
X Window

xinetd
yum
yum.
.repo

16. Linux

197

~/.bash_logout
~/.bash_history
~/.bash_proile
~/.bashrc
~/.emacs
~/.forward
~/.pinerc
~/.muttrc
~/.vimrc
~/.netrc
~/.rhosts
~/mbox
~/.ssh/


shell
emacs
e-mail

pine
mutt

vim
ftp
r: rlogin, rsh ..

ssh

badblocks
debugfs
df
du
dump

dumpe2fs
e2fsck
e2label
exportfs
fdisk
198







ext2/ext3
.
restore

ext2/ext3
ext2/ext3


16. Linux

fsck
hdparm
mkfs
mkfs.ext3
mkswap
mount
restore
swapon
swapof
sync
tune2fs
umount

.

/

ext3
swap-

dump
swap-
swap-

ext2/ext3

cd
chmod
chown
chgrp
cksum
md5sum
cp
dd
dir
dircolors
ile
ind
install
ln
locate
ls
mkdir
mknod
mktemp
mv
pwd






md5



ls




mlocate





16. Linux

199

rm
rmdir
stat
test
touch
vdir
whatis
whereis
which





.


whatis
, man-

ed red
emacs
head
joe
less
more
nano
tail
vi
vim



N . 10




N . 10

vi

ar
bunzip2
bzcat
bzip2
bzip2recover
cpio
dump

gunzip
200

,
bz

bz
bz-
/
ext2/ext3
.
restore
gz
16. Linux

gzexe

gzip
tar
unzip
zcat
zcmp
zdif
zgrep
zmore
znew
zip

.
.

gz
tar
zip





Z gz
zip-

basename

cat
cmp
colrm
column
comm
csplit
cut
dif
dif3
dirname
echo
egrep
expand
expr
false
fgrep
fold

.
basename /usr/bin/ind
ind












grep -E

,

,
grep -F

16. Linux

201

join
grep
logname
look
mkifo
nl
od
patch
paste
printf
rev
script
sdif
sed
sleep
sort
split
strings
tac
tee
tr
true
tsort
ul
unexpand
uniq
uudecode
uuencode
wc
xargs
yes

202

















.



,

,





.




/
/
,

y

16. Linux

apropos
help
info
locate

man
manpath
which

whatis
builtin- bash
info
info
locate
updatedb

at
atq
atrm
atrun
batch

crontab
nice / renice
nohup
watch

cron
at

at





hangups

bg
fg
jobs

16. Linux

203

kill
killall
pidof
ps
pstree
top
CTRL+C
&



ID




arp
dig
inger
ftp
ifconig
ifdown
ifup
netstat
nslookup
ping
portmap
rcp
rlogin
route
rsh
showmount
tcpd
tcpdump
telnet
traceroute
204

/ arp cache
DNS-

FTP



, ,

DNS-
ICMP ECHO_REQUEST
DARPA RPC .
RPC calls. NFS




NFS-

telnet,
inger, ftp, exec, rsh, rlogin, tftp, talk ..

telnet

16. Linux

env
export
printenv
reset
set
unset




runtime

ldconig
ldd
ltrace

depmod
dmesg

insmod
lsmod
modprobe
modinfo
rmmod
sysctl

,
modprobe

,
Linux


,
,
depmod


16. Linux

205

exit
halt
init
logout
powerof
reboot
runlevel
setsid
shutdown
telinit

mesg
quota
quotacheck
quotaof
quotaon
setpci
setserial
setterm
setup
stty
swapon
swapof
tset






PCI






arch
df
206



16. Linux

du
free
ipcrm
ipcs
lsof
lspci
procinfo
pstree
runlevel
strace
tload
tty
uname
vmstat


PCI
/proc






( , ,
,)

cal
date
hwclock
tzselect
uptime


(CMOS)
(time zone)
( uptime)

ac
accton
adduser
chage


( ,
)

16. Linux

207

inger

inger. /etc/
passwd inger









gpasswd

/etc/group

groupadd

grpck
grpconv


/etc/gshadow /etc/group
shadow
C group group gshadow,
gshadow



UID GID


last,
/var/log/btmp


. process accounting






chfn
chgrp
chown
chpasswd
chroot
chsh
edquota
faillog

grpunconv
groupdel
groupmod
groups
id
last
lastb

lastcomm
lastlog
logname
newgrp
newusers
passwd
pwck
208

16. Linux

shadow passwd
shadow
quota

quotaof

quotaon

quotacheck

repquota

su

sulogin
init,

ulimit

useradd

userdel

usermod

users

utmpdump
vigr

vipw

w

wall

write

who

whoami
ID
pwconv

lpr
lpoptions
lpc
lpq
lprm
pr
tunelp







lp

16. Linux

209

cdrecord
cdrwtool
mkisofs

CD/DVD
CD-R, CD-RW DVD-R
.iso

alias
history
mc
nc
sleep
screen
unalias

210







. sleep 2
2
VT100/ANSI
alias alias

16. Linux

Вам также может понравиться