ºìÁªLinuxÃÅ»§
Linux°ïÖú

´ÓÁ㿪ʼ£ºLinux»ù´¡½Ì³ÌÖ®ÃüÁîµÄʹÓÃ

·¢²¼Ê±¼ä:2005-08-22 10:10:28À´Ô´:ºìÁª×÷Õß:zz123
¶ÔÓÚ Linux ÐÂÊÖ£¬»òÕßÄÇЩÏëÒªÖØÐÂÉóÊÓ»ò¸Ä½ø×Ô¼º¶Ô»ù±¾ Linux ¸ÅÄ±ÈÈ磺¸´ÖƺÍÒƶ¯Îļþ¡¢´´½¨·ûºÅºÍÓ²Á´½Ó¡¢ÉèÖÃÎļþϵͳ¶ÔÏóËùÓÐȨºÍȨÏÞÒÔ¼°Í¬¹ÜµÀºÍÖض¨ÏòÒ»ÆðʹÓà Linux µÄ±ê×¼Îı¾´¦ÀíÃüÁµÄÀí½âµÄÈËÀ´Ëµ£¬±¾ÏµÁÐÁ¬ÔØÎÄÕÂÖ®Ò»ÊÇÀíÏëµÄ½Ì²Ä¡£ÑØ×ÅÕâ¸ö·½Ïò£¬ÎÒÃǽ«Ò»Æð·ÖÏíºÜ¶àÐĵᢼ¼ÇɺÍÇÏÃÅ£¬Ê¹¸Ã½Ì³ÌÉõÖÁ¶ÔÓÚÄÇЩ¾ßÓзḻ¾­ÑéµÄ Linux ÀÏÊÖÀ´Ëµ¶¼ÊÇ¡°ÓÐѪÓÐÈ⡱£¬²¢ÇÒÊÇʵÓõġ£

¡¡¡¡¶ÔÓÚ³õѧÕ߶øÑÔ£¬±¾ÏµÁÐÎÄÕµÄÐí¶àÄÚÈݶ¼ºÜÐÂÓ±£¬¶ø¸üÓо­ÑéµÄ Linux Óû§¿ÉÄܻᷢÏÖ±¾½Ì³ÌÊÇʹËûÃÇ»ù±¾µÄ Linux ¼¼ÄÜ¡°Â¯»ð´¿ÇࡱµÄÓÐЧ;¾¶¡£

¡¡¡¡½éÉÜ bash

¡¡¡¡shell

¡¡¡¡Èç¹ûÄúʹÓùý Linux ϵͳ£¬ÄÇôÄúÖªµÀµ±µÇ¼ʱ£¬½«»á¿´µ½ÏñÕâÑùµÄÌáʾ·û£º

$


¡¡¡¡ÄúËù¿´µ½µÄÌØÊâµÄÌáʾ·û¿ÉÄÜ¿´ÆðÀ´ºÜ²»Ò»Ñù¡£Ëü¿ÉÄÜ°üº¬ÏµÍ³µÄÖ÷»úÃû¡¢µ±Ç°µÄ¹¤×÷Ŀ¼Ãû£¬»òÕßÁ½Õ߶¼ÓС£µ«ÊDz»¹ÜÕâ¸öÌØÊâµÄÌáʾ·û¿´ÆðÀ´Ïñʲô£¬ÓÐÒ»¼þÊÂÊǿ϶¨µÄ¡£´òÓ¡³öÕâ¸öÌáʾ·ûµÄ³ÌÐò½Ð¡°shell¡±£¬¼«ÓпÉÄÜÄúµÄÌØÊâµÄ shell ÊÇÒ»¸ö½Ð bash µÄ³ÌÐò¡£

¡¡¡¡ÄúÔÚÔËÐÐ bash Âð£¿

¡¡¡¡Äú¿ÉÒÔͨ¹ýÊäÈëÏÂÃæµÄÃüÁîÀ´¼ì²éÄúÊÇ·ñÕýÔÚÔËÐÐ bash£º

$ echo $SHELL

/bin/bash



