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

LinuxÑ­Ðò½¥½ø£º±ê×¼ÊäÈë/Êä³öºÍÖض¨Ïò

·¢²¼Ê±¼ä:2005-11-07 00:09:48À´Ô´:ºìÁª×÷Õß:Mrlinux
1. ±ê×¼ÊäÈëÓëÊä³ö

ÎÒÃÇÖªµÀ£¬Ö´ÐÐÒ»¸öshellÃüÁîÐÐʱͨ³£»á×Ô¶¯´ò¿ªÈý¸ö±ê×¼Îļþ£¬¼´±ê×¼ÊäÈëÎļþ£¨stdin£©£¬Í¨³£¶ÔÓ¦Öն˵ļüÅÌ£»±ê×¼Êä³öÎļþ£¨stdout£©ºÍ±ê×¼´íÎóÊä³öÎļþ£¨stderr£©£¬ÕâÁ½¸öÎļþ¶¼¶ÔÓ¦Öն˵ÄÆÁÄ»¡£½ø³Ì½«´Ó±ê×¼ÊäÈëÎļþÖеõ½ÊäÈëÊý¾Ý£¬½«Õý³£Êä³öÊý¾ÝÊä³öµ½±ê×¼Êä³öÎļþ£¬¶ø½«´íÎóÐÅÏ¢Ë͵½±ê×¼´íÎóÎļþÖС£

ÎÒÃÇÒÔcatÃüÁîΪÀý£¬catÃüÁîµÄ¹¦ÄÜÊÇ´ÓÃüÁîÐиø³öµÄÎļþÖжÁÈ¡Êý¾Ý£¬²¢½«ÕâЩÊý¾ÝÖ±½ÓË͵½±ê×¼Êä³ö¡£ÈôʹÓÃÈçÏÂÃüÁ

$ cat config

½«»á°ÑÎļþconfigµÄÄÚÈÝÒÀ´ÎÏÔʾµ½ÆÁÄ»ÉÏ¡£µ«ÊÇ£¬Èç¹ûcatµÄÃüÁîÐÐÖÐûÓвÎÊý£¬Ëü¾Í»á´Ó±ê×¼ÊäÈëÖжÁÈ¡Êý¾Ý£¬²¢½«ÆäË͵½±ê×¼Êä³ö¡£ÀýÈ磺

$ cat

Hello world

Hello world

Bye

Bye



$

Óû§ÊäÈëµÄÿһÐж¼Á¢¿Ì±»catÃüÁîÊä³öµ½ÆÁÄ»ÉÏ¡£

ÁíÒ»¸öÀý×Ó£¬ÃüÁîsort°´ÐжÁÈëÎļþÕýÎÄ£¨µ±ÃüÁîÐÐÖÐûÓиø³öÎļþÃûʱ£¬±íʾ´Ó±ê×¼ÊäÈë¶ÁÈ룩£¬½«ÆäÅÅÐò£¬²¢½«½á¹ûË͵½±ê×¼Êä³ö¡£ÏÂÃæµÄÀý×ÓÊÇ´Ó±ê×¼ÊäÈë¶ÁÈëÒ»¸ö²É¹ºµ¥£¬²¢½«ÆäÅÅÐò¡£

$ sort

bananas

carrots

apples



apples

bananas

carrots

$

ÕâʱÎÒÃÇÔÚÆÁÄ»Éϵõ½ÁËÒÑÅÅÐòµÄ²É¹ºµ¥¡£

Ö±½ÓʹÓñê×¼ÊäÈë/Êä³öÎļþ´æÔÚÒÔÏÂÎÊÌ⣺

ÊäÈëÊý¾Ý´ÓÖÕ¶ËÊäÈëʱ£¬Óû§·ÑÁË°ëÌì¾¢ÊäÈëµÄÊý¾ÝÖ»ÄÜÓÃÒ»´Î¡£Ï´ÎÔÙÏëÓÃÕâЩÊý¾Ýʱ¾ÍµÃÖØÐÂÊäÈë¡£¶øÇÒÔÚÖÕ¶ËÉÏÊäÈëʱ£¬ÈôÊäÈëÓÐÎóÐÞ¸ÄÆðÀ´²»ÊǺܷ½±ã¡£

Êä³öµ½ÖÕ¶ËÆÁÄ»ÉϵÄÐÅÏ¢Ö»ÄÜ¿´²»Äܶ¯¡£ÎÒÃÇÎÞ·¨¶Ô´ËÊä³ö×÷¸ü¶à´¦Àí£¬È罫Êä³ö×÷ΪÁíÒ»ÃüÁîµÄÊäÈë½øÐнøÒ»²½µÄ´¦ÀíµÈ¡£

ΪÁ˽â¾öÉÏÊöÎÊÌ⣬LinuxϵͳΪÊäÈë¡¢Êä³öµÄ´«ËÍÒýÈëÁËÁíÍâÁ½ÖÖ»úÖÆ£¬¼´ÊäÈë/Êä³öÖض¨ÏòºÍ¹ÜµÀ¡£

