µÚÒ»·¶ÎÄÍø - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

UNIXϵͳ²Ù×÷ÈëÃÅ

À´Ô´£ºÓû§·ÖÏí ʱ¼ä£º2025/11/30 11:29:42 ±¾ÎÄÓÉloading ·ÖÏí ÏÂÔØÕâÆªÎĵµÊÖ»ú°æ
˵Ã÷£ºÎÄÕÂÄÚÈݽö¹©Ô¤ÀÀ£¬²¿·ÖÄÚÈÝ¿ÉÄܲ»È«£¬ÐèÒªÍêÕûÎĵµ»òÕßÐèÒª¸´ÖÆÄÚÈÝ£¬ÇëÏÂÔØwordºóʹÓá£ÏÂÔØwordÓÐÎÊÌâÇëÌí¼Ó΢ÐźÅ:xxxxxxx»òQQ£ºxxxxxx ´¦Àí£¨¾¡¿ÉÄܸøÄúÌṩÍêÕûÎĵµ£©£¬¸ÐлÄúµÄÖ§³ÖÓëÁ½⡣

UNIXϵͳ²Ù×÷ÈëÃÅ(1)

µÇ¼²½Öè ========

login : _______ => ÊäÈë username password : _______ => ÊäÈëÃÜÂë

Í˳ö²½Öè ========

% logout % exit % CTRL+d

¸ü¸ÄÕʺÅÃÜÂë ============

% passwd => Ö´Ðк󽫻á³öÏÖÏÂÁÐѶϢ Changing NIS password for user on ice. Old password: ______ => ÊäÈë¾ÉÃÜÂë

New password: ______ => ÊäÈëÐÂÃÜÂë(×îºÃ6-8×Ö£¬Ó¢ÎÄ×ÖĸÓëÊý×Ö»ìºÏ)

Retype new password: ______ => ÔÙÊäÈëÒ»´ÎÃÜÂë

ÔÚÏßÖ¸Áî˵Ã÷ ============

Ö´Ðиñʽ£º man command-name Example: % man ls

½øÈëÔ¶¶ËµçÄÔϵͳ ================

Ö´Ðиñʽ£ºrlogin hostname [-1 username] Example: %rlogin doc

remote login ½øÈ빤×÷Õ¾ doc ÖС£ %rlogin doc -l user

ʹÓà user ÕʺŽøÈ빤×÷Õ¾ doc ÖС£

Ö´Ðиñʽ£ºtelnet hostname »ò telnet IP address Example: %telnet doc

%telnet 140.109.20.251

UNIXϵͳ²Ù×÷ÈëÃÅ(2)

Page 1 of 22

Îļþ»òĿ¼´¦Àí ==============

ÁгöÎļþ»òĿ¼ÏÂÖ®ÎļþÃû³Æ

Ö´Ðиñʽ£º ls [-atFlgR] [name] ( name ¿ÉΪÎļþÃû»òĿ¼Ãû³Æ¡£)

Example :

ls ÁгöĿǰĿ¼ÏÂÖ®ÎļþÃû¡£

ls -a Áгö°üº¬ÒÔ£®ÆðʼµÄÒþ²ØµµËùÓÐÎļþÃû¡£

ls -t ÒÀÕÕÎļþ×îºóÐÞ¸Äʱ¼ä֮˳Ðò£¬ÒÀÐòÁгöÎļþÃû¡£

ls -F ÁгöĿǰĿ¼ÏÂÖ®ÎļþÃû¼°ÆäÀàÐÍ¡£\½áβ±íʾΪĿ¼Ãû³Æ£¬\½áβ±íʾΪִÐеµ£¬\½áβ±íʾΪ symblic link¡£

ls -l ÁгöĿ¼ÏÂËùÓÐÎļþÖ®Ðí¿ÉȨ¡¢ÓµÓÐÕß¡¢Îļþ´óС¡¢ÐÞ¸Äʱ¼ä¼°Ãû³Æ¡£

ls -lg ͬÉÏ£¬²¢ÏÔʾ³öÎļþÖ®ÓµÓÐÕßȺ×éÃû³Æ¡£ ls -R ÏÔʾ³öĿ¼Ï£¬ÒÔ¼°ÆäËùÓÐ×ÓĿ¼֮ÎļþÃû¡£( recursive listing )

