+ All Categories
Home > Documents > 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1...

2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1...

Date post: 12-Jun-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
112
Linux 2005 6 Linux – p. 1
Transcript
Page 1: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Linux ö�XÚ¦^

o¬¬

2005c 6�

¥I�� �N�(�ïÄ¿

Linuxö�XÚ¦^ – p. 1

Page 2: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

SN• 1�ÙVã

• 1�ÙXÚ�$1

• 1nÙ©�Ú8¹

• 1oÙ shellÄ:• 1ÊÙ vim• 18Ù?§

• 1ÔÙ Linuxóä• 1lÙ?Èì

• N¹�ä©�

Linuxö�XÚ¦^ – p. 2

Page 3: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1�ÙVã• £ã Linux�uÐÚCz• 0� Linuxö�XÚ�Ì�|¤Ü©

Linuxö�XÚ¦^ – p. 3

Page 4: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Linux A:• õ?Ö!õ^r�ö�XÚ

• õU´L��*Ð!m��O��¸

• �?§ shell

Linuxö�XÚ¦^ – p. 4

Page 5: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Linux �Ì�|�• SØ

• �¸

• ©�(�

Linuxö�XÚ¦^ – p. 5

Page 6: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

shell• LinuxÚ^r�.¡• A«~�� Shell

• Korn• Bourne• C

• "�� Shell —- Bash• ·-)ºì

Linuxö�XÚ¦^ – p. 6

Page 7: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1�ÙXÚ�$1• �¹9òÑXÚ

• ?U�è

• Linux�·-(�

Linuxö�XÚ¦^ – p. 7

Page 8: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�¹9òÑXÚ• �/�¹µ©�½ X .¡• �§�¹µssh½ telnet

• ssh team01@HostIPteam01@HostIP’s password: ******

• telnet HostIPLogin: team01Password: ******

• òÑXÚµexit½ ctrl+d

Linuxö�XÚ¦^ – p. 8

Page 9: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�è• Mï½öUC�èµ3XÚJ«ÎeÑ\ passwd$passwdteam01’s old password:team01’s new password:Enter the new password again:

Linuxö�XÚ¦^ – p. 9

Page 10: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

·-��ª$command options argumentsFor Example :$mail -f newmail

�( �Ø

©l

$mail -f newmail $mail - f newmail^S

$mail -f newmail $mail newmail -fõëê

$who -m -u $who -m-u$who -mu $who -m u

Linuxö�XÚ¦^ – p. 10

Page 11: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�\·-• 3 shellJ«ÎeÑ\·-§,�U Enter�• shell£O���• XéØ�Ñ\�·-§¬w«�"&Eµ/Command not Found0

• X·-��§�3ù11��\/\0iÎÚUe Enter�§3e�1�/>0��XÑ\

Linuxö�XÚ¦^ – p. 11

Page 12: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

���¯$�ª• <ctrl-c>µÊ�·-• <ctrl-d>µ(åDѽö©�• <ctrl-s>µ��Ê�ÑÑ• <ctrl-q>µ¡EÑÑ

• <ctrl-u>µÞØ1I±c�• <ctrl-k>µÞØ1I±��• <backspace>µÅ��Ø

• <ctrl-r>µ3±c�·-¥|¢

Linuxö�XÚ¦^ – p. 12

Page 13: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1nÙ©�Ú8¹• £ã Linux©�XÚ�(�• £ãØÓ�©��ª

• ©��ýé´»Ú�é´»

• Mï!íØÚ�Ñ´»

• E�!w«!�<!£Ä!íØÚë�©�

Linuxö�XÚ¦^ – p. 13

Page 14: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�XÚ��g(�

/

home usr bin dev var etc tmp

team01 bin local

Linuxö�XÚ¦^ – p. 14

Page 15: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Linux ¥�IOXÚ8¹/ ©�XÚ(��å©:§¡��8¹

/home �¹^r�Ì8¹

/bin �¹¤k�IO�-Úóä§S

/usr �¹XÚ¤¦^�©�Ú�-

/usr/bin �¹¡�^r�·-Úóä§S

/usr/lib �¹?§�ó¥

/usr/local �¹�5SC�^�

/usr/doc �¹Linux©�

/usr/man �¹3��éÅ�ÏÃþ

/usr/sbin �¹XÚ+n�·-

/sbin �¹XÚ+nméXÚ�·-

/opt �¹�5SC�^�

/var �¹�C�©�§~Xe�©�

/dev �¹���©���

/etc �¹XÚ��©�Ú¤kÙ§XÚ©�

/cdroom 1�

Linuxö�XÚ¦^ – p. 15

Page 16: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�XÚ�Vg• ©�XÚµ^�þkA½�ª��¡«�"

• ©�µ�;êâ���·¶�é�"

• 8¹µ�¹Nõ©��8��aAÏ©�"

• f8¹µ��¹3,��8¹¥�8¹§�¹f8¹�8¹¡�I8¹"

• ©�¶µ^5I£©��iÎG§��3��8¹©��¥"

• ´»¶µd//0iÎ(Ü3�å���½õ�©�¶�8Ü"§�½��©�3©�XÚ¥� �"

Linuxö�XÚ¦^ – p. 16

Page 17: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�(�

ÃØ©�´��§S!©�!êâ¥!½´8¹§ö�XÚѬD�§e¡�(�µ

• -¢Ú!:£I !:¤µ3©�XÚ(�¥§�¹k'�A©�&E£©���!©�Ì!©����¤���P¹"

• -ê⵩��¢SSN"

Linuxö�XÚ¦^ – p. 17

Page 18: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Linux ©�¶¡• �¹���!���!êi!$!@!_• ��Ø�¹±eiε* ? > < / ; $ \’ "• ��ØU±/+0½ö/-0mÞ• «©���

• ��©�¶ 255

Linuxö�XÚ¦^ – p. 18

Page 19: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©��a.• ÊÏ©�

• 8¹©�

• ��©�µ/dev/tty1

• ë�©�µ��©�XÚ¥Ï�©��´»

• file©�¶µ�w©�a.

Linuxö�XÚ¦^ – p. 19

Page 20: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ÊÏ©�• �¡~5©�§�¹�«�Ý�iÎG"~Xµ&�!�wÚ��"

• ©�©�µd ASCIIiÎ�¤"• êâ©�µd5gA^§S�êi.Ú©�.êâ�¤"~Xµ>fL�!êâ¥�"

• ��1��?�§SµdÅì�-Úêâ�¤"

Linuxö�XÚ¦^ – p. 20

Page 21: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

8¹©�• d¤é�/ I !:Ò/©�¶0�¤��L"|^8¹©��±�¤©�XÚ�©�ä/(�"

• I !:Ò´u¢ I !:L�eI§I !:��¤k©��G�&E

• ©�¶´���©�©��©�/ª�iÎG§^5I£©�"

Linuxö�XÚ¦^ – p. 21

Page 22: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

´»�¶¡

a.µ

• ýé´»

• �é´»

Linuxö�XÚ¦^ – p. 22

Page 23: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

8¹ö�·-

ls w«8¹¥�SN

pwd w«�cÚó�8¹

cd UC^ró�8¹

mkdir ïá^r8¹rmdir íØ8¹

Linuxö�XÚ¦^ – p. 23

Page 24: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�Ñ8¹SN·- lsls·-�Ñ��f8¹¥��Ü©�Ú8¹¶"§k 26�·-1ëê§e¡�Ñ5�´§�~^�A�"ùëê�±?¿/|ܦ^"

• -1z�=w«��©�½8¹¶¡• -aw«¤k©�½8¹§�)±/.0�¶¡mÞiÎ�©�!y18¹/.0�þ�8¹/..0

• -l ¦^�[�ª�L"ò��I«!M��ê8!Pkö�+|¶¡!©�½8¹��9�U�m�¿�Ñ

• -R48?n§ò�½8¹e�¤k©�9f8¹�¿?n

Linuxö�XÚ¦^ – p. 24

Page 25: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ls¦^��L�ª�Ñ,�f8¹¥��Ü©�§¦^e¡�·-µ[ root@glede /root ] $ ls -lat o t a l 16

drwxr−xr−x 4 r o o t r o o t 4096 Jan 1 11:28 .

drwxr−x−−− 11 r o o t r o o t 4096 Jan 1 11:27 . .

drwxr−xr−x 2 r o o t r o o t 4096 Jan 1 11:27 team011

drwxr−xr−x 2 r o o t r o o t 4096 Jan 1 11:28 team012

�Ñf8¹¥±i1 t�Þ��Ü�Ûõ©�§¦^e¡�·-µ[ root@glede /root ] $ ls t*

Linuxö�XÚ¦^ – p. 25

Page 26: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

w«�có�8¹·- pwd§vkëê§ §����^Ò´w«�có�8¹�ýé´»�¶¡"$pwd/home/team01

Linuxö�XÚ¦^ – p. 26

Page 27: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

UC^ró�8¹ cd• cd�-�±4^r3ØÓ�8¹m��§�T^r7Lkv���?\8�8¹

• cd [8¹¶]• cd ∼^r¶

• cd -µ�£?\ù�8¹�c¤3�8¹$pwd/home/eagle/tex/linux$cd ∼/phd$pwd/home/eagle/phd$cd -$pwd/home/eagle/tex/linux

Linuxö�XÚ¦^ – p. 27

Page 28: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ïá^r8¹·- mkdir• mkdir�ïá8¹Ó����8¹����"• mkdir [-p] [-m] [©�¶]

• -pe¤�ïá8¹�þ�8¹8cÿ�ïá§K¬�¿ïáþ�8¹

• -mïá8¹�§Ó���8¹���"�����{� chmod�-�Ó

• ïá8¹ team02§¿4�Ü<Ñk rwx���$lsteam01$mkdirõm 777 team02$lsteam01 team02

Linuxö�XÚ¦^ – p. 28

Page 29: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

íØ8¹·- rmdir• �k�8¹�íØ�§�^ rmdir�-"e¤���8¹��8¹§K¬Ñy�Ø&E"

• rmdir [-p] [8¹¶]

• -píØ�½8¹��§eT8¹�þ�8¹®C¤�8¹§KòÙ�¿íØ

Linuxö�XÚ¦^ – p. 29

Page 30: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�ö�·-

cp E�©�½8¹

mv £Ä©�Ú©��¶

rm íØ©�½8¹

ln 3©�mïáë�

find �éA½�©�

locate �éA½�©�which �w·-�´»touch UC©���mëê

Linuxö�XÚ¦^ – p. 30

Page 31: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

E�©�½8¹·- cp• cp·-^5E�©�"3"���¹e§ù�·-ó���ÿØ�?Ûw«¶�k3Ñy���Ø�¹��ÿâw«G�&E"

• cp [ ©�¶] ,,[8I©�¶]

• cp -r [ 8¹¶] [8I8¹¶]

Linuxö�XÚ¦^ – p. 31

Page 32: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

£Ä/­·¶©�·- mv• mv·-^5r©�l�� �£Ä�,�� �,��±l��©«£Ä�,��©«"

• mv [ ©��L] [8I©�]

Linuxö�XÚ¦^ – p. 32

Page 33: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

íØ©�½8¹ rm• rm [À�][©��L]• -ríØ©��L¥�8¹• -i �½�p�ª"3�1íØcJ«(@"• ©��LµF"íØ�^��©��©��L§�±�)8¹¶

Linuxö�XÚ¦^ – p. 33

Page 34: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

3©�mïáë� ln• ln·-^5ïáMë�ÚÎÒë�"Më�´��©����¶i§vk ©�§Më�BØU�3" éuÎÒë�§��©��íØ�§ÎÒë�E,�3"

• ln [À�] ©�8I©�• ln [À�] ©��L8I8¹

Linuxö�XÚ¦^ – p. 34

Page 35: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ln• -sïá��ÎÒë� Ø´Më�• -dïá8¹�Më�• yk©� file1§file2�8¹ team01§�3

team02¥ïáåÎÒë�$ln -s /home/file1 /home/file2 /home/team01 team02

• � dir3´��8¹�ÎÒë�§y3ïáÙMë� dir4$ln -d dir3 dir4

Linuxö�XÚ¦^ – p. 35

Page 36: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�é©�·- findfind·-�±�â�«u¢^��é©�• find [´»,] [L�ª]• ´»,µO�Ïé©�¤3�´»±9§�f´»§��±´õ�´»"

• L�ªµ�¹�|¢©��^�§�±�¹©�¶!Pkö!��?U�m�"

Linuxö�XÚ¦^ – p. 36

Page 37: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

find ~^ëê• -atime n�� n*24��Svk�¯L�©�• -ctime n�� n*24��Svk?UL�©�• -amin n n©¨�c�¯L�©�• -cmin n n©¨�c?UL�©�• -empty©���

• -name name�½�Ïé�©�½8¹�¶¡• -type xµ±©��a.��Ïé�^�"e x�/d0,KL«Ïé8¹¶x�/f0§L«ÏéÊÏ©�¶x�/c0,L«ÏéiÎAÏ��¶x�/b0,L«ÏéAϬ��¶x�/p0§L«Ïé·¶+�¶x�/l0,L«ÏéÎÒë�¶x�/s0§L«Ïé@�i"

Linuxö�XÚ¦^ – p. 37

Page 38: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

find Þ~• XJ��é /homef8¹¥�� 7Uvk��¯L�©�§�¦^e¡�·-:$find /home -atime 7 -print

• XJ�éÑ /usr/srcf8¹¥¶i� core�©�¿íا�§�¦^e¡�·-µ$find /usr/src -name core -exec rm { } \;

• XJ�éÑ /home¥± .jpg(�¿��Ý�L 100K�©�§�¦^e¡�·-µ$find /home -name "*.jpg" -size 100k

Linuxö�XÚ¦^ – p. 38

Page 39: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

locate/which• lê⥥|¢µlocate filename• �w·-�´»µwhich ls

Linuxö�XÚ¦^ – p. 39

Page 40: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

UC©���mëê touch• UC©��¯Ú?U�m§½^�½�mïá#©�"

• touch [À�] MMDDhhmmYY ©��L• -a��U�¯�m• -ce8I©�Ø�3§Øïá��8I©�

Ø�ëê� touch·-ò©���mU��c�m$ l s

−rw−r−−r−− 1 r o o t r o o t 37350 Jan 27 2003 f i l e 1

$ touch f i l e 1

−rw−r−−r−− 1 r o o t r o o t 37350 Jan 1 16:15 f i l e 1

¦^À�-t��?U�m$touch −t 01201500 f i l e 1

−rw−r−−r−− 1 r o o t r o o t 37350 Jan 20 15:00 f i l e 1Linuxö�XÚ¦^ – p. 40

Page 41: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�w«·-

cat w«ÚÜ¿©�

more ©¶w«©�less ©¶w«©�

head w«©��cA1tail w«©����A1

Linuxö�XÚ¦^ – p. 41

Page 42: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

w«ÚÜ¿©�·- cat�±(Üõ�©�§¿ò§��SNÑÑ�IOÑÑ��"cat [À�] [©��L]• -b�Ñ©�SN�§3¤k��x��mÞIþ?Ò§l 1m©\\

• -E3z�����Iþ/$0ÎÒ• -n�Ñ©�SN�§3z���mÞIþ?Ò§l 1m©\\

Linuxö�XÚ¦^ – p. 42

Page 43: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

catÞ~4 cat�-lIOÑ\��£X��¤Ö�êâ§= ÑÑ�IOÑÑ��£Xw«ì¤

• $ cat�1�-§Ø\?Ûëê123�\?Û©i�§Ue£��123XÚ£A�����©i|^AÏiÎ/>0ò¶¡� file1� file2�©�Ü¿¤��©� file3µ

• $ cat file1 file2 > file3e©� file3®²�3§KÙSN¬�CXL�¶�;�ù«G¹u)§�^/> >0�O/>0§#�SNÒ¬N\3�kSN��§ جCX§"

Linuxö�XÚ¦^ – p. 43

Page 44: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©¶w«©�·- more• more�ò©�SNw«u¶4þ§zg�w«��"�± eèA§�Ã{�þèA,less�-�±þeèA"

• more [À�] [©�¶]• w«¥U v§�N^ vi ��?1?6

Linuxö�XÚ¦^ – p. 44

Page 45: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©¶w«©�·- more• -<1ê>�½zg�w«�1ê• +/<iÎG>3©�¥�éÀ�¥�½�iÎG§,�w«iÎG¤3T��SN

• +<1ê>l�½�1êm©w«• -nzg�w« n1• -cØE¶§3w«e�¶�ck�¶• 3©� file1¥�é/1230iÎG§,�lU�m©w«©��SNµ$more +/123 file1

• w«©� file1�SN§z 101w«�g§ �3w«�ck�¶"$more -c -10 file1

Linuxö�XÚ¦^ – p. 45

Page 46: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©¶w«©�·- less• aq more§�'more�r��õ• w«¥U v§�N^ vi ��?1?6

Linuxö�XÚ¦^ – p. 46

Page 47: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

w«©��cA1·- head• 3¶4þw«�½©��mÞeZ1"%@�´ 101"

• head [À�] ©�¶• -c Nµw«c N�i!• -n Nµw«c N1

$head -5 file

Linuxö�XÚ¦^ – p. 47

Page 48: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

w«©����A1·- tail• 3¶4þw«�½©��"�eZ1"%@�´ 101"

• tail [À�] ©�¶• -c Nµw«c N�i!• -n Nµw«c N1• +Nµl©�mÞ�1 N1m©w«

Linuxö�XÚ¦^ – p. 48

Page 49: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

'�©�SN·-

comm '�ü�®üLS�©�

diff '�©���É

Linuxö�XÚ¦^ – p. 49

Page 50: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

comm·-• ^5éü�®üLS�©�?1Å1'�

• comm [-123] file1 file2• -1Øw«�31��©�pÑy�1• -2Øw«�31��©�pÑy�1• -3Øw«31�!��©�pÑÑy�1

Linuxö�XÚ¦^ – p. 50

Page 51: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

commfile1�SNXeµfile2�SNXeµ

main ( main (

{ {

p r i n t f ( " He l lo ! \ n " ) ; p r i n t f ( " Good ! \ n " ) ;

} }

^ comm·-éùü�©�?1'��w«§��k�1"

$comm −12 f i l e 1 f i l e 2

main (

{

}

Linuxö�XÚ¦^ – p. 51

Page 52: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

diff ·-• '�ü�©�©�§¿w«§��ØÓ

• diff [À�] file1 file2• -cÑÑ�ª´�þe©�n1�ª• -C nÑÑ�ª´�þe©� n1�ª• -rü�©�Ñ´8¹�§48'�é���f8¹

Linuxö�XÚ¦^ – p. 52

Page 53: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

diff• ÑÑ���/ªXeµ

n1 a n3,n4n1,n2 d n3n1,n2 c n3,n4

• a-N\§d-íاc-?U• file1�SNXeµfile2�SNXeµ

1main ( ) 1 main ( )

2{ 2 {

3 p r i n t f ( " He l lo ! \ n " ) ; 3 i n t n ,m;

4} 4 n =10;

5 5 p r i n t f ("%d \ n " ,m=n* 1 0 ) ;

6}

Linuxö�XÚ¦^ – p. 53

Page 54: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

diffÑ\·-$diff file1 file2

3 ,5 c 3 ,6<3 p r i n t f ( " He l l o ! \ n " ) ;<4 }<5−−−

>3 i n t n ,m;>4 n =10;>5 p r i n t f ("%d \ n " ,m=n* 1 0 ) ;>6}

Linuxö�XÚ¦^ – p. 54

Page 55: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©���ö�

chmod UC©�½8¹�N���chown UC©��¤k�chgrp UC^r©|

Linuxö�XÚ¦^ – p. 55

Page 56: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©���oÚ��

rwx rwx rwxu s e r group o t h e r s

��ÊÏ©�• rµ�±�w©�SN• wµ�±?U©�SN• xµ�±�1©�

��´»

• rµ�±�w©�Ye�©�• wµ�±3©�YeMïÚíØ©�• xµ�±?\©�Y½ö�¯©�Ye�©�

Linuxö�XÚ¦^ – p. 56

Page 57: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

��

user group othersÎÒ rwx rw- r–�?� 111 110 100l?� 7(4+2+1) 6(4+2+0) 4(4+0+0)

"��©���µfile -rw-r–r– 644directory drwxr-xr-x 755

Linuxö�XÚ¦^ – p. 57

Page 58: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

UC©�á5·- chmod• ^5UC©�½8¹���

• chmod [À�] �ª©��L

Linuxö�XÚ¦^ – p. 58

Page 59: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

UC©����• u :©�¤áár• g :©�¤á|

• o :Ù{ár• + :V\��• - : �Ø��• = :¦��½©��äkù��

Linuxö�XÚ¦^ – p. 59

Page 60: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

chmod• ¦©� file3��?OPk¤k��

$chmod 777 file• #N¤k<Ö file§��kPköUUC§

$chmod 644 file• �¤k<O\��

$chmod a+w file• é|?ÚÙ¦^rØ���ÚÖ�

$chmod o-wr,g-wr file

• ïáÙ¦^r��Ö�$chmod o=r file

Linuxö�XÚ¦^ – p. 60

Page 61: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

UC©��¤k�·- chown• chown·-�±r��©��¤k�?U�O<�"�k root^rU?1ù��ö�"

• chown [À�] ^r©��L• -v�[`²¤k��Cz• -r48UC8¹9ÙSN�¤k�

Linuxö�XÚ¦^ – p. 61

Page 62: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

UC^r©|·- chgrp• chgrp·-�±UC��©��^r©|���¹

• chgrp [À�] ^r©��L

• -v�[`²©�¤á�^r|�Cz• -rUC�8¹9Ù¤kf8¹¥�©�¤á�^r|

Linuxö�XÚ¦^ – p. 62

Page 63: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1oÙ vi/vimü«�ªµ

• ·-�ªµl��þÑ\�?ÛiÎÑ���?6·-5)º§U<ESC>?\d�ª"

• Ñ\�ªµl��þÑ\�¤kiÎÑ��\��3?6��À«¥§����©§Ua!i!c!o�?\d�ª"

Linuxö�XÚ¦^ – p. 63

Page 64: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

?\/òÑ vi• ?\ vi

vi vifile• òÑ vi

:q òÑ��?6L�©�

:q! r1òÑ vi:x ��òÑ vi:wq ��òÑ vi

Linuxö�XÚ¦^ – p. 64

Page 65: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�Ñ\• �\·-µi Ú I• N\·-µaÚ A• #1·-µoÚ O

Linuxö�XÚ¦^ – p. 65

Page 66: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

£Ä1I<up_arrow>↑

ctrl+P

<down_arrow>↓ctrl+N

<right-arrow>→Space

← <left-arrow>Backspace

+ j

- k

lh

Linuxö�XÚ¦^ – p. 66

Page 67: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1I£Ä• £�1ĵˆ!0• £�1�µ$• £��½1µ[1Ò] G½µ[1Ò] [Enter]• £��½�µ[�Ò] |

Linuxö�XÚ¦^ – p. 67

Page 68: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

¶4·-• E¶·-µctrl+uÚ ctrl+d§©O�þÚ�eEÄ��I�

• ©�·-µctrl+fÚ ctrl+b§©O�cÚ��©�

Linuxö�XÚ¦^ – p. 68

Page 69: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�íØ• íØiÎ

• x½ nxµl1I¤3� �íØ��½ n�iÎ

• X ½ nXµíØ1Ic���½ n�iΕ íØ©�é�

• ddµíØ1I¤3�1• DµíØl1I �m©�1�• dwµíØl1I ��Tc"�¤kiΕ d0µíØl1I �m©�1Ä• d5Gµò1I¤31�1 51íØ• dGµò1I¤31�©�"�íØ

Linuxö�XÚ¦^ – p. 69

Page 70: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

?U·-• O���iε·-�ªeU r• O��11IÑiα��µ·-�ªeU R• O�K1I?iοV\µ·-�ªeU c• ?U1I���1�µ·-�ªeU C• ���=�µ·-�ªeU ∼

Linuxö�XÚ¦^ – p. 70

Page 71: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

|¢ÚO�·-• |¢µ/¤�|¢�SN• O�µ%s/O�c/O��/g

Linuxö�XÚ¦^ – p. 71

Page 72: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

E�Ú­E·-• uµe�\�^d·-§ÒíØf�\��©¶eíØ�^§§K�\fíØ��©"

• Uµr�c1¡E¤§�?6�c�G�• .µ­E¢yfâ��\·-½íØ·-

Linuxö�XÚ¦^ – p. 72

Page 73: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

���ڽJ�

?\ vi �\ vi ¿U£��Ñ\�ª U<a>½ö<i>Ñ\©� ò©��\�À«

�·-�ª U<Esc>���À«�©� �\:w file ,¿U£�òÑ vi �\:q ,¿U£�

vim¥©�ϵhttp://vcd.gro.clinux.org/

Linuxö�XÚ¦^ – p. 73

Page 74: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1ÊÙ shellÄ:• Ï�Î

• Ñ\ÑÑ­½�

• +�

• ·-|

Linuxö�XÚ¦^ – p. 74

Page 75: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Shell{0• ��ö�XÚ��pª·-)º§S§§3^rÚö�XÚ�mJø��¡�1���p��"

• ���«·-?�§S�O�ó§äkCþ��!(���!f§SN^!ëêD4!¥ä?n�

Linuxö�XÚ¦^ – p. 75

Page 76: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

©�¶¥�iÎ�^i•• üiÎ�^iµ?• õiÎ�^iµ*• �¹�^iµ[ ] ! [ - ]

Linuxö�XÚ¦^ – p. 76

Page 77: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

IO©�• IOÑ\£0¤• IOÑÑ£1¤• IO�ØÑÑ£2¤

Linuxö�XÚ¦^ – p. 77

Page 78: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Ñ\ÑÑ­½�• Ñ\­½�µcommand < filename• ÑÑ­½�µcommand > filename• �Ø­½�µcommand 2> filename

Linuxö�XÚ¦^ – p. 78

Page 79: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

+�• ��·-�IOÑѤ�,��·-�IOÑ\cmd1 | cmd2

• ò ls·-ÑÑ�©�¶�LÑx� grep·-$ls | grep t

Linuxö�XÚ¦^ – p. 79

Page 80: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

gÄÖ�·-1• gÄÖ�·-1Ò´3Ñ\·-�Ø7r·-Ñ�§shellU�äѤ�Ñ\�·-"

• Ñ\·-��Ü©�U<Tab>�• $pass<Tab>XÚ¬Ö� passwd·-

Linuxö�XÚ¦^ – p. 80

Page 81: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ShellCþCþ´�D��¶i"§���±´iÎG!êi�"

• ^rCþµd^rMïÚD��Cþ

• �¸Cþµd shell�o§^u��XÚó��¸��|Cþ§�±d^rUC

• AÏCþµd shell���§ØUUC"~Xëê�ê§?§ÒòÑG�"

Linuxö�XÚ¦^ – p. 81

Page 82: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

^rCþ

Cþ¶�±´di1mÞ�?¿i1!êi|¤�S�"

• ��Ú+n^rCþµvar=string½ set var=string

• ��Cþ�½Âµunset var

• w«Cþ��µecho

Linuxö�XÚ¦^ – p. 82

Page 83: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

Cþ• �)¤�����ê�Cþ

int=5• set var1=abcd

set var2=var1$efgh�1þ¡ü^�é§Cþ var2�SN�µabcdefgh

• w«þ¡ var2��echo $var2KÑѵabcdefgh

Linuxö�XÚ¦^ – p. 83

Page 84: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

18Ù?§• ½Â?§

• ?§iÀ

• N^��?§

• ¥ä?§

• nohup

• �� jobs

• ½ÂXÚ?§

Linuxö�XÚ¦^ – p. 84

Page 85: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

?§Vg• ��?§Ò´��$1�§S"´Ä��

• Linux�z��?§©���?§I£Ò£PID¤�½Ú�l?§

Linuxö�XÚ¦^ – p. 85

Page 86: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

?§Ú§S�'X• ?§´§S��1L§

• §S´��·���-8§?§´Ä��

• ?§�m´¿u�1�§ §S��vk¿u1

• ?§´©�] �ü §3$1L§¥¦^XÚ]

Linuxö�XÚ¦^ – p. 86

Page 87: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

I?§Úf?§

PID PPID201 1206 201207 206

Linuxö�XÚ¦^ – p. 87

Page 88: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ps·-�w�cXÚ¥$1�?§�&Eps [À�]

• -aw«XÚ¥� tty�'�¤k?§�&E

• -f w«¤k?§�&E• -r�w«�3$1�?§• -uw«¡�^r��ª• -xw«¤kªàþ�?§&E

Linuxö�XÚ¦^ – p. 88

Page 89: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

¥ä?§• c�?§

ctrl-ckillkillall

• ��?§killkillall

Linuxö�XÚ¦^ – p. 89

Page 90: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

àK?§

$ ps −f

UID PID PPID $ \ cdots$TTY $ \ cdots$COMMAND

john 206 201 $ \ cdo t s $1 $ \ cdo t s $bas h

john 209 206 $ \ cdo t s $1 $ \ cdo ts$v im x . t x t

$ k i l l 206

$ k i l l −9 206

$ k i l l a l l vim

Linuxö�XÚ¦^ – p. 90

Page 91: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

$1Ñ��?§• ls -R 1 > out &• nohup

$nohup ls -R l > out &$nohup ls -R l &

Linuxö�XÚ¦^ – p. 91

Page 92: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�w CPU|^Ç top• ^{µtopr [À�]

• òѵq

Linuxö�XÚ¦^ – p. 92

Page 93: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1ÔÙ Linux óä

Linuxö�XÚ¦^ – p. 93

Page 94: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

dateÚ cal·-• 3¶4þw«½��XÚ�FÏÚ�m

$dateThu Jan 27 05:34:40 CST 2000

• w«F{$cal 6 2005

Sun Mon Tue Wed Thu F r i Sa t1 2 3 4

5 6 7 8 9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30

Linuxö�XÚ¦^ – p. 94

Page 95: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

clear·-�ض4þ�&E"�Ø�§J«Î£�¶4��þ�$clear

Linuxö�XÚ¦^ – p. 95

Page 96: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

echo·-• ò·-1¥�ëê£w�IOÑÑ£=¶4¤þ"

• echo [-n] STRING• -nL«ÑÑiÎG�§1IØ�1• A�~fµ

• $echo-This is a command..This is a command.

• $echo This is a commandThis is a command.

• $echo -n-Enter data->.Enter data->$_

Linuxö�XÚ¦^ – p. 96

Page 97: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

grep·-• 3©�©�¥�é�½�ª�c½á�"

• grep [À�] [�é�ª][©�¶ 1§©�¶2§,,]

• XJ3|¢�ª¥�¹��§A^üÚÒr�ªiÎG)å5

• 3©��L¥�±¦^Ï�Î

• éy18¹¥§¤k*ж�/.txt0�©��SN§�é�¹/hello0iÎG�©�$grep hello *.txt

• 3©�file1¥�éiÎG/ramble.*b0$grep-ramble˙b.file1

Linuxö�XÚ¦^ – p. 97

Page 98: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

wc·-• O�iê

$wc [-c] [-l] [-w] filename-c�w«O�i!ê-l �w«O�1-w�w«O�i

• $ wc myfile17 126 1085 myfilelines words i!ê

Linuxö�XÚ¦^ – p. 98

Page 99: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ping·-^5uÿ��XÚ´Ä®ë�þ¿3$1"$ping 10.99.19.44PING 10.99.19.44 (10.99.19.44) from 10.99.19.44 : 56(84) bytes

of data.

64 bytes from 10.99.19.44: icmp_seq=1 ttl=255 time=0.092 ms

64 bytes from 10.99.19.44: icmp_seq=2 ttl=255 time=0.022 ms

64 bytes from 10.99.19.44: icmp_seq=3 ttl=255 time=0.020 ms

64 bytes from 10.99.19.44: icmp_seq=4 ttl=255 time=0.019 ms

— 10.99.19.44 ping statistics —

4 packets transmitted, 4 received, 0% loss, time 2997ms

rtt min/avg/max/mdev = 0.019/0.038/0.092/0.031 ms

Linuxö�XÚ¦^ – p. 99

Page 100: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

finger·-¼��ä¥Ù¦^r�&E"�±�w��^r���º��m!¦¤¦^�shella.!¦�Ì8¹�´»�"$finger rootLogin name: rootDirectory: / Shell: /bin/bashOn since Jan 27 05:34:17 on pts/1, 14seconds Idle Time from 128.0.0.71

Linuxö�XÚ¦^ – p. 100

Page 101: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

éÅ�Ï·- man• man·-�±�ªz¿w«,�·-�éÅ�ÏÃþ

• man [À�] ·-¶• $man ls• man·-ÑÑ��H�Ì��)±eA�Ü©µ

• NAME ·-�¶¡Ú^{

• SYNOPSISw«·-��{�ª§�ÑÙ¤k�^

�À^�À�9ëê"

• DESCRIPTION£ã·-��[^{9z�À��

õU"

• OPTIONé·-�z��À�?1�[�`²Linuxö�XÚ¦^ – p. 101

Page 102: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�Ö info �Ï·- info/pinfo�Ö info©�• info [À�] ·-¶• pinfo [À�] ·-¶

Linuxö�XÚ¦^ – p. 102

Page 103: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

·- –help/-h• ·-–help½-h�±w«ù�·-��Ï¿�òÑ

• $ls –help• $man -h

Linuxö�XÚ¦^ – p. 103

Page 104: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�w8¹��·- du• duµo(z�<©�>�^�^þ§8¹K�o^þ"

• ^{µdu [À�] [©�]

$du −h / home / e a g l e / d a t a /

590M / home / e a g l e / d a t a / s u r f a c e / o ld

926M / home / e a g l e / d a t a / s u r f a c e

31M / home / e a g l e / d a t a /1

34M / home / e a g l e / d a t a / asem

2 .8M / home / e a g l e / d a t a / l i n e / o ld

105M / home / e a g l e / d a t a / l i n e

1 .1G / home / e a g l e / d a t a /

Linuxö�XÚ¦^ – p. 104

Page 105: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

�w©«��·- df• dfµw«z�<©�>¤3�©�XÚ�&E§%@´w«¤k©�XÚ"

• ^{µdf [À�] [©�]

$df −h

F i l e s y s t e m Nþ ®^ �^ ®^% !1:

/ dev / hda1 958M 728M 181M 81% /

tmpfs 253M 4 .0K 253M 1% / dev / shm

/ dev / hda6 9 .2G 4 .3G 4 .5G 49% / u s r

/ dev / hda7 65G 61G 212M 100% / home

/ dev / hda8 36G 30G 4 .1G 89% / backup

tmpfs 10M 2 .8M 7 .3M 28% / dev

Linuxö�XÚ¦^ – p. 105

Page 106: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

~^^�/·-• �äèAµmozilla!firefox• �äe1µftp!lftp!wget!curl!gftp

• wã§Sµgqview!gthumb

Linuxö�XÚ¦^ – p. 106

Page 107: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

ftp• ë�ÑÖìµ

• ftp Host• ftp User@Host• ftp User:Passwd@Host

• �w©��Lµls• ü�/õ�©�e1µget/mput

• ü�/õ�©�þ1µput/mget

• �w�ϵhelp§help CMD

• �?�Dѵbin• ASCIIDѵasc

Linuxö�XÚ¦^ – p. 107

Page 108: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

lftpaq ftp§��r��õ§��XÚ�7SCÌ�AÏ·-µ

• 8¹þ1µmirror• 8¹þ1µmirror -R• �w©�µcat!zcat• $1�/·-µ!CMD§'X!ls• e1®�/�©�µlftp ftp://url

Linuxö�XÚ¦^ – p. 108

Page 109: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

wget/curle1©�e1§¿�±1þe1±9º��Õ

• ©�YDµwget -c http://url

• e1 http://vcd.gro.clinux.org/doc/usr_01.html -http://vcd.gro.clinux.org/doc/usr_15.htmlµcurl http://vcd.gro.clinux.org/doc/usr_[01-15].html

Linuxö�XÚ¦^ – p. 109

Page 110: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

1lÙ?Èì• Fortranµ

• Intelµifort!ifc• PGIµpgf90!pgf77• GNU Fortranµg77!gfortran

• C/C++• Intelµicc• PGIµpgcc• GNU Cµgcc!g++

Linuxö�XÚ¦^ – p. 110

Page 111: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

N¹�ä©�• ~^Ø�µ

http://www.linuxsir.org

• ~^^�í�8Ü®oµ

http://www.linuxsir.org/bbs/showthread.php?t=199479

• �-��µ

http://www.linuxsir.org/bbs/showthread.php?t=204304

Linuxö�XÚ¦^ – p. 111

Page 112: 2005 c 6scc.ustc.edu.cn/_upload/article/files/7d/f9/033cd3... · SN •1˜Ù Vã •1 Ù XÚ˙$1 •1nÙ ©‡Ú8¹ •1oÙ shell Ä: •1ÊÙ vim •18Ù ?§ •1ÔÙ Linux óä

���

Linuxö�XÚ¦^ – p. 112


Recommended