ºìÁª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. flashtop ÓÚ 2007-06-14 09:27:25·¢±í:

    ½¨Òé³õѧÕß¿´¿´£¬²»´í

  2. wsq1984sdo ÓÚ 2007-06-14 08:00:03·¢±í:

    :0L

  3. orzhijia ÓÚ 2006-12-27 18:07:30·¢±í:

    ²»´í

  4. suertang ÓÚ 2006-12-27 15:55:44·¢±í:

    §Ö÷¿ÉÒÔ¸øÎÒ½²½²´ú²ÎÊýµÄshellÃüÃûÈçºÎÖ´ÐÐÂð£¿

  5. amy0625 ÓÚ 2006-12-27 13:35:17·¢±í:

    ºÃÏêϸ°¡¡£¡£Ð»Ð»Â¥Ö÷ÁË¡£¡£Ñ§Ï°ÖÐ~~:0L

  6. iamfriday ÓÚ 2006-12-22 10:04:24·¢±í:

    ÕýÔò±í´ïʽ~~
    ÏÖ˵Ã÷Ò»ÏÂÕâ¸ö°É¡­¡­È»ºóÔÙ½éÉÜÒ»ÏÂͨÅä~
    лл~~~~
    :time:1

  7. ̹Ժ·ç ÓÚ 2006-12-22 09:48:11·¢±í:

    ÓÐûÓйØÓÚLINUXÃüÁîµÄ Êé¼®ÉÏ´«¿´¿´Ð»Ð»£¡

  8. »¹ÊDz»¶® ÓÚ 2006-12-16 20:05:44·¢±í:

    :0)1
    :0D1

  9. hwphoenix ÓÚ 2006-12-16 08:09:23·¢±í:

    ллָµ¼£¡ÕýÔÚѧϰÖУ¡

  10. hwphoenix ÓÚ 2006-12-07 11:59:36·¢±í:

    ÕýÔÚÓù¦Ñ§Ï°ÖС£¡£¡£¡£¡£¡£¡££¡£¡£¡£¡

  11. ccyde ÓÚ 2006-12-06 14:42:58·¢±í:

    ¶¥

  12. feiying ÓÚ 2006-12-04 22:12:09·¢±í:

    Õâ¸ö¶ÔÐÂÊÖÓÐÓ㬶¥ÉÏÈ¥£¡

  13. lgms2008 ÓÚ 2006-12-04 00:48:26·¢±í:

    ºÃ£¬¶¥Ò»ÏÂÕâ¸öÌù×Ó£¬linuxÐÂÊÖ±Øѧѽ¡£

  14. hylingzhi ÓÚ 2006-12-03 18:02:59·¢±í:

    hao ba

  15. hylingzhi ÓÚ 2006-12-03 16:57:13·¢±í:

    wo buzhidaozmxue

  16. chippendale ÓÚ 2006-12-01 14:15:29·¢±í:

    ºÃ¶«Î÷£¬ÕýÊÇÎÒÒªÕҵġ£Ð»Ð»ÁË

  17. akentop ÓÚ 2006-12-01 11:06:29·¢±í:

    zhici ¶¥ÉÏÈ¥

  18. ÓÚ 2006-11-20 14:37:06·¢±í:

    :0L

  19. 8201111 ÓÚ 2006-11-16 19:41:10·¢±í:

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

  20. ±¿ÄñÏÈ·É ÓÚ 2006-11-16 03:19:03·¢±í:

    ¶¥Ò»ÏÂ

  21. ±¿ÄñÏÈ·É ÓÚ 2006-11-16 03:17:30·¢±í:

    Ì«ºÃÁË

  22. snqyss ÓÚ 2006-11-05 11:39:49·¢±í:

    :0L ѧϰÁË

  23. koji1573 ÓÚ 2006-11-04 13:54:07·¢±í:

    Â¥Ö÷,Å£ÈË

  24. ÉêÓ±123 ÓÚ 2006-10-04 23:20:31·¢±í:

    ÎÒ°²×°aslanux linux ÒÔºó,µ½ÊäÈëÓû§ºÍÃÜÂëʱºò,ÊäºÃÁË
    ½øÈëÁËÊǺÍÊäÈëshellÃüÁîÒ»Ñù.Ôõô¾Í½ø²»µ½Í¼ÐνçÃæ?Ôõô»ØÊÂÓ´
    °ï°ïÎÒ°É
    лл

  25. mrhaigui ÓÚ 2006-10-04 23:20:21·¢±í:

    ºÜ»ù´¡
    ÓÐÓÃ
    ²»¹ý»¹ÊǾõµÃѧϰlinux×Ô¼ºÊÖÍ·ÉÏÓ¦¸ÃÓÐÒ»±¾»ù´¡¼¼ÄܵÄÊéºÍÒ»±¾×¨ÃŵÄÖ¸ÁîµÄÊé
    ÕâÊÇ×î»ù´¡µÄ

  26. ÉêÓ±123 ÓÚ 2006-10-04 23:13:43·¢±í:

  27. @naigo@ ÓÚ 2006-10-04 00:56:56·¢±í:

    ²»´íµÄÎÄÕ£¬ÒѾ­Ñ§Ï°ÁË£¡

  28. ÉêÓ±123 ÓÚ 2006-09-30 20:48:52·¢±í:

    Ì«ºÃÁË
    ¶à·¢µã¾ÍºÃÁË

  29. simple1423 ÓÚ 2006-09-19 17:11:56·¢±í:

    ¶¥ ÓÐÓ¢ÎĵĸüºÃ ±Ï¾¹ÊÇÔ´

  30. feng-gdut ÓÚ 2006-09-18 22:08:40·¢±í:

  31. kuanghao1977 ÓÚ 2006-09-06 09:42:08·¢±í:

    thanks. i think it is helpful for me!

  32. sxwailyc ÓÚ 2006-09-05 08:23:16·¢±í:

    ²»´í

  33. kuanghao1977 ÓÚ 2006-09-04 23:57:45·¢±í:

    ºÃÎÄÕ°¡

  34. quming ÓÚ 2006-09-04 19:51:38·¢±í:

  35. seamanchen126 ÓÚ 2006-08-31 14:06:14·¢±í:

    ºÜ??,??!

  36. nathan_nju ÓÚ 2006-08-31 08:22:13·¢±í:

    Ö§³Öѽ

  37. Á¬Â¶ ÓÚ 2006-08-30 22:23:48·¢±í:

    ¿´¿´£¬ºÜÊʺÏÐÂÊÖ

  38. frandos ÓÚ 2006-08-30 17:33:57·¢±í:

    ѧϰ~~ºÇºÇ

  39. xidianyang ÓÚ 2006-08-29 10:40:25·¢±í:

    hao

  40. ºîѧ°² ÓÚ 2006-08-29 00:26:48·¢±í:

    too little coulde u gie out more ?
    that is so good of u