¡¡¡¡Èç¹ûÉÏÃæµÄÃüÁîÐб¨´í»òÕß²»»áÀàËƵØÏìÓ¦ÎÒÃǵÄʾÀý£¬ÄÇôÄú¿ÉÄÜÕýÔÚÔËÐÐÒ»¸ö²»Í¬ÓÚ bash µÄ shell¡£

¡¡¡¡¹ØÓÚ bash

¡¡¡¡Bash ÊÇ¡°Bourne-again shell¡±µÄÊ××ÖĸËõд£¬ËüÊÇ´ó¶àÊý Linux ϵͳȱʡµÄ shell¡£shell µÄÈÎÎñÊÇÖ´ÐÐÄúµÄÃüÁʹÄúÄܹ»Óë Linux ϵͳ½øÐн»»¥¡£µ±ÄúÊäÍêÃüÁÄú¿ÉÒÔ֪ͨ shell Ö´ÐÐ exit »ò logout ÃüÁÔÚ´ËÄú½«·µ»Øµ½µÇ¼Ìáʾ·û¡£Ë³±ãÌáһϣ¬Äú»¹¿ÉÒÔͨ¹ýÔÚ bash Ìáʾ·ûÏ°´ control-D À´×¢Ïú¡£

¡¡¡¡Ê¹Óá°cd¡±

¡¡¡¡Äú¿ÉÄÜÒѾ­·¢ÏÖ£¬Ä¿²»×ª¾¦µØ¶¢×ÅbashÌáʾ·û¿É²»ÊÇÊÀ½çÉÏ×îÈÃÈ˸е½Óо¢µÄÊ¡£ÄÇô£¬ÈÃÎÒÃÇÀ´¿ªÊ¼Óà bash À´ä¯ÀÀÎÒÃǵÄÎļþϵͳ¡£ÔÚÌáʾ·ûÏ£¬ÊäÈëÏÂÃæµÄÃüÁ²»°üÀ¨ $£©£º

$ cd /


¡¡¡¡ÎÒÃÇÖ»¸æËß bash ÄúÏëÔÚ /£¨Ò²³ÆΪ¸ùĿ¼£©Öй¤×÷£»ÏµÍ³ÉϵÄËùÓÐĿ¼ÐγÉÒ»¿ÃÊ÷£¬/ ±»ÈÏΪÊÇÕâ¿ÃÊ÷µÄ¶¥²¿£¬»òÕßÊǸù¡£cdÉèÖõ±Ç°ÄúÕýÔÚ¹¤×÷µÄĿ¼£¬Ò²³ÆΪ¡°µ±Ç°¹¤×÷Ŀ¼¡±¡£

¡¡¡¡Â·¾¶

¡¡¡¡Òª¿´ bash µÄµ±Ç°¹¤×÷Ŀ¼£¬Äú¿ÉÒÔÊäÈ룺

$ pwd

/



¡¡¡¡ÔÚÉÏÃæµÄʾÀýÖУ¬cd µÄ / ²ÎÊý½Ð×ö·¾¶¡£Ëü¸æËß cd ÎÒÃÇҪתµ½Ê²Ã´µØ·½¡£ÌرðÊÇ£¬/ ²ÎÊýÊÇÒ»¸ö¾ø¶Ô·¾¶£¬Òâζ×ÅËüÖ¸¶¨ÁËÏà¶ÔÓÚÎļþϵͳÊ÷µÄ¸ùµÄλÖ᣾ø¶Ô·¾¶ÕâÀïÓм¸¸öÆäËüµÄ¾ø¶Ô·¾¶£º

/dev
/usr
/usr/bin
/usr/local/bin


¡¡¡¡Äú¿ÉÒÔ¿´µ½£¬ËùÓоø¶Ô·¾¶ÓÐÒ»¸ö¹²Í¬µã¾ÍÊÇ£¬ËüÃǶ¼ÒÔ/¿ªÍ·¡£Í¨¹ý·¾¶/usr/local/bin£¬ÎÒÃǸæËß cd ½øÈë / Ŀ¼£¬½Ó׎øÈëÕâ¸öĿ¼֮ϵÄusrĿ¼£¬È»ºóÔÙ½øÈë local ºÍ bin¡£¾ø¶Ô·¾¶×ÜÊÇͨ¹ýÊÇ·ñÒÔ / ¿ªÍ·À´Åжϡ£

