6.3.1. ()
, (shell).
, , $ ( ). . . command.com DOS, . (). Linux :
- bash linux. ;
- pdksh korn shell, UNIX .
Bash (Bourne Again Shell). , :
echo $SHELL
. Bash. .
6.3.2. Bash
bash . , , :
- Ctrl + A ;
- Ctrl + U ;
- Ctrl + C .
; , . x , . , , Ctrl + R.
, , . history. :
!
:
!!
.
. , Bash .
Tab, , . , , bunzip2. :
bu
Tab. , , , .
Tab , , bu.
, :
$ bu
buildhash builtin bunzip2
: n (bunzip , n), . , Enter, .
, , , Bash , PATH. , ./ ( ) ( , . ), , prog , :./prog.
|
|
6.3.3. Bash
, , . man. :
man ls
6.3.3.1. su
. su, (root). Enter: . , exit.
6.3.3.2. cd
. , . , docs. :
cd docs
/usr/bin, ( ):
cd /usr/bin/
:
cd..
( cd ..);
cd -
. cd .
6.3.3.3. ls
ls (list) . :
- -a , ;
- -l .
6.3.3.4. rm
.
, !
:
rm [] _
. : -i , -r (.. , ).
:
rm -i ~/html/*.html
html html.
6.3.3.5. mkdir rmdir
mkdir , rmdir , , .
:
mkdir _
rmdir _
rmdir rm -rf, , .
6.3.3.6. less
less .
:
less _
, . q.
6.3.3.7. grep
.
:
grep _
6.3.3.8. ps
. , PID ( ) ( , , kill).
:
ps
u , ax , (, , .).
6.3.3.9. kill
, , .
:
kill PID_
kill -9 (kill -9 PID_), kill . PID ps.
|
|
6.3.
AltLinux . , .
. , & . . , . , . , :
fg _
. Alt , F1 F6. , . , , , .
7.
Linux : . , .
Linux, . , Linux , , . Linux ( ). . , , . , Linux: , , , , .
8.
, , , , . , (Enter). Linux , .
, . -, . (, , ) .
, , ( - shell).
, , . . .
. , . . Ctrl + Alt ( F1 F6). . , . Alt + F1 Alt + F6. Alt + F7.
|
|
Linux, . , Linux , , . Linux ( ). . , , . , Linux: , , , , .
, Linux, , .
, , . , . -, $. : , , . Enter, .
8.1.
, , cal, .
$ cal
2012
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
8.2.
$ cal 4 2012
2012
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
cal 4 2012 cal . , ( ) . , , .
8.3.
-. , ( ), ( ). , date, -u ( --universal).
[user@localhost user]$ date
12 16:10:02 FET 2012
[user@localhost user]$ date -u
12 16:10:02 UTC 2012
. . (, , ), , . . .
|
|
, :
- -, . -, , , , , . .
- --, . --, .
, , .
, --help. , , rm, , rm --help.
9.
9.1. ?
Linux , Linux. Linux , , . .
Linux , . . .
Linux root. root. root, . . .
9.2. ?
, , Synaptic , . .
9.3. ?
, , .
root.
su (shell of user), . sh root, . , , su, , , .
su, sudo, .
su sudo, wheel. , , .
9.4. ?
su -.
su , root. , $PATH, , : $PATH /sbin, /usr/sbin, route, shutdown, mkswap . , $HOME , , , root , .
, su -. su login shell, , root.
10.
10.1.
Linux, UNIX . , , . UID GID, .
|
|
. , . , , id, :
uid=500(test) gid=500(test) =500(test),16(rpm)
, test ( 500) test rpm. ; , .
, SUID-, SGID-, .
10.2. passwd
passwd passwd shadow.
: passwd [...] [ ]
:
- -d --delete ;
- -f, --force ;
- -k, --keep-tokens ;
- -l, --lock ;
- --stdin ;
- -S, --status ;
- -u, --unlock ;
- -?, --help ;
- --usage ;
- -V, --version .
: passwd 0. 1 , . .
10.3.
useradd passwd:
[root@localhost root]# useradd test1
[root@localhost root]# passwd test1
passwd: updating all authentication tokens for user test1.
You can now choose the new password or passphrase.
A valid password should be a mix of upper and lower case letters,
digits, and other characters. You can use an 8 character long
password with characters from at least 3 of these 4 classes, or
a 7 character long password containing characters from all the
classes. An upper case letter that begins the password and a
digit that ends it do not count towards the number of character
classes used.
A passphrase should be of at least 3 words, 11 to 40 characters
long, and contain enough different characters.
Alternatively, if no one else can see your terminal now, you can
pick this as your password: "holder5dinghy-Arm".
Enter new password:
test1 . , ( ). passwd , ( root) .
AltLinux PAM passwdqc.
useradd , . , , UID .
10.4.
usermod:
usermod -G audio,rpm,test1 test1
, test1 audio, rpm, test1.
usermod -l test2 test1
test1 test2.
usermod -L test2 usermod -U test2 test2 .
.
chpasswd. , :.
10.5.
userdel.
userdel test2 test2 . -d, . , .
vigr vipw /etc/passwd /etc/group, .
. . ( chmod chown).
11. systemd sysvinit
11.1.
11.1.1.
:
- BIOS
- ( LILO, grub ).
- Linux
- init
init. Ÿ . , init , pstree.
init , .
11.1.2.
, .
, sysvinit . systemd sysVinit.
systemd ( system daemon).
11.2. systemd sysvinit
11.2.1. sysvinit
System V , . : init /etc/inittab, .
11.2.2. systemd
systemd Linux, System V init launchd (OS X), SMF (Solaris) Upstart (Ubuntu, Fedora), . , , .
systemd (system daemon) . , , . (-- , ) ( ). cgroups, .
systemd . sysvinit, .
11.2.3. systemd
systemd ALT Linux Wiki: http://www.altlinux.org/
11.3. , systemd
, service chkconfig systemd . systemctl.
56.1.
Sysvinit | Systemd | |
service frobozz start | systemctl start frobozz.service | ( ) |
service frobozz stop | systemctl stop frobozz.service | ( ) |
service frobozz restart | systemctl restart frobozz.service | |
service frobozz reload | systemctl reload frobozz.service | , |
service frobozz condrestart | systemctl condrestart frobozz.service | , |
service frobozz status | systemctl status frobozz.service | , |
ls /etc/rc.d/init.d/ | systemctl list-unit-files --type=service (preferred) ls /lib/systemd/system/*.service /etc/systemd/system/*.service | , . . |
chkconfig frobozz on | systemctl enable frobozz.service | , |
chkconfig frobozz off | systemctl disable frobozz.service | , |
chkconfig frobozz | systemctl is-enabled frobozz.service | , |
chkconfig --list | systemctl list-unit-files --type=service(preferred) ls /etc/systemd/system/*.wants/ | . , () |
chkconfig frobozz --list | ls /etc/systemd/system/*.wants/frobozz.service | , () |
chkconfig frobozz --add | systemctl daemon-reload | , |
11.4. systemd
systemd . journalctl. , syslog.
journalctl :
- journalctl -a - ;
- journalctl -f - .
:
- journalctl _PID 1 - (init).
, journalctl. man journalctl.
12. Linux.
- , . - , . , - , , . - , , . .
, . . , : - (, ), , (, ). , , - , .
. , .
.
12.1. ?
? -, , , , - . : , , , , , . , ( ).
-, : , , . , , . . , , , : .
-, - , , , , - . , , , ( , () , , - ?). , : 1 , 2, 4, , , .
, . , , , -. , , . : , , () USB, , - . ?
, , : , , , , . , , . , , : .
12.2. ?
. , ?
, (, USB, flash-) - , ( USB-, USB- ..). :
- ;
- (, , );
- / .
(bus). , , , , ̻.
( ). , - ( ). , : , .
, . , , PCI . , PCI lspci ( list PCI, pciutils):
[tmpuser@arnor tmpuser]$ lspci
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8377 [KT400/KT600 AGP] Host Bridge (rev 80)
0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge
0000:00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)
0000:00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)
0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]
0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
0000:00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 78)
0000:01:00.0 VGA compatible controller: ATI Technologies Inc Radeon R100 QD [Radeon 7200]
Radeon 72002 , ( - ). Multimedia audio controller, Ethernet controller, VGA compatible controller .. , .
PCI USB, . , , . lsusb ( , , usbutils), , lspci, ( /usr/sbin):
[tmpuser@arnor tmpuser]$ /usr/sbin/lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 002: ID 046d:c00c Logitech, Inc. Optical Wheel Mouse
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 003: ID 08ec:0012 M-Systems Flash Disk Pioneers
Bus 001 Device 001: ID 0000:0000
USB- ( lspci), flash-, . , , , , . , flash- usb_storage, /media/usbdisk.
/sys . , /sys/bus/ /devices. , , PCI USB, , ( , ..).
: (, , ) , . , - ?
12.3. ?
, , , ? : , , . USB, ? , ? , 3d!?
. , : .
:
- , , . , , PCI- USB-. modprobe _ ( insmod). (, - ) /sys/class/ _ /.
- X11 (X.Org). , X.Org ( /etc/X11/xorg.conf). (, ), .
- , , -. , .
- (plug-in) (, sane, iRiver ifp ifp-line). , , , .
, , ( , ). , .
12.4. ?
Linux (device) , /dev. ?
, , - / . , . () , , : . , . , , , .
Linux. , , hotplug, , , /dev , , . -, , , , . , - /dev/fd0, ( floppy disk 0), /dev/mouse ( /dev/mouse - /dev/psaux, PS/2).
- (device), - . /dev/ , , .
, -, , . , , , /dev/ttyS1 ( ttyS0). , ttyS - , , .
USB. USB- , . , , - usbdev.., . flash-; - (, /dev/sda /dev/sda1, /media/usbdisk). , : , / . , , gphoto2. -, /dev/usbdev. . , , gphoto2.
12.5. ?
, , , , .
( /sys/bus lspci, ).
Hotplug ( modprobe, /etc/modules.conf).
, , udevd, - /dev, ( /dev , , udev ).
, Linux . , ( , , , ..).
, ( lspci , http://www.google.com). , ( , , ) , .
, . , : , , . , Linux- . ( , ) , , , . , , Linux.
, , , , . , , Linux, . : , Linux-! , , .
13.
Linux , . . .
: , , , .
13.1.
UNIX, Linux, . Ÿ , , . ., .
13.1.1. Man
man ( manual). . , man _. , , date, :
$ man date
, , . . , , , .
man apropos. , , , , apropos date , , man -k (, man -k copy). , , . man .
, , . , man . , man q. man man man.
. , , Linux. , , , , ! , , , .
, . man-pages-ru. , , , man .
13.1.2. Info
Linux info. , , , . info , . info , , ( *). h. info info info. info, , info, .
13.2.
, , /usr/share/doc .
, /usr/share/doc/_. , foo-1.0-alt1 /usr/share/doc/foo-1.0-alt1. , , rpm -qld __.
README, FAQ, TODO, hangeLog . README , , . FAQ ; , , , , FAQ . TODO . hangeLog .
, , rpm -qi __. , , .
, , Linux. HOWTO HTML ( . how to ) /usr/share/doc/HOWTO/ ( ) Linux-.
13.3. ,
, , , , . , .
, , , . , , - ( F1), , .