ÊäÈëÖض¨Ïò
ÊäÈëÖض¨ÏòÊÇÖ¸°ÑÃüÁ»ò¿ÉÖ´ÐгÌÐò£©µÄ±ê×¼ÊäÈëÖض¨Ïòµ½Ö¸¶¨µÄÎļþÖС£Ò²¾ÍÊÇ˵£¬ÊäÈë¿ÉÒÔ²»À´×Ô¼üÅÌ£¬¶øÀ´×ÔÒ»¸öÖ¸¶¨µÄÎļþ¡£ËùÒÔ˵£¬ÊäÈëÖض¨ÏòÖ÷ÒªÓÃÓڸıäÒ»¸öÃüÁîµÄÊäÈëÔ´£¬ÌرðÊǸıäÄÇЩÐèÒª´óÁ¿ÊäÈëµÄÊäÈëÔ´¡£

ÀýÈ磬ÃüÁîwcͳ¼ÆÖ¸¶¨Îļþ°üº¬µÄÐÐÊý¡¢µ¥´ÊÊýºÍ×Ö·ûÊý¡£Èç¹û½öÔÚÃüÁîÐÐÉϼüÈ룺

$ wc

wc½«µÈ´ýÓû§¸æËßËüͳ¼Æʲô£¬Õâʱshell¾ÍºÃÏóËÀÁËÒ»Ñù£¬´Ó¼üÅ̼üÈëµÄËùÓÐÎı¾¶¼³öÏÖÔÚÆÁÄ»ÉÏ£¬µ«²¢Ã»ÓÐʲô½á¹û£¬Ö±ÖÁ°´Ï£¼ctrl+d£¾£¬wc²Å½«ÃüÁî½á¹ûдÔÚÆÁÄ»ÉÏ¡£

Èç¹û¸ø³öÒ»¸öÎļþÃû×÷ΪwcÃüÁîµÄ²ÎÊý£¬ÈçÏÂÀýËùʾ£¬wc½«·µ»Ø¸ÃÎļþËù°üº¬µÄÐÐÊý¡¢µ¥´ÊÊýºÍ×Ö·ûÊý¡£

$ wc /etc/passwd

20 23 726 /etc/passwd

$

ÁíÒ»ÖÖ°Ñ/etc/passwdÎļþÄÚÈÝ´«¸øwcÃüÁîµÄ·½·¨ÊÇÖض¨ÏòwcµÄÊäÈë¡£ÊäÈëÖض¨ÏòµÄÒ»°ãÐÎʽΪ£ºÃüÁî<ÎļþÃû¡£¿ÉÒÔÓÃÏÂÃæµÄÃüÁî°ÑwcÃüÁîµÄÊäÈëÖض¨ÏòΪ/etc/passwdÎļþ£º

$ wc < /etc/passwd

20 23 726

$

ÁíÒ»ÖÖÊäÈëÖض¨Ïò³ÆΪhereÎĵµ£¬Ëü¸æËßshellµ±Ç°ÃüÁîµÄ±ê×¼ÊäÈëÀ´×ÔÃüÁîÐС£hereÎĵµµÄÖض¨Ïò²Ù×÷·ûʹÓÃ<<¡£Ëü½«Ò»¶Ô·Ö¸ô·û£¨±¾ÀýÖÐÓÃdelim±íʾ£©Ö®¼äµÄÕýÎÄÖض¨ÏòÊäÈë¸øÃüÁî¡£ÏÂÀý½«Ò»¶Ô·Ö¸ô·ûdelimÖ®¼äµÄÕýÎÄ×÷ΪwcÃüÁîµÄÊäÈ룬ͳ¼Æ³öÕýÎĵÄÐÐÊý¡¢µ¥´ÊÊýºÍ×Ö·ûÊý¡£

$ wc<

>this text forms the content

>of the here document,which

>continues until the end of

>text delimter

>delim

4 17 98

ÔÚ<<²Ù×÷·ûºóÃæ,ÈκÎ×Ö·û¶¼¿ÉÒÔ×÷ΪÕýÎÄ¿ªÊ¼Ç°µÄ·Ö¸ô·û£¬±¾ÀýÖÐʹÓÃdelim×÷Ϊ·Ö¸ô·û¡£hereÎĵµµÄÕýÎÄÒ»Ö±ÑÓÐøµ½Óö¼ûÁíÒ»¸ö·Ö¸ô·ûΪֹ¡£µÚ¶þ¸ö·Ö¸ô·ûÓ¦³öÏÖÔÚÐÂÐеĿªÍ·¡£ÕâʱhereÎĵµµÄÕýÎÄ£¨²»°üÀ¨¿ªÊ¼ºÍ½áÊøµÄ·Ö¸ô·û£©½«ÖØж¨ÏòË͸øÃüÁîwc×÷ΪËüµÄ±ê×¼ÊäÈë¡£