¡¡¡¡Ïà¶Ô·¾¶

¡¡¡¡ÁíÒ»ÖÖ·¾¶½ÐÏà¶Ô·¾¶¡£ÔÚ Bash ÖУ¬cd ÒÔ¼°ÆäËüÃüÁî×ÜÊǽâÊÍÄÇЩÏà¶ÔÓÚµ±Ç°Ä¿Â¼µÄ·¾¶¡£Ïà¶Ô·¾¶¾ø²»»áÒÔ / ¿ªÍ·¡£ÕâÑù£¬Èç¹ûÎÒÃÇÔÚ /usr ÖУº

$ cd /usr


¡¡¡¡ÄÇô£¬ÎÒÃÇ¿ÉÒÔʹÓÃÏà¶Ô·¾¶À´×ªµ½ /usr/local/bin Ŀ¼£º

$ cd local/bin
$ pwd
/usr/local/bin


¡¡¡¡Ê¹Óá°..¡±

¡¡¡¡Ïà¶Ô·¾¶»¹¿ÉÒÔ°üº¬Ò»¸ö»ò¶à¸ö .. Ŀ¼¡£.. Ŀ¼ÊÇÖ¸Ïò¸¸Ä¿Â¼µÄרÃÅĿ¼¡£ÄÇô£¬¼ÌÐøÇ°ÃæµÄʾÀý£º

$ pwd
/usr/local/bin
$ cd ..
$ pwd
/usr/local


¡¡¡¡Äú¿ÉÒÔ¿´µ½£¬ÏÖÔÚÎÒÃǵĵ±Ç°Ä¿Â¼ÊÇ /usr/local¡£ÎÒÃÇÄܹ»¡°ºóÍË¡±µ½Ïà¶ÔÓÚÎÒÃÇËùÔڵĵ±Ç°Ä¿Â¼µÄÒ»¸öĿ¼¡£´ËÍ⣬ÎÒÃÇ»¹¿ÉÒÔ½« \\\\\"..\\\\\\" Ìí¼Óµ½Ò»¸öÏÖÓеÄÏà¶Ô·¾¶ÖУ¬Ê¹ÎÒÃÇ¿ÉÒÔ½øÈëÓëÎÒÃÇÒÑÔÚĿ¼²¢ÅŵÄĿ¼£¬ÀýÈ磺

$ pwd
/usr/local
$ cd ../share
$ pwd
/usr/share


¡¡¡¡Ïà¶Ô·¾¶Ê¾Àý

¡¡¡¡Ïà¶Ô·¾¶¿ÉÒÔ±äµÃÏ൱¸´ÔÓ¡£ÕâÀïÓм¸¸öʾÀý£¬ËùÓеĶ¼Ã»ÓÐÏÔʾ³ö½á¹ûµÄÄ¿±ê·¾¶¡£ÇëÊÔ×ÅÍƶÏһϣ¬ÊäÈëÕâЩÃüÁîºó£¬Äú×îÖÕ½«»áתµ½Ê²Ã´µØ·½£º

$ cd /bin
$ cd ../usr/share/zoneinfo
$ cd /usr/X11R6/bin
$ cd ../lib/X11
$ cd /usr/bin
$ cd ../bin/../bin


¡¡¡¡ÏÖÔÚ£¬ÊÔÑéÒ»´Î£¬¿´¿´ÄúµÄÍƶÏÊÇ·ñÕýÈ·¡£

¡¡¡¡Àí½â¡°.¡±

