Linux ½Å±¾±àд»ù´¡(¶þ)
1.1.5 ShellÃüÁîºÍÁ÷³Ì¿ØÖÆ
ÔÚshell½Å±¾ÖпÉÒÔʹÓÃÈýÀàÃüÁ
1)Unix ÃüÁî:
ËäÈ»ÔÚshell½Å±¾ÖпÉÒÔʹÓÃÈÎÒâµÄunixÃüÁµ«ÊÇ»¹ÊÇÓÉһЩÏà¶Ô¸ü³£ÓõÄÃüÁî¡£ÕâЩÃüÁîͨ³£ÊÇÓÃÀ´½øÐÐÎļþºÍÎÄ×Ö²Ù×÷µÄ¡£
³£ÓÃÃüÁîÓï·¨¼°¹¦ÄÜ
echo "some text": ½«ÎÄ×ÖÄÚÈÝ´òÓ¡ÔÚÆÁÄ»ÉÏ
ls: ÎļþÁбí
wc –l filewc -w filewc -c file: ¼ÆËãÎļþÐÐÊý¼ÆËãÎļþÖеĵ¥´ÊÊý¼ÆËãÎļþÖеÄ×Ö·ûÊý
cp sourcefile destfile: Îļþ¿½±´
mv oldname newname : ÖØÃüÃûÎļþ»òÒƶ¯Îļþ
rm file: ɾ³ýÎļþ
grep 'pattern' file: ÔÚÎļþÄÚËÑË÷×Ö·û´®±ÈÈ磺grep 'searchstring' file.txt
cut -b colnum file: Ö¸¶¨ÓûÏÔʾµÄÎļþÄÚÈÝ·¶Î§£¬²¢½«ËüÃÇÊä³öµ½±ê×¼Êä³öÉ豸±ÈÈ磺Êä³öÿÐеÚ5¸öµ½µÚ9¸ö×Ö·ûcut -b5-9 file.txtǧÍò²»ÒªºÍcatÃüÁî»ìÏý£¬
ÕâÊÇÁ½¸öÍêÈ«²»Í¬µÄÃüÁî
cat file.txt: Êä³öÎļþÄÚÈݵ½±ê×¼Êä³öÉ豸£¨ÆÁÄ»£©ÉÏ
file somefile: µÃµ½ÎļþÀàÐÍ
read var: ÌáʾÓû§ÊäÈ룬²¢½«ÊäÈ븳ֵ¸ø±äÁ¿
sort file.txt: ¶Ôfile.txtÎļþÖеÄÐнøÐÐÅÅÐò
uniq: ɾ³ýÎı¾ÎļþÖгöÏÖµÄÐÐÁбÈÈ磺 sort file.txt | uniq
expr: ½øÐÐÊýѧÔËËãExample: add 2 and 3expr 2 "+" 3
find: ËÑË÷Îļþ±ÈÈ磺¸ù¾ÝÎļþÃûËÑË÷find . -name filename -print
tee: ½«Êý¾ÝÊä³öµ½±ê×¼Êä³öÉ豸(ÆÁÄ») ºÍÎļþ±ÈÈ磺somecommand | tee outfile
basename file: ·µ»Ø²»°üº¬Â·¾¶µÄÎļþÃû±ÈÈ磺 basename /bin/tux½«·µ»Ø tux
dirname file: ·µ»ØÎļþËùÔÚ·¾¶±ÈÈ磺dirname /bin/tux½«·µ»Ø /bin
head file: ´òÓ¡Îı¾Îļþ¿ªÍ·¼¸ÐÐ
tail file : ´òÓ¡Îı¾Îļþĩβ¼¸ÐÐ
sed: SedÊÇÒ»¸ö»ù±¾µÄ²éÕÒÌæ»»³ÌÐò¡£¿ÉÒÔ´Ó±ê×¼ÊäÈ루±ÈÈçÃüÁî¹ÜµÀ£©¶ÁÈëÎı¾£¬²¢½«½á¹ûÊä³öµ½±ê×¼Êä³ö£¨ÆÁÄ»£©¡£¸ÃÃüÁî²ÉÓÃÕýÔò±í´ïʽ£¨¼û²Î¿¼£©½øÐÐËÑË÷¡£²»ÒªºÍshellÖеÄͨÅä·ûÏà»ìÏý¡£±ÈÈ磺
½«linuxfocus Ì滻Ϊ LinuxFocus £ºcat text.file | sed 's/linuxfocus/LinuxFocus/' > newtext.file
awk: awk ÓÃÀ´´ÓÎı¾ÎļþÖÐÌáÈ¡×ֶΡ£È±Ê¡µØ£¬×ֶηָî·ûÊÇ¿Õ¸ñ£¬¿ÉÒÔʹÓÃ-FÖ¸¶¨ÆäËû·Ö¸î·û¡£cat file.txt | awk -F, '{print $1 "," $3 }'ÕâÀïÎÒÃÇʹÓã¬×÷Ϊ×ֶηָî·û£¬Í¬Ê±´òÓ¡µÚÒ»¸öºÍµÚÈý¸ö×ֶΡ£Èç¹û¸ÃÎļþÄÚÈÝÈçÏ£ºAdam Bor, 34, IndiaKerry Miller, 22, USAÃüÁîÊä³ö½á¹ûΪ£ºAdam Bor, IndiaKerry Miller, USA
2) ¸ÅÄî: ¹ÜµÀ, Öض¨ÏòºÍ backtick ÕâЩ²»ÊÇϵͳÃüÁµ«ÊÇËûÃÇÕæµÄºÜÖØÒª¡£
¹ÜµÀ ( | ) ½«Ò»¸öÃü
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
LinuxµÄÍøÂçÐÒéÕ»
LinuxµÄÐÒéÕ»ÆäʵÊÇÔ´ÓÚBSDµÄÐÒéÕ»£¬ËüÏòÉÏÒÔ¼°ÏòϵĽӿÚÒÔ¼°ÐÒéÕ»±¾ÉíµÄÈí¼þ·Ö²ã×éÖ¯µÄ·Ç³£ºÃ¡£
LinuxµÄÐÒéÕ»»ùÓÚ·Ö²ãµÄÉè¼Æ˼Ï룬×ܹ²·ÖΪËIJ㣬´ÓÏÂÍùÉÏÒÀ´ÎÊÇ £ºÎïÀí²ã£¬Á´Â·²ã£¬ÍøÂç²ã£¬Ó¦Óò㡣
& ......
1.ÔÚ´æ·Å¹²ÏíÎļþµÄ·þÎñÆ÷ÉèÖù²ÏíÎļþ¼Ð,
1) ¸ü¸Ä/etc/exports Îļþ, ½«ÐèÒª¹²ÏíµÄÎļþ¼ÐÉèÖóɹ²ÏíĿ¼,rw´ú±í¿É¶Á¿Éд,sync´ú±íͬ²½µÄÒâ˼,Ç°ÃæµÄ*±íʾËùÓÐIP¶¼¿ÉÒÔ·ÃÎÊ
/tmp/update *(rw,sync)
/opt/orabackup/prd *(root_squash,rw,sync)
&n ......
Íز¨±ü³Ð²»¶Ï¿ªÍؽøÈ¡µÄ¾«Éñ£¬ÔÚ¼¼ÊõÑз¢ºÍÖ§³ÖÉϲ»¶ÏµÄͶÈëÈËÁ¦ÎïÁ¦£¬Á¦ÇóÔÚ²»¶Ï±ä»¯µÄÊг¡ÐèÇóÖУ¬´ïµ½100%µÄ¿Í»§ÂúÒâ¶È¡£ÔÚ¸Õ¸Õ̤Èë2010Ä꣬¸ù¾Ý¹ýÍùµÄÊг¡µ÷²é£¬½áºÏ¿Í»§µÄÐèÇóºÍ½¨Ò飬Íز¨ÓʼþϵͳÍƳöÁËLinux_°²ÌÚ°æ±¾£¬×÷ΪдºË͸ø¹ã´ó¿Í»§µÄµÚÒ»·ÝÀñÎï¡£
°²ÌÚ´¦ÀíÆ÷ÊÇ×î½üÊ®Äê²ÅÖð½¥·¢Õ¹ÆðÀ´µ ......