ÓÉÓÚ´ó¶àÊýÃüÁÒÔ²ÎÊýµÄÐÎʽÔÚÃüÁîÐÐÉÏÖ¸¶¨ÊäÈëÎļþµÄÎļþÃû£¬ËùÒÔÊäÈëÖض¨Ïò²¢²»¾­³£Ê¹Ó᣾¡¹ÜÈç´Ë£¬µ±ÒªÊ¹ÓÃÒ»¸ö²»½ÓÊÜÎļþÃû×÷ΪÊäÈë²ÎÊýµÄÃüÁ¶øÐèÒªµÄÊäÈëÄÚÈÝÓÖ´æÔÚÒ»¸öÎļþÀïʱ£¬¾ÍÄÜÓÃÊäÈëÖض¨Ïò½â¾öÎÊÌâ¡£

Êä³öÖض¨Ïò
Êä³öÖض¨ÏòÊÇÖ¸°ÑÃüÁ»ò¿ÉÖ´ÐгÌÐò£©µÄ±ê×¼Êä³ö»ò±ê×¼´íÎóÊä³öÖØж¨Ïòµ½Ö¸¶¨ÎļþÖС£ÕâÑù£¬¸ÃÃüÁîµÄÊä³ö¾Í²»ÏÔʾÔÚÆÁÄ»ÉÏ£¬¶øÊÇдÈëµ½Ö¸¶¨ÎļþÖС£

Êä³öÖض¨Ïò±ÈÊäÈëÖض¨Ïò¸ü³£Ó㬺ܶàÇé¿ö϶¼¿ÉÒÔʹÓÃÕâÖÖ¹¦ÄÜ¡£ÀýÈ磬Èç¹ûij¸öÃüÁîµÄÊä³öºÜ¶à£¬ÔÚÆÁÄ»Éϲ»ÄÜÍêÈ«ÏÔʾ£¬ÄÇô½«Êä³öÖض¨Ïòµ½Ò»¸öÎļþÖУ¬È»ºóÔÙÓÃÎı¾±à¼­Æ÷´ò¿ªÕâ¸öÎļþ£¬¾Í¿ÉÒԲ鿴Êä³öÐÅÏ¢£»Èç¹ûÏë±£´æÒ»¸öÃüÁîµÄÊä³ö£¬Ò²¿ÉÒÔʹÓÃÕâÖÖ·½·¨¡£»¹ÓУ¬Êä³öÖض¨Ïò¿ÉÒÔÓÃÓÚ°ÑÒ»¸öÃüÁîµÄÊä³öµ±×÷ÁíÒ»¸öÃüÁîµÄÊäÈ루»¹ÓÐÒ»ÖÖ¸ü¼òµ¥µÄ·½·¨£¬¾ÍÊÇʹÓùܵÀ£¬½«ÔÚÏÂÃæ½éÉÜ£©¡£

Êä³öÖض¨ÏòµÄÒ»°ãÐÎʽΪ£ºÃüÁî>ÎļþÃû¡£ÀýÈ磺

$ ls > directory.out

$ cat directory.out