¡¡¡¡ÔÚÎÒÃǽáÊø cd µÄ½éÉÜ֮ǰ£¬ÎÒÃÇ»¹ÐèÒªÌÖÂÛһЩ¸ü¶àµÄÄÚÈÝ¡£Ê×ÏÈ£¬»¹ÓÐÁíÒ»¸ö½Ð . µÄרÃŵÄĿ¼¡£Ëü±íʾ¡°µ±Ç°Ä¿Â¼¡±¡£È»¶ø¸ÃĿ¼²»Îª cd ÃüÁîʹÓã¬Ëüͨ³£ÓÃÀ´Ö´ÐÐһЩµ±Ç°Ä¿Â¼ÖеijÌÐò£¬ÈçÏÂËùʾ£º

$ ./myprog


¡¡¡¡ÔÚÉÏÃæµÄʾÀýÖУ¬×¤ÁôÔÚµ±Ç°¹¤×÷Ŀ¼ÖÐµÄ myprog ¿ÉÖ´ÐÐÎļþ½«±»Ö´ÐС£

¡¡¡¡cd ºÍÖ÷Ŀ¼

¡¡¡¡Èç¹ûÎÒÃÇÏëҪתµ½Ö÷Ŀ¼£¬ÎÒÃÇ¿ÉÒÔÊäÈ룺

$ cd


¡¡¡¡Ã»ÓвÎÊý£¬cd ½«×ªµ½Ö÷Ŀ¼£¬¶ÔÓÚ³¬¼¶Óû§À´ËµÊÇ /root£¬¶ÔÓÚÒ»°ãÓû§À´ËµÍ¨³£ÊÇ/home/username¡£µ«ÊÇ£¬Èç¹ûÎÒÃÇÏëÒªÖ¸¶¨Ò»¸öÖ÷Ŀ¼ÖеÄÎļþ£¬½«»áÔõÑùÄØ£¿¿ÉÄÜÎÒÃÇÏëÒª½«Ò»¸öÎļþ²ÎÊý´«¸ø myprog ÃüÁî¡£Èç¹û¸ÃÎļþÔÚÖ÷Ŀ¼ÖУ¬ÎÒÃÇ¿ÉÒÔÊäÈ룺

$ ./myprog /home/drobbins/myfile.txt


¡¡¡¡µ«ÊÇ£¬Ê¹ÓÃÏñÕâÑùµÄ¾ø¶Ô·¾¶²¢²»×ÜÊǺܷ½±ã¡£ÐҺã¬ÎÒÃÇ¿ÉÒÔʹÓà ~£¨´ú×Ö·û£©×Ö·ûÀ´Íê³ÉͬÑùµÄÊ£º

$ ./myprog ~/myfile.txt


¡¡¡¡ÆäËûÓû§µÄÖ÷Ŀ¼Bash ½«°Ñµ¥¶ÀµÄ ~ À©Õ¹ÎªÖ¸ÏòÖ÷Ŀ¼£¬È»¶øÄú»¹¿ÉÒÔÓÃËüÀ´Ö¸ÏòÆäËûÓû§µÄÖ÷Ŀ¼¡£ÀýÈ磬Èç¹ûÎÒÃÇÏëÒªÒýÓà fred µÄÖ÷Ŀ¼ÖеÄÃûΪ fredsfile.txt µÄÎļþ£¬¿ÉÒÔÊäÈ룺

