ʹÓà /proc ÎļþϵͳÀ´·ÃÎÊ Linux Äں˵ÄÄÚÈÝ
Õâ¸öÐéÄâÎļþϵͳÔÚÄں˿ռäºÍÓû§¿Õ¼äÖ®¼ä´ò¿ªÁËÒ»¸öͨÐÅ´°¿Ú
ÎĵµÑ¡Ïî
´òÓ¡±¾Ò³
½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ
ÑùÀý´úÂë
¼¶±ð£º ³õ¼¶
M. Tim Jones (mtj@mtjones.com), ×ÊÉîÊ×ϯÈí¼þ¹¤³Ìʦ, Emulex
2006 Äê 4 ÔÂ 24 ÈÕ
/proc ÎļþϵͳÊÇÒ»¸öÐéÄâÎļþϵͳ£¬Í¨¹ýËü¿ÉÒÔʹÓÃÒ»ÖÖеķ½·¨ÔÚ Linux® Äں˿ռäºÍÓû§¿Õ¼äÖ®¼ä½øÐÐͨÐÅ¡£ÔÚ /proc ÎļþϵͳÖУ¬ÎÒÃÇ¿ÉÒÔ½«¶ÔÐéÄâÎļþµÄ¶Áд×÷ΪÓëÄÚºËÖÐʵÌå½øÐÐͨÐŵÄÒ»ÖÖÊֶΣ¬µ«ÊÇÓëÆÕͨÎļþ²»Í¬µÄÊÇ£¬ÕâЩÐéÄâÎļþµÄÄÚÈݶ¼ÊǶ¯Ì¬´´½¨µÄ¡£±¾ÎÄ¶Ô /proc ÐéÄâÎļþϵͳ½øÐÐÁ˽éÉÜ£¬²¢Õ¹Ê¾ÁËËüµÄÓ÷¨¡£
×î³õ¿ª·¢ /proc ÎļþϵͳÊÇΪÁËÌṩÓйØϵͳÖнø³ÌµÄÐÅÏ¢¡£µ«ÊÇÓÉÓÚÕâ¸öÎļþϵͳ·Ç³£ÓÐÓã¬Òò´ËÄÚºËÖеĺܶàÔªËØÒ²¿ªÊ¼Ê¹ÓÃËüÀ´±¨¸æÐÅÏ¢£¬»òÆôÓö¯Ì¬ÔËÐÐʱÅäÖá£
/proc Îļþϵͳ°üº¬ÁËһЩĿ¼£¨ÓÃ×÷×éÖ¯ÐÅÏ¢µÄ·½Ê½£©ºÍÐéÄâÎļþ¡£ÐéÄâÎļþ¿ÉÒÔÏòÓû§³ÊÏÖÄÚºËÖеÄһЩÐÅÏ¢£¬Ò²¿ÉÒÔÓÃ×÷Ò»ÖÖ´ÓÓû§¿Õ¼äÏòÄں˷¢ËÍÐÅÏ¢µÄÊֶΡ£Êµ¼ÊÉÏÎÒÃDz¢²»»áͬʱÐèҪʵÏÖÕâÁ½µã£¬µ«ÊDZ¾ÎĽ«ÏòÄúչʾÈçºÎÅäÖÃÕâ¸öÎļþϵͳ½øÐÐÊäÈëºÍÊä³ö¡£
¾¡¹ÜÏñ±¾ÎÄÕâÑù¶ÌСµÄһƪÎÄÕÂÎÞ·¨Ïêϸ½éÉÜ /proc µÄËùÓÐÓ÷¨£¬µ«ÊÇËüÒÀÈ»¶ÔÕâÁ½ÖÖÓ÷¨½øÐÐÁËչʾ£¬´Ó¶ø¿ÉÒÔÈÃÎÒÃÇÌå»áһϠ/proc ÊǶàôǿ´ó¡£Çåµ¥ 1 ÊÇ¶Ô /proc Öв¿·ÖÔªËؽøÐÐÒ»´Î½»»¥²éѯµÄ½á¹û¡£ËüÏÔʾµÄÊÇ /proc ÎļþϵͳµÄ¸ùĿ¼ÖеÄÄÚÈÝ¡£×¢Ò⣬ÔÚ×ó±ßÊÇһϵÁÐÊý×Ö±àºÅµÄÎļþ¡£Ã¿¸öʵ¼ÊÉ϶¼ÊÇÒ»¸öĿ¼£¬±íʾϵͳÖеÄÒ»¸ö½ø³Ì¡£ÓÉÓÚÔÚ GNU/Linux Öд´½¨µÄµÚÒ»¸ö½ø³ÌÊÇ init ½ø³Ì£¬Òò´ËËüµÄ process-id Ϊ 1¡£È»ºó¶ÔÕâ¸öĿ¼ִÐÐÒ»¸ö ls ÃüÁÕâ»áÏÔʾºÜ¶àÎļþ¡£Ã¿¸öÎļþ¶¼ÌṩÁËÓйØÕâ¸öÌØÊâ½ø³ÌµÄÏêϸÐÅÏ¢¡£ÀýÈ磬Ҫ²é¿´ init µÄ command-line ÏîµÄÄÚÈÝ£¬Ö»Ðè¶Ô cmdline ÎļþÖ´ÐÐcat ÃüÁî¡£
/proc ÖÐÁíÍâһЩÓÐȤµÄÎļþÓУºcpuinfo£¬Ëü±êʶÁË´¦ÀíÆ÷µÄÀàÐͺÍËٶȣ»pci£¬ÏÔʾÔÚ PCI ×ÜÏßÉÏÕÒµ½µÄÉ豸£»modules£¬±êʶÁ˵±Ç°¼ÓÔص½ÄÚºËÖеÄÄ£¿é¡£
Çåµ¥ 1. ¶Ô /proc µÄ½»»¥¹ý³Ì
[root@plato]# ls /proc
1 2040 2347 2874 474 fb mdstat sys
104 2061 2356 2930 9 filesystems meminfo sysrq-trigger
113 2073 2375 2933 acpi fs misc sysvipc
1375 21 2409 2934 buddyinfo ide
Ïà¹ØÎĵµ£º
ÔçÆÚµÄpingɨÃ蹤¾ßÐèÒªµÈ´ýÇ°Ò»¸ö±»Ì½²âÖ÷»ú·µ»ØijÖÖÏìÓ¦ÏûÏ¢Ö®ºó²ÅÄܼÌÐø̽²âÏÂһ̨Ö÷»úÊÇ·ñ´æÔÚ¡£
fpingÈ´ÄÜÒÔÂÖת·½Ê½²¢Ðеط¢³ö´óÁ¿µÄpingÇëÇó£»
sudo apt-get install fping
-a: ±íʾֻÔÚÊä³ö±¨¸æÀïÁгöµ±Ç°ÕýÔÚÔËÐеÄϵͳ¡£
-d:½âÎöÖ÷»úÃû¡£
-f£º¶ÁÈëÎļþ¡£
-g: ·¶Î§¡£
Àý×ÓÈçÏ£º
$cat a
192.168.1. ......
1¡¢ÒýÑÔ
ÔÚ
linuxϵͳ
Ï£¬Èç¹ûÄãÏÂÔز¢°²×°ÁËÓ¦ÓóÌÐò£¬ºÜÓпÉÄÜÔÚ¼üÈëËüµÄÃû³Æʱ³öÏÖ“
command not found
”µÄÌáʾÄÚÈÝ¡£Èç¹ûÿ´Î¶¼µ½°²×°Ä¿±êÎļþ¼ÐÄÚ£¬ÕÒµ½¿ÉÖ´ÐÐÎļþÀ´½øÐвÙ×÷¾ÍÌ«·±ËöÁË¡£ÕâÉæ¼°µ½»·¾³±äÁ¿
PATH
µÄÉèÖÃÎÊÌ⣬¶ø
PATH
µÄÉèÖÃÒ²ÊÇÔÚ
linux
϶¨ÖÆ»·¾³±äÁ¿µ ......
ѧϰlinuxϵÄc/c++±à³Ì
1£¬ÏÈÓÐlinux»·¾³
´îminGWºÍcygwin¶¼ÓеãÂé·³£¬×î×î¼òµ¥µÄ°ì·¨»¹ÊÇ×°¸öÕæÕýµÄlinux£¬ÓÃÐéÄâ»úÒ²ºÃ£¬ÔÚÍøÂçÉϵÄÁíһ̨»úÆ÷Ò²ºÃ¡£ÕâÑù²»½ö¿ì£¬¶øÇÒÄãÓÐÁËÕæÕýµÄ»·¾³¡£
2.»áC/C++ÓïÑÔ£¨¹À¼ÆÄã»áµÄ£©
3.ÈëÃŽ׶ÎÊìϤgccÃüÁîÐУ¬×î»ù±¾µÄ²ÎÊý£¬È磬-g,-W,-O,-o,-c ½¨Òé¿´man gcc(ºÜ´óÕÒÏ ......
ÕâƪÈÕÖ¾»¹ÊÇÏÈ´ÓÒ»¸öÄܹ»ÔËÐÐÆðÀ´µÄÀý×Ó³ö·¢£¬Ò»µ©ÄÜ˳ÀûµÄ¿´µ½³ÌÐòµÄ³É¹¦ÔËÐУ¬ÄÇô½ÓÏÂÀ´µÄʼþÎÒÏëÓ¦¸ÃÊÇÎÊΪʲôÁË£¿ËƺõÕâÑù¸ü¼ÓÈÝÒ×Àí½âºÍÕÆÎÕ¡£
¶ÔÓÚsocket³ÌÐòµÄ¸ÅÄîÕâÀï¾Í²»¶àдÁË£¬µ«ÎÒÏàÐÅ£¬Èç¹ûÄÜ¿´ÍêÕâÕûƪÎÄÕ£¬ÎÒÏàÐŲ»»áÔÙÓÐÕâÑùµÄÒÉÎʵġ£
ÏÂÃ潫±àдһ¸öc/s½á¹¹µÄ³ÌÐò£¬Ö÷Òª¹¦ÄÜÊÇclient½«Ïòserver·¢Ë ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
½üÈÕ£¬ÔÚLinuxCON 2009´ó»áÉÏ£¬×ÀÃæ
Linux
ÓÖ³ÉΪҵ½ç¹Ø×¢µÄ½¹µãÖ®Ò»¡£¸÷ÖÖ²»Í¬µÄÉùÒô£¬É¤ÃŶ¼ºÜ´ó¡£ÔÚÕâ·×·×ÈÂȵķÕΧÖУ¬
Linux
ÈçºÎ×ß³ö×ÀÃæÀ§¾³£¿
& ......