ch1.doc ch2.doc ch3.doc chimp config mail/ test/
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 5 ÌõÆÀÂÛ

  1. yuer520 ÓÚ 2011-07-04 03:21:31·¢±í:

    ¶àлÁË

  2. yuer520 ÓÚ 2011-07-04 03:21:20·¢±í:

    0.0

  3. Mrlinux ÓÚ 2005-11-07 00:11:26·¢±í:

    $ !!

    ls

    mydata today reports

    Ò²¿ÉÒÔÓá°Ä£Ê½¡±À´ËÑË÷Ò»¸öÀúʷʼþ¡£ËÑË÷µÄ¡°Ä£Ê½¡±±ØÐëÓ÷ûºÅ¡°?¡±À¨ÆðÀ´¡£ÏÂÀýÊÇÓá°Ä£Ê½¡±¡°?myd?¡±À´ËÑË÷ÀúʷʼþºÅΪ3µÄÀúʷʼþ¡°vi mydata¡±¡£

    £ÛÀý¡¿

    $ !?myd?

    vi mydata

    ²éѯÀúʷʼþ
    ¿ÉÒÔÔÚÃüÁîÐÐÉϱ༭ÀúʷʼþÁбíÖеÄʼþ¡£±í10-3ÁгöÁ˲éѯÀúʷʼþÁбíµÄ¸÷ÖÖ²Ù×÷¡£

    ±í10-3¡¡²éѯÀúʷʼþ²Ù×÷

    ²éѯÀúʷʼþ²Ù×÷
    ¹¦ÄÜ

    Ctrl+n»òÏòϹâ±ê¼ü
    ÒÆÖÁÀúʷʼþÁбíÖе±Ç°Ê¼þµÄÏÂÒ»Àúʷʼþ

    Ctrl+p»òÏòÉϹâ±ê¼ü
    ÒÆÖÁÀúʷʼþÁбíÖе±Ç°Ê¼þµÄÇ°Ò»Àúʷʼþ

    Esc <
    ÒÆÖÁÀúʷʼþÁбí±íÊ×

    Esc >
    ÒÆÖÁÀúʷʼþÁбí±íβ

    !event_num
    ÓÃÀúʷʼþºÅÀ´¶¨Î»Ò»¸öÀúʷʼþ

    !characters
    ÓÃÀúʷʼþµÄ×Ö·ûǰ׺À´²éѯһ¸öÀúʷʼþ

    !?pattern
    Óá°Ä£Ê½¡±À´²éѯÀúʷʼþÁбíÖеÄʼþ

    !-event_num
    ͨ¹ýÆ«ÒÆÁ¿À´¶¨Î»Àúʷʼþ


    ÅäÖÃhistory£ºHISTFILE¼°HISTSIZE
    ϵͳ±£´æµÄÀúʷʼþÊý±»±£´æÔÚÒ»¸öÌض¨µÄϵͳ±äÁ¿ÖУ¬Õâ¸ö±äÁ¿¾ÍÊÇHISTSIZE¡£Õâ¸ö±äÁ¿µÄȱʡֵͨ³£±»ÉèÖÃΪ500¡£Õâ¸öÖµ¿ÉÒÔ±»Ð޸ġ£ÀýÈ磺

    $ HISTSIZE=10

    ½«HISTSIZEµÄÖµÖØÐÂÉèÖÃΪ10¡£

    Àúʷʼþ±»±£´æÔÚÒ»¸öÎļþÖУ¬ÎļþÃûÓɱäÁ¿HISTFILEÖ¸¶¨¡£Í¨³£Õâ¸öÎļþµÄȱʡÃûÊÇ.bash_history¡£Í¨¹ý¸ø±äÁ¿HISTFILE¸³Öµ£¬¿ÉÒÔÖ¸¶¨ÐµÄÎļþÃû¡£

    £ÛÀý¡¿

    $ echo $HISTFILE

    /home/lisa/.bash_history

    $ HISTFILE=¡±/home/lisa/newhist¡±

    $ echo $HISTFILE

    /home/lisa/newhist

    ÒÔÉϲÙ×÷ÏÈÏÔʾ±äÁ¿HISTFILEµÄÖµ£¬È»ºó¸³ÓèËüеÄÖµ¡°/home/lisa/newhist¡±£¬ÒÔºóËùÓеÄÀúʷʼþ½«±»±£´æÔÚnewhistÎļþÖС£

  4. Mrlinux ÓÚ 2005-11-07 00:11:07·¢±í:

    FireBird Firebird2.60.tgz.README

    ÏÖÔÚҪɾ³ýFirebird2.60.tgz.READMEÎļþ£¬¼üÈ룺

    $ rm -f Fi

    ϵͳ»á·¢³ö¾¯±¨Éù£¬²¢ÇÒ×Ô¶¯½«ÃüÁîÐв¹È«Îª£º

    $ rm -f Fire

    ²¢µÈ´ýÓû§½øÒ»²½ÊäÈëÎļþÃûµÄºóÃ沿·Ö¡£ÏÖÔÚÔÙ¼üÈ룺

    b

    ϵͳÔٴη¢³ö¾¯±¨Éù£¬²¢ÇÒ×Ô¶¯½«ÃüÁîÐв¹È«Îª£º

    $ rm -f Firebird

    ²¢µÈ´ýÓû§½øÒ»²½ÊäÈëÎļþÃûµÄºóÃ沿·Ö¡£ÏÖÔÚÔÙ¼üÈ룺

    2.6

    ϵͳÔٴη¢³ö¾¯±¨Éù£¬²¢ÇÒ×Ô¶¯½«ÃüÁîÐв¹È«Îª£º

    $ rm -f Firebird2.60.tgz

    ²¢µÈ´ýÓû§½øÒ»²½ÊäÈëÎļþÃûµÄºóÃ沿·Ö¡£ÏÖÔÚÔÙ¼üÈ룺

    .

    ´ËʱÃüÁ±»²¹È«Îª£º

    $ rm -f Firebird2.60.tgz..README

    ´ÓÉÏÀý¿ÉÒÔ¿´µ½£¬bash×ÜÊǾ¡Á¦¸ù¾ÝÓû§ÊäÈëµÄÐÅÏ¢À´²¹È«ÃüÁî¡£µ±ÎÞ·¨¸ù¾ÝÏÖÓÐÐÅÏ¢²¹È«ÃüÁîʱ£¬ÔòÌáʾÓû§ÔÙ¸ø³ö¸ü¶àµÄÐÅÏ¢£¬È»ºóÔÙ¸ù¾ÝÓû§µÄÌáʾÀ´½øÒ»²½²¹È«ÃüÁî¡£×÷ΪÓû§×îºÃÊÇÄܹ»Ò»´ÎÐÔ¸ø³ö×ã¹»µÄÐÅÏ¢ÒÔ±ãÓÚbash½øÐÐÃüÁȫ£»·ñÔò¶à°´¼¸´Î £¬Ê±¼äÒ²¾ÍÏûºÄµôÁË¡£

    ÃüÁîÐб༭

    ÔÚBashÖпÉÒÔ¶ÔÃüÁîÐнøÐб༭£¬ÒÔ±ãÓû§ÔÚÖ´ÐÐËù¼üÈëµÄÃüÁî֮ǰÄܹ»ÐÞ¸ÄËù¼üÈëµÄÃüÁî¡£Èç¹ûÔÚ¼üÈëÃüÁîʱ³öÏÖƴд´íÎó£¬Ö»ÐèÔÚÔËÐÐËù¼üÈëµÄÃüÁî֮ǰ£¬Ê¹Óñ༭ÃüÁîÀ´¾ÀÕý±à¼­´íÎó£¬È»ºóÖ´ÐÐËü£¬¶ø²»ÓÃÖØÐÂÊäÈëÕûÐÐÃüÁî¡£Õâ¸ö¹¦ÄܶÔÒÔ³¤Â·¾¶ÎļþÃû×÷²ÎÊýµÄÃüÁîÌرðÓÐÓá£

    ±í10-2ÊǶÔÃüÁîÐб༭²Ù×÷µÄÒ»¸ö×ܽᡣ

    ±í10-2¡¡ÃüÁîÐб༭²Ù×÷



    ÃüÁîÐб༭²Ù×÷
    ¹¦ÄÜ

    Ctrl+b»ò×ó¼ýÍ·¼ü
    ×óÒÆÒ»¸ö×Ö·û£¨ÒÆÖÁÇ°Ò»¸ö×Ö·û£©

    Ctrl+f»òÓÒ¼ýÍ·¼ü
    ÓÒÒÆÒ»¸ö×Ö·û£¨ÒÆÖÁºóÒ»¸ö×Ö·û£©

    Ctrl+a
    ÒÆÖÁÐÐÊ×

    Ctrl+e
    ÒÆÖÁÐÐβ

    Esc b
    ×óÒÆÒ»¸öµ¥´Ê

    Esc f
    ÓÒÒÆÒ»¸öµ¥´Ê

    Del
    ɾ³ý¹â±êËùÔÚ´¦µÄ×Ö·û

    Ctrl+d
    ɾ³ý¹â±êËùÔÚ´¦µÄ×Ö·û

    BACKSPACE»òCtrl+h
    ɾ³ý¹â±ê×ó±ßµÄ×Ö·û

    Ctrl+k
    ɾ³ýÖÁÐÐβ




    ÃüÁîÀúÊ·

    ÔÚBashÖУ¬historyÃüÁîÄܹ»±£´æ×î½üËùÖ´ÐеÄÃüÁî¡£ÕâЩÃüÁîµÄÀúÊ·¼Ç¼ºÅ´Ó1¿ªÊ¼£¬Ö»ÓÐÓÐÏÞ¸öÃüÁî¿ÉÒÔ±»±£´æÆðÀ´£¬×î¶à500¸ö£¬¼´historyÃüÁîµÄÀúÊ·¼Ç¼ºÅȱʡֵΪ500¡£Òª²é¿´×î½üÖ´ÐеÄÃüÁֻҪ¼üÈëhistoryÃüÁȻºó¼üÈë»Ø³µ¼ü£¬×î½üÖ´ÐйýµÄÃüÁî¼´°´ÏȺó˳Ðò±»ÏÔʾ³öÀ´£¨¸÷ÌõÃüÁîÇ°µÄÊý×ÖΪÀúÊ·¼Ç¼ºÅ£©¡£

    £ÛÀý¡¿

    $ history

    1 cp mydata today

    2 vi mydata

    3 mv mydata reports

    4 cd reports

    5 ls

    ¡­

    ËùÓÐÕâЩÃüÁ±»³ÆΪʼþ£¨event£©£¬Ò»¸öʼþ±íʾһ¸ö²Ù×÷ÒѾ­·¢Éú£¬¼´Ò»¸öÃüÁîÒѱ»Ö´ÐС£ÕâЩʼþ¸ù¾ÝËüÃDZ»Ö´ÐеÄÏȺó˳ÐòÓÃÊý×Ö±êʶ£¬ÕâÒ»±êʶ³ÆΪÀúʷʼþºÅ¡£×îºóÖ´ÐеÄÀúʷʼþµÄʼþºÅ×î´ó¡£Ã¿¸öʼþ¶¼¿ÉÓÉËüµÄÀúʷʼþºÅ»òÃüÁîµÄ³õʼ×Ö·û»ò×Ö·û´®µÈÈ·¶¨¡£

    ÀûÓÃhistoryÃüÁîÄܹ»²éѯÒÔÇ°µÄʼþ£¬²¢¿É°ÑËüÃÇÏÔʾµ½ÃüÁîÐÐÉÏÖ´ÐÐÕâһʼþ¡£×î¼ò±ãµÄ·½·¨¾ÍÊÇÀûÓÃÉÏϼýÍ·¼ü£¬°ÑÏÈÇ°µÄʼþÖð´ÎÏÔʾµ½ÃüÁîÐС£Õâ¸ö²Ù×÷²»ÐèÒªÔËÐÐhistoryÃüÁî¾Í¿ÉÒÔÖ´ÐС£°´¶¯Ò»ÏÂÉϼýÍ·¼ü£¬ÄÇôÉÏÒ»´ÎÖ´ÐеÄÒ»¸öʼþ¾Í½«³öÏÖÔÚÃüÁîÐÐÉÏ£¬ÔÙ°´Ò»Ï£¬ÉÏÒ»´ÎµÄǰһʼþÓÖ»á³öÏÖÔÚÃüÁîÐÐÉÏ£»°´¶¯Ò»ÏÂϼýÍ·¼ü£¬½«»áʹµ±Ç°Ê¼þµÄÏÂһʼþ³öÏÖÔÚÃüÁîÐÐÉÏ¡£

    BashÒ²¿ÉÒÔͨ¹ý¼üÈëEsc¡¢Tab¼üÀ´Íê³É¶ÔÀúʷʼþµÄ×Ö·ûÀ©Õ¹¡£ºÍ±ê×¼ÃüÁîÐÐÀ©Õ¹ÌØÐÔÒ»Ñù£¬¼üÈëÀúʷʼþµÄ²¿·Ö×Ö·û´®£¬È»ºó¼üÈëEsc£¬ÔÙ¼üÈëTab¼ü£¬Óë¸Õ²Å¼üÈëµÄ×Ö·û´®ÏàÆ¥ÅäµÄÀúʷʼþ½«×Ô¶¯À©Õ¹²¢»ØÏÔµ½ÃüÁîÐд¦¡£Èç¹û²»Ö¹Ò»¸öʼþÓëÊäÈëµÄ×Ö·û´®ÏàÆ¥Å䣬¾Í»áÌýµ½Ò»ÉùÏìÁ壬¼ÌÐø¼üÈë×Ö·û»ò×Ö·û´®£¬shell½«»áΨһȷ¶¨Óû§ËùÒª¼üÈëµÄÀúʷʼþ¡£

    »¹ÓÐÒ»¸ö²éѯºÍÖ´ÐÐÀúʷʼþµÄÃüÁî----!ÃüÁî¡£ÔÚ!ÃüÁîºó¼üÈëÓëÀúʷʼþÏà¹ØÁªµÄ×Ö·û£¬Õâ¸ö¹ØÁª×Ö·û¿ÉÒÔÊÇÀúʷʼþµÄÀúʷʼþºÅ£¬Ò²¿ÉÒÔÊǸÃʼþµÄÇ°¼¸¸ö×Ö·û¡£ÔÚÏÂÃæµÄÀý×ÓÖУ¬²éѯµ½ÀúʷʼþºÅΪ3µÄʼþ£¬È»ºóÓÖÓÃÆ俪ͷµÄ¼¸¸ö×Ö·ûȥƥÅ䣬Ҳ²éѯµ½¸ÃÃüÁî¡£

    £ÛÀý¡¿

    $ !3

    mv mydata reports

    $ !mv

    mv mydata reports

    Ò²¿ÉÒÔÓÃÒ»¸öÆ«ÒÆÁ¿£¨Ïà¶ÔÓÚÀúʷʼþÁбíÖÐ×îºóÒ»¸öʼþ£©À´²éѯÀúʷʼþ¡£¸ºµÄÆ«ÒÆÁ¿½«´ÓÀúʷʼþÁбí±íβÏòÇ°Æ«ÒÆ¡£ÔÚÏÂÃæµÄÀý×ÓÖУ¬ÀúʷʼþºÅΪ2µÄʼþ¡°vi mydata¡±¾ÍÊÇÓÃÒ»¸ö¸ºµÄÆ«ÒÆÁ¿²éѯµ½µÄ¡£±ØÐë×¢ÒâµÄÊÇ£¬Õâ¸öÆ«ÒÆÁ¿ÊÇÏà¶ÔÓÚÀúʷʼþÁбíÖеÄ×îºóÒ»¸öʼþµÄ¡£ÔÚ±¾ÀýÖУ¬ÀúʷʼþÁбíÖÐ×îºóÒ»¸öʼþÊÇʼþ5£¬ÀúʷʼþÁбíÖеÚÒ»¸öʼþΪ1¡£´ÓÀúʷʼþºÅΪ5µÄʼþ£¬ÍùÇ°Æ«ÒÆ4£¬¼´ÊÇÀúʷʼþºÅΪ2µÄʼþ¡£

    £ÛÀý¡¿

    $ !-4

    vi mydata

    Èç¹û¼üÈë!!£¬ÔòϵͳĬÈÏΪÉÏһʼþ¡£ÏÂÃæµÄÀý×ÓÖУ¬Óû§ÔÚÃüÁîÐÐÉϼüÈë!!ÃüÁϵͳ½«Ö´ÐÐÉÏһʼþ£º¡°ls¡±ÃüÁî¡£

    £ÛÀý¡¿

  5. Mrlinux ÓÚ 2005-11-07 00:10:27·¢±í:

    $

    ½«lsÃüÁîµÄÊä³ö±£´æΪһ¸öÃûΪdirectory.outµÄÎļþ¡£

    ×¢£ºÈç¹û>·ûºÅºó±ßµÄÎļþÒÑ´æÔÚ£¬ÄÇôÕâ¸öÎļþ½«±»ÖØд¡£

    Ϊ±ÜÃâÊä³öÖض¨ÏòÖÐÖ¸¶¨ÎļþÖ»ÄÜ´æ·Åµ±Ç°ÃüÁîµÄÊä³öÖض¨ÏòµÄÄÚÈÝ£¬shellÌṩÁËÊä³öÖض¨ÏòµÄÒ»ÖÖ×·¼ÓÊֶΡ£Êä³ö×·¼ÓÖض¨ÏòÓëÊä³öÖض¨ÏòµÄ¹¦Äܷdz£ÏàËÆ£¬Çø±ð½öÔÚÓÚÊä³ö×·¼ÓÖض¨ÏòµÄ¹¦ÄÜÊÇ°ÑÃüÁ»ò¿ÉÖ´ÐгÌÐò£©µÄÊä³ö½á¹û×·¼Óµ½Ö¸¶¨ÎļþµÄ×îºó£¬¶ø¸ÃÎļþÔ­ÓÐÄÚÈݲ»±»ÆÆ»µ¡£

    Èç¹ûÒª½«Ò»ÌõÃüÁîµÄÊä³ö½á¹û×·¼Óµ½Ö¸¶¨ÎļþµÄºóÃ棬¿ÉÒÔʹÓÃ×·¼ÓÖض¨Ïò²Ù×÷·û>>¡£ÐÎʽΪ£ºÃüÁî>>ÎļþÃû¡£ÀýÈ磺

    $ ls *.doc>>directory.out

    $ cat directory.out

    ch1.doc ch2.doc ch3.doc chimp config mail/ test/

    ch1.doc ch2.doc ch3.doc

    $

    ºÍ³ÌÐòµÄ±ê×¼Êä³öÖض¨ÏòÒ»Ñù£¬³ÌÐòµÄ´íÎóÊä³öÒ²¿ÉÒÔÖØж¨Ïò¡£Ê¹Ó÷ûºÅ2>£¨»ò×·¼Ó·ûºÅ2>>£©±íʾ¶Ô´íÎóÊä³öÉ豸Öض¨Ïò¡£ÀýÈçÏÂÃæµÄÃüÁ

    $ ls /usr/tmp 2> err.file

    ¿ÉÔÚÆÁÄ»ÉÏ¿´µ½³ÌÐòµÄÕý³£Êä³ö½á¹û£¬µ«ÓÖ½«³ÌÐòµÄÈκδíÎóÐÅÏ¢Ë͵½Îļþerr.fileÖУ¬ÒÔ±¸½«À´¼ì²éÓá£

    »¹¿ÉÒÔʹÓÃÁíÒ»¸öÊä³öÖض¨Ïò²Ù×÷·û£¨&>£©½«±ê×¼Êä³öºÍ´íÎóÊä³öͬʱË͵½Í¬Ò»ÎļþÖС£ÀýÈ磺

    $ ls /usr/tmp &> output.file

    ÀûÓÃÖض¨Ïò½«ÃüÁî×éºÏÔÚÒ»Æ𣬿ÉʵÏÖϵͳµ¥¸öÃüÁî²»ÄÜÌṩµÄй¦ÄÜ¡£ÀýÈçʹÓÃÏÂÃæµÄÃüÁîÐòÁУº

    $ ls /usr/bin > /tmp/dir

    $ wc -w < /tmp/dir

    459

    ͳ¼ÆÁË/usr/binĿ¼ÏµÄÎļþ¸öÊý¡£

    ¹Ü µÀ

    ½«Ò»¸ö³ÌÐò»òÃüÁîµÄÊä³ö×÷ΪÁíÒ»¸ö³ÌÐò»òÃüÁîµÄÊäÈ룬ÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊÇͨ¹ýÒ»¸öÁÙʱÎļþ½«Á½¸öÃüÁî»ò³ÌÐò½áºÏÔÚÒ»Æð£¬ÀýÈçÉϸöÀý×ÓÖеÄ/tmp/dirÎļþ½«lsºÍwcÃüÁîÁªÔÚÒ»Æð£»ÁíÒ»ÖÖÊÇLinuxËùÌṩµÄ¹ÜµÀ¹¦ÄÜ¡£ÕâÖÖ·½·¨±ÈÇ°Ò»ÖÖ·½·¨¸üºÃ¡£

    ¹ÜµÀ¿ÉÒÔ°ÑһϵÁÐÃüÁîÁ¬½ÓÆðÀ´£¬ÕâÒâζ×ŵÚÒ»¸öÃüÁîµÄÊä³ö»á×÷ΪµÚ¶þ¸öÃüÁîµÄÊäÈëͨ¹ý¹ÜµÀ´«¸øµÚ¶þ¸öÃüÁµÚ¶þ¸öÃüÁîµÄÊä³öÓÖ»á×÷ΪµÚÈý¸öÃüÁîµÄÊäÈ룬ÒÔ´ËÀàÍÆ¡£ÏÔʾÔÚÆÁÄ»ÉϵÄÊǹܵÀÐÐÖÐ×îºóÒ»¸öÃüÁîµÄÊä³ö£¨Èç¹ûÃüÁîÐÐÖÐδʹÓÃÊä³öÖض¨Ïò£©¡£

    ͨ¹ýʹÓùܵÀ·û¡°|¡±À´½¨Á¢Ò»¸ö¹ÜµÀÐС£ÓùܵÀÖØдÉÏÃæµÄÀý×Ó£º

    $ ls /usr/bin|wc -w

    1789

    ÔÙÈ磺

    $ cat sample.txt|grep "High"|wc -l

    ¹ÜµÀ½«catÃüÁÁгöÒ»¸öÎļþµÄÄÚÈÝ£©µÄÊä³öË͸øgrepÃüÁî¡£grepÃüÁîÔÚÊäÈëÀï²éÕÒµ¥´ÊHigh£¬grepÃüÁîµÄÊä³öÔòÊÇËùÓаüº¬µ¥´ÊHighµÄÐУ¬Õâ¸öÊä³öÓÖ±»Ë͸øwcÃüÁwcÃüÁîͳ¼Æ³öÊäÈëÖеÄÐÐÊý¡£¼ÙÉèsample.txtÎļþµÄÄÚÈÝÈçÏ£º

    Things to do today:

    Low:Go grocery shopping

    High:Return movie

    High:Clear level 3 in Alien vs. Predator

    Medium:Pick up clothes from dry cleaner

    ÄÇô¸Ã¹ÜµÀÐеĽá¹ûÊÇ2¡£

    ÃüÁîÌæ»»

    ÃüÁîÌæ»»ºÍÖض¨ÏòÓÐЩÏàËÆ£¬µ«Çø±ðÔÚÓÚÃüÁîÌæ»»Êǽ«Ò»¸öÃüÁîµÄÊä³ö×÷ΪÁíÍâÒ»¸öÃüÁîµÄ²ÎÊý¡£³£ÓÃÃüÁî¸ñʽΪ£º

    command1 `command2`

    ÆäÖУ¬command2µÄÊä³ö½«×÷Ϊcommand1µÄ²ÎÊý¡£ÐèҪעÒâµÄÊÇÕâÀïµÄ`·ûºÅ£¬±»ËüÀ¨ÆðÀ´µÄÄÚÈݽ«×÷ΪÃüÁîÖ´ÐУ¬Ö´ÐкóµÄ½á¹û×÷Ϊcommand1µÄ²ÎÊý¡£ÀýÈ磺

    $ cd `pwd`

    ¸ÃÃüÁpwdÃüÁîÁгöµÄĿ¼×÷ΪcdÃüÁîµÄ²ÎÊý£¬½á¹ûÈÔÈ»ÊÇÍ£ÁôÔÚµ±Ç°Ä¿Â¼Ï¡£

    µÚ¶þÊ®¶þ¿Î¡¡ÔÚBashÖеIJÙ×÷


    ÃüÁîºÍÎļþÃûÀ©Õ¹ÌØÐÔ

    BashÃüÁîÐоßÓÐÃüÁîºÍÎļþÃûÀ©Õ¹ÌØÐÔ¡£µ±ÊäÈëÒ»¸ö»¹Ã»Íê³ÉµÄÃüÁî»òÎļþÃûʱ£¬Ö»Ðè¼üÈëTab¼ü¾ÍÄܼ¤»îÃüÁîºÍÎļþÃûÀ©Õ¹ÌØÐÔ£¬´Ó¶øÍê³É¸ÃÃüÁîµÄÊ£ÓàÊäÈë¡£Èç¹ûÓжà¸öÃüÁî»òÎļþµÄǰ׺Ïàͬ£¬Bash½«ÏìÁå²¢µÈ´ýÓû§ÊäÈë×ã¹»µÄ×Ö·û£¬ÒÔ±ãÑ¡ÔñΨһµÄÃüÁî»òÎļþÃû£¬Èç¹ûÕÒµ½£¬ÏµÍ³½«×Ô¶¯²¹ÆëËÑË÷µ½µÄÃüÁî»òÎļþÃû£¬Óû§°´»Ø³µ¼üºó£¬ÏµÍ³½«Ö´ÐÐÕâÌõÖ¸Áî¡£ÀýÈ磺

    $ cat pre

    $ cat preface

    BashÒ²ÄÜÁгöµ±Ç°Ä¿Â¼Ï²¿·ÖÆ¥ÅäµÄÎļþÃûÀ´Íê³ÉÎļþÃûÀ©Õ¹¡£Èç¹û¼üÈëEsc£¬È»ºó¼üÈë?£¬shell½«ÁгöËùÓÐÓëÊäÈëµÄ×Ö·û´®ÏàÆ¥ÅäµÄÎļþÃû¡£ÀýÈçÏÂÀý£¬ÔÚûÓÐÍê³ÉµÄÊäÈëºó¼üÈëEsc ?£¬shell½«ÁгöËùÓÐÓëÊäÈëµÄ×Ö·û´®ÏàÆ¥ÅäµÄ×Ö·û´®£¬È»ºóshell»ØÏÔÃüÁîÐУ¬¸ù¾ÝÁгöµÄÎļþÃû£¬¿ÉÒÔ¼üÈëÒªÊäÈëµÄÎļþÃû»ò°´ÏÂTab¼üÀ´Íê³ÉÎļþÃûÀ©Õ¹¡£ÀýÈ磺

    $ ls

    document docudrama

    $ cat doc

    document

    docudrama

    $ cat docudrama

    £ÛÀý¡¿ÏÂÃæÊÇÒ»¸öĿ¼°üº¬µÄÎļþÁÐ±í£º

    Firebird2.7.tgz Firebird.README Firebird2.60.tgz