$ ./myprog ~fred/fredsfile.txt
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 107 ÌõÆÀÂÛ

  1. chenhuanglin ÓÚ 2014-11-21 08:45:22·¢±í:

    ºÜÀ÷º¦

  2. а³¤¿Õ ÓÚ 2014-11-02 12:35:52·¢±í:

    ÎÒϲ»¶linux

  3. baicai ÓÚ 2014-10-26 20:33:39·¢±í:

    ºÜºÃ

  4. µÍÒôºóÎÀ ÓÚ 2014-09-30 16:12:56·¢±í:

    ÎÒÏëÓëºìÆìµÄ¾ö²ß²ãÓиö½Ó´¥£¬¿ª·¢Ò»¸ö¶«Î÷²»ÖªÐв»ÐУ¡£¡

  5. µÍÒôºóÎÀ ÓÚ 2014-09-30 16:09:39·¢±í:

    Êý¾Ý¿â¹ÜÀíÓõÄÈí¼þÊÇÄĸö£¿

  6. µÍÒôºóÎÀ ÓÚ 2014-09-30 16:08:39·¢±í:

    ·þÎñÆ÷Ó¦¸Ã²»´í

  7. µÍÒôºóÎÀ ÓÚ 2014-09-30 16:07:44·¢±í:

    mwÄÚÈݲ»ÉÙ£¬Ñ§ÆðÀ´ÄѲ»ÄÑ£¿

  8. testOkay ÓÚ 2014-06-21 10:33:24·¢±í:

    »¹ÐÐ

  9. zjq700800 ÓÚ 2014-04-15 11:43:54·¢±í:

    ºÜ²»´íµÄ¶«¶«

  10. ÍõÁ¢Õñ ÓÚ 2014-04-14 12:55:01·¢±í:

    ÃüÁîËäÈ»ÉÙ£¬Ô¶²»¹»ÈÕ³£ËùÓ㬵«ÊÇ×ã¹»Ïêϸ£¡Í¦²»´í£¡ºÇ

  11. gsl314 ÓÚ 2014-04-11 16:37:10·¢±í:

    (q):s

  12. wuxingang5 ÓÚ 2011-11-26 20:02:48·¢±í:

    Ö§³Ö

  13. shell_master ÓÚ 2011-11-26 16:51:07·¢±í:

    ÈÏÈÏÕæÕæµÄ¿´ÍêÁË,ÓÐÒÉÎʵĵط½Ò²×Ô¼º¶¯ÊÖÁË,¶ÔlinuxµÄÈÏʶ¸üÉîÁËÒ»µãµãÁË......¸Ðл¥Ö÷

  14. yqfsan ÓÚ 2011-11-10 16:26:10·¢±í:

    лл·ÖÏí

  15. samir ÓÚ 2011-11-07 12:08:35·¢±í:

    very good good

  16. kiwi95 ÓÚ 2011-11-07 10:54:26·¢±í:

    ÐÂÊֵĺö«Î÷

  17. fire312923253 ÓÚ 2011-07-12 13:34:33·¢±í:

    Ö§³Ö£¬ºÃÎÄ

  18. insll ÓÚ 2011-06-26 22:13:45·¢±í:

    лл£¬ºÜ²»´í¶ÔÓÚÎÒÃÇÕâЩÐÂÈËÀ´Ëµ¡¢¡¢¡£

  19. insll ÓÚ 2011-06-26 22:13:38·¢±í:

    лл£¬ºÜ²»´í¶ÔÓÚÎÒÃÇÕâЩÐÂÈËÀ´Ëµ¡¢¡¢¡£

  20. insll ÓÚ 2011-06-26 22:13:38·¢±í:

    лл£¬ºÜ²»´í¶ÔÓÚÎÒÃÇÕâЩÐÂÈËÀ´Ëµ¡¢¡¢¡£

  21. insll ÓÚ 2011-06-26 22:13:30·¢±í:

    лл£¬ºÜ²»´í¶ÔÓÚÎÒÃÇÕâЩÐÂÈËÀ´Ëµ¡¢¡¢¡£

  22. insll ÓÚ 2011-06-26 22:13:17·¢±í:

    лл£¬ºÜ²»´í¶ÔÓÚÎÒÃÇÕâЩÐÂÈËÀ´Ëµ¡¢¡¢¡£

  23. zhanggadi ÓÚ 2011-01-14 17:30:42·¢±í:

    Õâ¸öÐèÒªÊÕ²Ø

  24. pallana ÓÚ 2011-01-14 15:51:46·¢±í:

    ºÜºÃµÄ½Ì³Ì

  25. gmeljy ÓÚ 2011-01-14 11:46:08·¢±í:

    Ç¿ÁÒÖ§³Ö¡«£¡¡«£¡

  26. 2012linuxroot ÓÚ 2011-01-07 15:04:58·¢±í:

    {:3_118:}

  27. 2012linuxroot ÓÚ 2011-01-07 15:04:52·¢±í:

    ¿ÉÒԶഫµã

  28. lp518 ÓÚ 2011-01-06 22:42:18·¢±í:

    ѧϰһÏÂ~

  29. hanrui990233 ÓÚ 2009-06-20 14:45:19·¢±í:

    ºÃ¶«Î÷ £¡Ð»Ð»°¡ £¡

  30. rdfehame ÓÚ 2009-06-19 17:02:26·¢±í:

    ö¦£¬Î¹ʶøÖªÐÂ

  31. ·è²»ÁË ÓÚ 2009-01-04 09:52:29·¢±í:

    ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ

  32. fazai1986 ÓÚ 2009-01-02 21:49:01·¢±í:

    ºÃ

  33. 2004dzxxx ÓÚ 2008-10-24 10:46:31·¢±í:

    ´óÁ¦Ö§³Ö£¬Ð»Ð»ÁË£¬:0()w(1

  34. as1332000 ÓÚ 2008-06-22 13:39:32·¢±í:

    ÃÔÃÔºýºý~~ ºÃÏñ¿´¶®ÁËЩ~~~
    лл·ÖÏí~~~~~~~~~~~:0w223dc

  35. onlysunshine18 ÓÚ 2007-09-26 09:48:05·¢±í:

    µÄÈ·ÊǺö«Î÷:ha3nd :0D1 :0L

  36. zhl123qq ÓÚ 2007-09-25 15:46:04·¢±í:

    :ha3nd

  37. fortuneteller ÓÚ 2007-09-06 19:45:50·¢±í:

    ÎÒ¼±ÓÚÓÃlinux ʹÓÃÒ»³ÌÐò°ü¼ÆËã,µ«×Ô¼ºÊÇÐÂÊÖ¿´Á˵ãÊéÈԺܶ಻¶®. ÎҵijÌÐò°ü¾ÙÁËÔÚtcshÏÂÈçºÎÉùÃ÷±äÁ¿ÔËÐÐ.(ԭΪӢÎĸöÈËÀë½â¿ÉÄܲ»×¼),ÇëÎÊbashÏÂÈçºÎÔËÐÐ?
    1.½¨Ò鶨Òå±äÁ¿ABCÔÚÓû§µÄstarup file (²»Ì«Àí½â)
    2. setenv ABC
    3. ÔÚ¾ßÌåµÄ×Ô¼º×ö¹¤×÷µÄ·¾¶ÄÚ $ABC/install
    4. ÔÚÉÏÃæµÄ×ö¹¤×÷µÄ·¾¶Ï»á³öÏÖ results/ µÈµÈ×ÓĿ¼ºÍÎļþ
    5. ÊäÈëÃüÁî ./abc ÔËÐгÌÐò°üABC
    ²»ÖªÔÚÎÒµÄredhatĬÈ쵀 bashÏÂÈçºÎÉùÃ÷±äÁ¿ÔËÐÐ??!ÈçºÎ¸ü¸ÄshellÄØ(ÎÒÊÇÐÂÊÖÒ²²»ÊìϤcÓïÑÔ»¹ÊÇÓÃbashºÃ°É)
    ÆÚ´ý´ðÍò·Ö¸Ðл!!

  38. xxkhappy ÓÚ 2007-09-06 09:46:21·¢±í:

    ¾õµÃ²»´í£¬Ò²ÊdzõѧÕߣ¬ËùÒÔCOPYÀ´ÂýÂýÀ´¿´ÁËŶ£¬Èç¹û»¹ÓиüºÃµÄ£¬¸ü¶àµÄ£¬¼ÌÐø·¢±íÄãµÄŶ£¬À´Õß²»¾Ü£¡

  39. 189.1.177.* ÓÚ 2007-08-29 13:13:31·¢±í:

    jpqkgvo thsmgnj fluobz nzerdyafb ybqzi ludqcgnet viabfou

  40. fcwlsy8082 ÓÚ 2007-07-31 11:09:22·¢±í:

    :0L