8
LINUX
: ( ), .
:
: .
: VirtualBox, Linux, Microsoft Word.
:
addgrup, ,
addgroup g301
adduser. ,
adduser anton
passwd anton
, passwd, group /etc . . : , , , , , , . , anton:*:100:1000::/home/usr:/bin/bash
: , , , . , g301:*:1000: anton
, userdel, delgroup .
, , chown, chgrp. ,
chown user file1 chgrp it402 file1
passwd, ,
passwd anton
, , .
2.
: , , , . , , (, , ). . chmod.
, , . uname. touch ls:
$ touch file
$ ls l file
-rw-rw-r-- 1 bbal bball 0 jul 23 12:28 file
ls .
: -rw-rw-r--. . , , d , c , b - .
, . - . : r , w x .
|
|
.
. , , . chown.
, . , .
().
: . : u (), g , o a . : r , w x . r, w x :
User Group Others
rwx rwx rwx
, 8- . :
4 ;
2 ();
1 .
(-rw-rw-r--) 664. : , .. (4+2), (4+2) ( 4).
Linux, UNIX, . , ls, :
$ mkdir foo
$ ls ld foo
drwxrwxr-x 2 bball bball 4096 jul 23 12:37 foo
mkdir . ls ld , , . , 775 ( 4+2+1, , 4+1).
, . . ( , ).
, ls d. , ; . . , ls , :
$ ls l /dev/ttyS0
crw-rw---- 1 root uucp 4,64 Mar 23 23:38 /dev/ttyS0
/dev/ttyS0 ( ); root uucp. 660 (+, +, ).
chmod. , . chmod ( (+) , ):
|
|
u ( ) - () .
g ( ) .0
o ( ) .
a ( ) (all).
r ( ) .
w ( ) .
x ( ) .
, . , , , readme.txt, , ( unmask /etc/bsdhrc);
-rw-rw-r-- 1 bball bball 12 Oct 2 16:48 readme.txt
, . Chmod:
$ chmod aw readme.txt
$ ls l readme.txt
-r--r--r-- 1 bball bball 12 Oct 2 16:48 readme.txt
. , , /tmp, . , :
$ chmod u+rw readme.txt
$ ls l readme.txt
-rw------- 1 bball bball 12 Oct 2 16:48 readme.txt
, chmod. chmod , 600:
$ chmod 600 readme.txt
, , , , , (, , root, ). .
root
UNIX Linux root, , . , , . root, rm:
# rm fr /
, . root.
Linux root , .
, useradd :
# useradd winky
passwd :
# passwd winky
Changing password for user winky.
New password: Retype new password:
Passwd: all authentication tokens updated successfully.
, . , useradd D:
# useradd D
Group=100 HOME=/home INACTIVE=-1 EXPIRE=
SHELL=/bin/bash SKELL=/etc/skel
, , ( , ), , , .
|
|
userdel. , , /etc/passwd. (, /var/spool/mail), -r:
# userdel r winky
.
shutdown. , , . , h halt:
# shutdown h now
# shutdown h 0
Linux .
, Linux. . .
shutdown. , r (reboot); now 0 ():
# shutdown r now
# shutdown r 0
, , halt reboot.
:
1. Linux.
2. Linux root.
.
- Bash. Windows. : dsl@box:~$
sudo su: dsl@box:~$ sudo su
:
[/home/dsl]#
# , - root.
whoami ( , ). root . exit.
3. .
root.
student ( useradd
passwd): Useradd student
Passwd student
passwd student, :
Enter new password:
( 5 ) <Enter>. , , . :
Re-enter new password:
,
student. <Enter> :
Password changed.
, , , login:
[home/dsl]# login Box login: student Password:
: student@tty0[/]$
whoami , - student.
logout.
4.
: cd /
ls dir.
ls : ls l
|
|
5. Midnight Commander
Bash. ATerminal . mc.
Midnight Commander, Norton Commander FAR Manager. . , . , Linux. , ( ) . .
, Midnight Commander:
3. Midnight Commander
TAB | |
F3 | |
F4 | |
F5 | |
F6 | () |
F7 | |
F8 | |
F9 | |
F10 | |
CTRL+O | |
CTRL+U | |
Insert | |
( Num Lock) |
(), Page Up, Page Down.
. 3 : , , <Enter>.
. , /..
/ramdisk
/ramdisk student.
/ramdisk/student ~home ( /)
Midnight Commander, F10.
6.
bash.
/ramdisk/student cd: dsl@box:~$ cd /ramdisk/student
dsl@box:/ramdisk/student$ : dsl@box:/ramdisk/student$ cd / dsl@box:/$
( ~):
dsl@box:/$ cd ~
dsl@box:~$
7. Vi
bash.
/ramdisk/student
/ramdisk/student file1.txt: dsl@box:/ramdisk/student$ vi file1.txt
a, i o. <Insert>. , . . . <Enter>.
. <Escape>;
: wq <Enter>.
. cat:
dsl@box:/ramdisk/student$ cat file1.txt
8.
/ramdisk/student.
file1.txt file.txt.
file.txt file2.txt.
file.txt.
file2.txt , .
9.
/ramdisk/student
, file2.txt. ls:
dsl@box:/ramdisk/student$ ls l file2.txt
-rw-rw-r-- 1 dsl staff 111 Nov 18 06:41 file2.txt
file2.txt : , , :
dsl@box:/ramdisk/student$ Chmod 777 file2.txt
10.
Linux . . . root.
ifconfig ( Interface Confuguration).
ifconfig <ENTER>.
ip- . :
[/home/dsl]# ifconfig eth0 192.168.192.130
ip- 192.168.1.130. ifconfig :
|
|
[/home/dsl]# ifconfig
, eth1, eth2
- ( TCP/IP
) Ping. :
[/home/dsl]# ping 192.168.192.130.
, Ctrl+C.
11.
.
cd. help cd
: dir, su, help.
12.
. bash. root. reboot.
Linux. bash halt.
4.
UNIX : , , , , , , , . , , . ls l.
: ; ; .
, , . . , , . chmod.
: chmod <> <>
chmod: chmod 777 myfile.com
.
. , . chmod.
: chmod <> <>
: W op D,
W : u ; g ; a ; o . op :
+ ;
- ;
= .
D :
r ;
w ;
x .
:
chmod u+x file1 .
chmod u+w g-r file2 - , .
chmod a+rwx file3 .
:
1. . /home .
2. : CAT, VI, TOUCH. /home . , ( /home).
3. : ( ).
4. /home . .
5. . . : ( ).
6. /home . .
7. . . : , ( ).
8. /home . .
9. 6, 9 . .
10. : ( ).
11. . .
12. VI. . . .
13. : ( ).
14. . .
15. (, , CAT). : , , ( ).
16. . .
17. . . .
18. . .
19. . . . .
20. . , .
:
Linux?
, ?
?
?
vi?
, ?
vi?
vi?
vi ?
?
, ?
?
, ; ?
Linux?
, ?
Linux?
Midnight Commander?
Linux root?
, 762?
, ?
Linux?
:
, 112 .
.
. 3 () 111, 4 () 116, 5 () 120.
.