Linux Bash Shellѧϰ£¨Ê®Æߣ©£ºI/OÖض¨Ïò
¡¡¡¡±¾ÎÄÒ²¼´¡¶Learning the bash Shell¡·3rd EditionµÄµÚÆßÕÂInput/Output and Command-Line ProcessintÖ®¶ÁÊé±Ê¼ÇÖ®Ò»¡£ÎÒÃÇÔø¾Ñ§Ï°¹ýshellµÄ»ù±¾IOÖض¨Ïò²Ù×÷£º>¡¢<ºÍ|¡£»ù±¾ÉÏÄÜÂú×ã95%µÄÇé¿ö£¬µ«ÊÇÎÒÃÇÐèÒªÖªµÀbashÖ§³ÖµÄÖض¨Ïò²Ù×÷¡£
cmd1
|cmd2
£º pipe£¬½«cmd1
µÄ±ê×¼Êä³ö×÷Ϊcmd2
µÄ±ê×¼ÊäÈë
>file
£º½«±ê×¼Êä³öÖض¨Ïòµ½file
<file
£º½«file×÷Ϊ±ê×¼ÊäÈë
>>file
£º½«±ê×¼Êä³öÖض¨Ïòµ½file£¬Èç¹ûfile´æÔÚ£¬appendµ½ÎļþÖУ¬¼´¸½¼Óµ½ÎļþµÄºóÃ棬¶ø²»ÊǸ²¸ÇÎļþ
µ±cat²»´ø²ÎÊýµÄʱºò£¬±íʾʹÓñê×¼ÊäÈë×÷ΪÊäÈ룬ÕâÔÊÐíÔÚ±ê×¼ÊäÈëÖмüÈëÏà¹ØµÄÄÚÈÝ£¬ÏÂÃ潫alias¼ÓÈë.bashrc×÷Ϊ×îºóÒ»ÐÐ
$ cat >> .bashrc
alias cdmnt='mount -t iso9660 /dev/sbpcd /cdrom'
^D
>|file
£ºÇ¿Öƽ«±ê×¼Êä³öÖض¨Ïòµ½file£¬¼´Ê¹noclobberÉèÖᣵ±ÉèÖû·¾³±äÁ¿set –o noclobber£¬½«½ûÖ¹Öض¨Ïòµ½Ò»¸öÒѾ´æÔÚµÄÎļþÖУ¬±ÜÃâÎļþ±»¸²¸Ç¡£
n
>|file
£ºÇ¿Öƽ«ÎļþÃèÊö·ûnÖض¨Ïòµ½file£¬¼´Ê¹noclobber´ò¿ª
<>file
£º½«file×÷Ϊ±ê×¼ÊäÈëºÍ±ê×¼Êä³ö¡£Í¨³£ÓÃÓÚÉ豸Îļþ£¨/devÏÂÃæµÄÎļþ£©£¬µ×²ãϵͳ³ÌÐòÔ±¿ÉÓÃÖ®²âÊÔÉ豸Çý¶¯£¬ÆäËûµÄºÜÉÙÓá£
n
<>file
£º½«file×÷ΪÎļþÃèÊö·ûnµÄÊäÈëºÍÊä³ö
<<label
£ºHere-document; see text ¡£½«shellµÄ±ê×¼ÊäÈë×÷ΪÃüÁîµÄÊäÈ룬ֱµ½ÐÐÖÐÖ®°üº¬label¡£ÕâÖмäµÄÊäÈë³ÉΪhere-document¡£ÏÂÃæÊÇÒ»¸öÀý×Ó¡£ÎÒÃÇÈÃÈËʹÓÃcat >> fileµÄ·½Ê½£¬Í¨¹ý±ê×¼ÊäÈëÔÚÎļþÖи½¼ÓÄÚÈÝ¡£
$ cat >> msgfile << . #ÕâÀï<<.±íÃ÷ÒÔ.Ϊ½áÊø¡£Òò´ËÎÞÐèʹÓÃ^D£¬¶ø¸ÄÓÃ.
> this is the text of
> our message.
> .
#ÕâÀï±íʾ½áÊø¡£ÔòmsgfileÖÐÔö¼ÓÁËÁ½ÐÐthis is…ºÍour message.
MACHINE="i586"
OS="linux-gnu"
CC="gcc"
cat > $file <
Machine: $MACHINE
OS: $OS
Compiler: $CC
EOF
²é¿´£ºcat $file£¬ÕâÀï¸ø³öÕý³£½á¹¹
Machine: i586
OS: linux-gnu
Ïà¹ØÎĵµ£º
Ò»¡¢°²×°jdk
# chmod u+x ./jdk-1_5_0_14-linux-i586-rpm.bin
# ./jdk-1_5_0_14-linux-i586-rpm.bin
¶þ¡¢°²×°tomcat
tar zxvf apache-tomcat-5.5.25.tar.gz
Èý¡¢½¨Óû§ºÍȨÏÞ
# useradd tomcat
# passwd tomcat
# chown -R tomcat:tomcat&n ......
Ç°ÑÔ
ÄÚ´æ¹ÜÀíÒ»ÏòÊÇËùÓвÙ×÷ϵͳÊé¼®²»Ï§±ÊÄ«ÖصãÌÖÂÛµÄÄÚÈÝ£¬ÎÞÂÛÊÐÃæÉÏ»òÊÇÍøÉ϶¼³ä³â×Å´óÁ¿Éæ¼°ÄÚ´æ¹ÜÀíµÄ½Ì²ÄºÍ×ÊÁÏ¡£Òò´ËÎÒÃÇÕâÀïËùҪдµÄLinuxÄÚ´æ¹ÜÀí²ÉÈ¡±ØÖؾÍÇáµÄ²ßÂÔ£¬´ÓÀíÂÛ²ãÃæ¾Í²»È¥°åÃÅŪ¸«£¬êÝЦ´ó·½ÁË¡£ÎÒÃÇ×îÏë×öµÄºÍ¿ÉÄÜ×öµ½µÄÊÇÒÔ¿ª·¢ÕߵĽǶÈ̸̸¶ÔÄÚ´æ¹ÜÀíµÄÀí½â£¬×îÖÕÄ¿µÄÊÇ°ÑÎÒÃÇÔÚÄں˿ª·¢ÖÐÊ¹Ó ......
linuxĿ¼¼Ü¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî
binary file µÄÄ¿錄
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ
(kernel) ÔÚÄÚ
/boot/grub/menu.lst GRUBÉèÖÃ
/boot/vmlinuz ÄÚºË
......
1¡¢cscope
2¡¢diffstat
3¡¢git-core
4¡¢git-email
5¡¢gitk
6¡¢indent
7¡¢kernel-docs
8¡¢kernel-source
9¡¢kernel-syms
10¡¢patchutils
11¡¢patterns-opensuse-devel_kernel
12¡¢quit
ÓпյĻ°ÖðÒ»Á˽âһϣ¬Ã²ËÆͦÓÐÓõġ£ ......
/etc/profile:´ËÎļþΪϵͳµÄÿ¸öÓû§ÉèÖû·¾³ÐÅÏ¢,µ±Óû§µÚÒ»´ÎµÇ¼ʱ,¸ÃÎļþ±»Ö´ÐÐ.
²¢´Ó/etc/profile.dĿ¼µÄÅäÖÃÎļþÖÐËѼ¯shellµÄÉèÖÃ.
/etc/bashrc:Ϊÿһ¸öÔËÐÐbash shellµÄÓû§Ö´ÐдËÎļþ.µ±bash shell±»´ò¿ªÊ±,¸ÃÎļþ±»¶ÁÈ¡.
~/.bash_profile:ÿ¸öÓû§¶¼¿ÉʹÓøÃÎļþÊäÈëרÓÃÓÚ×Ô¼ºÊ¹ÓõÄshellÐÅÏ¢,µ±Óû§µÇÂ¼Ê ......