Ŀ¼µÄËõд ==========

¡« ʹÓÃÕß login ʱµÄ working directory ( ÆðʼĿ¼ )

¡«username Ö¸¶¨Ä³Î» user µÄ working directory ( ÆðʼĿ¼ ) . ĿǰµÄ¹¤×÷Ŀ¼ ( current working directory )

.. ĿǰĿ¼µÄÉÏÒ»²ãĿ¼ ( parent of working directory)

¸Ä±ä¹¤×÷Ŀ¼λÖà ================

Ö´Ðиñʽ£ºcd [name] £ºname ¿ÉΪĿ¼Ãû³Æ¡¢Â·¾¶»òĿ¼Ëõд¡£

Example:

cd ¸Ä±äĿ¼λÖã¬ÖÁʹÓÃÕß login ʱµÄ working directory (ÆðʼĿ¼)¡£

cd dir1 ¸Ä±äĿ¼λÖã¬ÖÁ dir1 ֮Ŀ¼λÖÃÏ¡£

cd ~user ¸Ä±äĿ¼λÖã¬ÖÁʹÓÃÕßµÄ working directory (ÆðʼĿ¼)¡£ cd .. ¸Ä±äĿ¼λÖã¬ÖÁĿǰĿ¼µÄÉϲã( ¼´ parent of working directory)

cd ../user ¸Ä±äĿ¼λÖã¬ÖÁÏà¶Ô·¾¶ user ֮Ŀ¼λÖÃÏ¡£

cd /../.. ¸Ä±äĿ¼λÖã¬ÖÁ¾ø¶Ô·¾¶( Full path ) ֮Ŀ¼λÖÃÏ¡£

¸´ÖÆÎļþ ========

Ö´Ðиñʽ: cp [-r] source destination

Example:

cp file1 file2 ½«Îļþ file1 ¸´ÖÆ³É file2 cp file1 dir1 ½«Îļþ file1 ¸´ÖƵ½Ä¿Â¼ dir1 Ï£¬ÎļþÃûÈÔΪ file1¡£

Page 2 of 22

cp /tmp/file1 . ½«Ä¿Â¼ /tmp ϵÄÎļþ file1 ¸´ÖƵ½ÏÖÐÐĿ¼Ï£¬ÎļþÃûÈÔΪ file1¡£

cp /tmp/file1 file2 ½«Ä¿Â¼ /tmp ϵÄÎļþ file1 ¸´ÖƵ½ÏÖÐÐĿ¼Ï£¬ÎļþÃûΪ file2¡õ

cp -r dir1 dir2 (recursive copy) ¸´ÖÆÕû¸öĿ¼¡£

ÈôĿ¼ dir2 ²»´æÔÚ£¬Ôò½«Ä¿Â¼ dir1£¬¼°ÆäËùÓÐÎļþºÍ×ÓĿ¼£¬¸´ÖƵ½Ä¿Â¼ dir2 Ï£¬ÐÂĿ¼Ãû³ÆÎª dir1,ÈôĿ¼ dir2 ²»´æÔÚ£¬Ôò½« dir1£¬¼°ÆäËùÓÐÎļþºÍ×ÓĿ¼£¬¸´ÖÆÎªÄ¿Â¼ dir2¡£

ÒÆ¶¯»ò¸ü¸ÄÎļþ¡¢Ä¿Â¼Ãû³Æ ========================

Ö´Ðиñʽ£º mv source destination

Example:

mv file1 file2 ½«Îļþ file1£¬¸ü¸ÄÎļþÃûΪ file2¡£ mv file1 dir1 ½«Îļþ file1£¬ÒƵ½Ä¿Â¼ dir1 Ï£¬ÎļþÃûÈÔΪ file1¡£ mv dir1 dir2 ÈôĿ¼ dir2 ²»´æÔÚ£¬Ôò½«Ä¿Â¼ dir1£¬¼°ÆäËùÓÐÎļþºÍ×ÓĿ¼£¬ÒƵ½Ä¿Â¼ dir2 Ï£¬ÐÂĿ¼Ãû³ÆÎª dir1¡£ÈôĿ¼ dir2 ²»´æÔÚ£¬Ôò½«dir1£¬¼°ÆäËùÓÐÎļþºÍ×ÓĿ¼£¬¸ü¸ÄΪĿ¼ dir2¡£

½¨Á¢ÐÂĿ¼ ==========

Ö´Ðиñʽ£º mkdir directory-name

Exmaple £º

mkdir dir1 ½¨Á¢Ò»ÐÂĿ¼ dir1¡£

ɾ³ýĿ¼ ========

Ö´Ðиñʽ£º rmdir directory-name »ò rm directory-name

Example £º

rmdir dir1 ɾ³ýĿ¼ dir1£¬µ« dir1 ϱØÐëûÓÐÎļþ´æÔÚ£¬·ñÔòÎÞ·¨É¾³ý¡£

rm -r dir1 ɾ³ýĿ¼ dir1£¬¼°ÆäÏÂËùÓÐÎļþ¼°×ÓĿ¼¡£

ɾ³ýÎļþ ========

Ö´Ðиñʽ£º rm filename (filename ¿ÉΪÎļþÃû£¬»òÎļþÃûËõд·ûºÅ¡£)

Example £º

rm file1 ɾ³ýÎļþÃûΪ file1 Ö®Îļþ¡£

rm file? ɾ³ýÎļþÃûÖÐÓÐÎå¸ö×ÖÔª£¬Ç°Ëĸö×ÖԪΪfile Ö®ËùÓÐÎļþ¡£ rm f* ɾ³ýÎļþÃûÖУ¬ÒÔ f Ϊ×ÖÊ×Ö®ËùÓÐÎļþ¡£

Page 3 of 22

ÎļþÃûµÄËõд·ûºÅ ================

? ´ú±íÎļþÃû³ÆÖÐÖ®µ¥Ò»×ÖÔª¡£ * ´ú±íÎļþÃû³ÆÖÐÖ®Ò»×Ö´®¡£

ÁгöĿǰËùÔÚ֮Ŀ¼λÖà ====================== Ö´Ðиñʽ£º pwd

Example £º pwd

²é¿´ÎļþÄÚÈÝ ============

Ö´Ðиñʽ£º cat filename

Example £º

cat file1 ÒÔÁ¬ÐøÏÔʾ·½Ê½£¬²é¿´ÎļþÃû file1 Ö®ÄÚÈÝ¡£

·ÖÒ³ÏÔʾÎļþÄÚÈÝ ================

Ö´Ðиñʽ£º more filename »ò cat filename | more

Example £º

more file1 ÒÔ·ÖÒ³·½Ê½£¬²é¿´ÎļþÃû file1 Ö®ÄÚÈÝ¡£ cat file1 | more ͬÉÏ¡£

UNIXϵͳ²Ù×÷ÈëÃÅ(3)

Îļþ¼°Ä¿Â¼²Ù×÷ =============

¸Ä±äÎļþ»òĿ¼֮¶Á¡¢Ð´¡¢Ö´ÐÐÖ®ÔÊÐíȨ ====================================

Ö´Ðиñʽ£ºchmod [-R] mode name ( name ¿ÉΪÎļþÃû»òĿ¼Ãû;mode¿ÉΪ 3 ¸ö 8 λԪ֮Êý×Ö£¬»òÀûÓÃls -l ÃüÁÁгöÎļþ»òĿ¼֮¶Á¡¢Ð´¡¢Ö´ÐÐÔÊÐíȨ֮ÎÄ×ÖËõд¡£)

mode : rwx rwx rwx r:read w:write x:execute(user group other ËõдΪ: u g o)

Example :

Page 4 of 22

% chmod 755 dir1 ½«Ä¿Â¼dir1£¬É趨³ÉÈκÎʹÓÃÕߣ¬½ÔÓжÁÈ¡¼°Ö´ÐÐ֮ȨÀû£¬µ«Ö»ÓÐÓµÓÐÕß¿É×öÐ޸ġ£

% chmod 700 file1 ½«Îļþfile1£¬É趨ֻÓÐÓµÓÐÕß¿ÉÒÔ¶Á¡¢Ð´ºÍÖ´ÐС£

% chmod o+x file2 ½«Îļþfile2£¬Ôö¼ÓÓµÓÐÕß¿ÉÒÔÖ´ÐÐ֮ȨÀû¡£ % chmod g+x file3 ½«Îļþfile3£¬Ôö¼ÓȺ×éʹÓÃÕß¿ÉÖ´ÐÐ֮ȨÀû¡£ % chmod o-r file4 ½«Îļþfile4£¬³ýÈ¥ÆäËüʹÓÃÕ߿ɶÁȡ֮ȨÀû¡£

¸Ä±äÎļþ»òĿ¼֮ӵÓÐȨ ======================

Ö´Ðиñʽ£ºchown [-R] username name ( name ¿ÉΪÎļþÃû»òĿ¼Ãû¡£)

Example £º

% chown user file1 ½«Îļþ file1 Ö®ÓµÓÐȨ£¬¸ÄΪʹÓÃÕß user ËùÓС£

% chown -R user dir1 ½«Ä¿Â¼ dir1£¬¼°ÆäÏÂËùÓÐÎļþºÍ×ÓĿ¼֮ӵÓÐȨ£¬¸ÄΪʹÓÃÕß user ËùÓС£

¼ì²é×Ô¼ºËùÊô֮Ⱥ×éÃû³Æ ====================== Ö´Ðиñʽ£ºgroups

Example : % groups

¸Ä±äÎļþ»òĿ¼֮Ⱥ×éÓµÓÐȨ ==========================

Ö´Ðиñʽ£ºchgrp [-R] groupname name ( name ¿ÉΪÎļþÃû»òĿ¼Ãû )

Example :

% chgrp vlsi file1 ½«Îļþ file1 ֮Ⱥ×éÓµÓÐȨ£¬¸ÄΪ vlsi Ⱥ×é¡£ % chgrp -R image dir1 ½«Ä¿Â¼dir1£¬¼°ÆäÏÂËùÓÐÎļþºÍ×ÓĿ¼£¬¸ÄΪ image Ⱥ×é¡£

¸Ä±äÎļþ»òĿ¼֮×îºóÐÞ¸Äʱ¼ä(±äΪµ±Ç°Ê±¼ä) =========================================

Ö´Ðиñʽ£ºtouch name ( name ¿ÉΪÎļþ»òĿ¼Ãû³Æ¡£)

Example :

% touch file1 % touch dir1

ÎļþÖ®Á¬½á ==========

Page 5 of 22

ËÑË÷¸ü¶à¹ØÓÚ£º UNIXϵͳ²Ù×÷ÈëÃÅ µÄÎĵµ
UNIXϵͳ²Ù×÷ÈëÃÅ.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ£¬·½±ã¸´ÖÆ¡¢±à¼­¡¢ÊղغʹòÓ¡
±¾ÎÄÁ´½Ó£ºhttps://www.diyifanwen.net/c4tmeo88g241symu1jbsf_1.html£¨×ªÔØÇë×¢Ã÷ÎÄÕÂÀ´Ô´£©
ÈÈÃÅÍÆ¼ö
Copyright © 2012-2023 µÚÒ»·¶ÎÄÍø °æÈ¨ËùÓÐ ÃâÔðÉùÃ÷ | ÁªÏµÎÒÃÇ
ÉùÃ÷ :±¾ÍøÕ¾×ðÖØ²¢±£»¤ÖªÊ¶²úȨ£¬¸ù¾Ý¡¶ÐÅÏ¢ÍøÂç´«²¥È¨±£»¤ÌõÀý¡·£¬Èç¹ûÎÒÃÇ×ªÔØµÄ×÷Æ·ÇÖ·¸ÁËÄúµÄȨÀû,ÇëÔÚÒ»¸öÔÂÄÚ֪ͨÎÒÃÇ£¬ÎÒÃǻἰʱɾ³ý¡£
¿Í·þQQ£ºxxxxxx ÓÊÏ䣺xxxxxx@qq.com
ÓåICP±¸2023013149ºÅ
Top