×ðÁú¿­Ê±

ÄãÕæµÄ»áµ÷ÊÔ Linux Äں˹ÊÕÏÂ𠣬¿´ÍêÕâһƪºóÄã»áéÈû¶Ù¿ªµÄ£¡

LinuxÄÚºËÊDzÙ×÷ϵͳµÄ½¹µã £¬Ëü¿ØÖƶÔϵͳ×ÊÔ´£¨ÀýÈ磺CPU¡¢I/O×°±¸¡¢ÎïÀíÄÚ´æºÍÎļþϵͳ£©µÄ»á¼û¡£ÔÚÖ¸µ¼Àú³ÌÖÐÒÔ¼°ÏµÍ³ÔËÐÐʱ £¬Äں˻ὫÖÖÖÖÐÂÎÅдÈëÄں˻·Ðλº³åÇø¡£ÕâЩÐÂÎÅ°üÀ¨ÓйØϵͳ²Ù×÷µÄÖÖÖÖÐÅÏ¢¡£

Äں˻·Ðλº³åÇøÊÇÎïÀíÄÚ´æµÄÒ»²¿·Ö £¬ÓÃÓÚÉúÑÄÄں˵ÄÈÕÖ¾ÐÂÎÅ¡£Ëü¾ßÓÐÀο¿µÄ¾Þϸ £¬ÕâÒâζ×ÅÒ»µ©»º³åÇøÒÑÂú £¬½Ï¾ÉµÄÈÕÖ¾¼Í¼½«±»ÁýÕÖ¡£

dmesgÏÂÁîÐÐÊÊÓóÌÐòÓÃÓÚÔÚLinuxºÍÆäËûÀàËÆUnixµÄ²Ù×÷ϵͳÖдòÓ¡ºÍ¿ØÖÆÄں˻·Ðλº³åÇø¡£¹ØÓÚ¼ì²éÄÚºËÆô¶¯ÐÂÎź͵÷ÊÔÓëÓ²¼þÏà¹ØµÄÎÊÌâºÜÓÐÓá£

ÔÚ±¾½Ì³ÌÖÐ £¬ÎÒÃǽ«ÏÈÈÝdmesgÏÂÁîµÄ»ù´¡¡£

ʹÓà dmesg ÏÂÁî

dmesgÏÂÁîµÄÓï·¨ÈçÏ£º

dmesg [OPTIONS]
ÔÚ²»´øÈκÎÑ¡ÏîµÄÇéÐÎÏÂŲÓÃʱ£¬dmesg½«ËùÓÐÐÂÎÅ´ÓÄں˻·Ðλº³åÇøдÈë±ê×¼Êä³ö£º

µÇ¼ºó¸´ÖÆ

$ dmesg

ĬÈÏÇéÐÎÏ £¬ËùÓÐÓû§¶¼¿ÉÒÔÔËÐÐdmesgÏÂÁî¡£¿ÉÊÇ £¬ÔÚijЩϵͳÉÏ £¬·Ç root Óû§¿ÉÄÜ»áÏÞÖƶÔdmesgµÄ»á¼û¡£ÔÚÕâÖÖÇéÐÎÏ £¬Å²Óà dmesg ʱÄú½«ÊÕµ½ÈçϹýʧÐÂÎÅ£º

dmesg: readkernel buffer failed: Operation not permitted

Äں˲ÎÊýkernel.dmesg_restrictÖ¸¶¨·ÇÌØȨÓû§ÊÇ·ñ¿ÉÒÔʹÓÃdmesgÉó²éÀ´×ÔÄÚºËÈÕÖ¾»º³åÇøµÄÐÂÎÅ¡£ÒªÉ¾³ýÏÞÖÆ £¬Ç뽫ÆäÉèÖÃΪÁ㣺

$ sudo sysctl -w kernel.dmesg_restrict=0

ͨ³£ £¬Êä³ö°üÀ¨Ðí¶àÐÅÏ¢ÐÐ £¬Òò´ËÖ»ÄÜ¿´µ½Êä³öµÄ×îºóÒ»²¿·Ö¡£ÒªÒ»´ÎÉó²éÒ»Ò³ £¬Ç뽫Êä³öͨ¹ý¹ÜµÀ´«Ë͵½·ÖÒ³ÊÊÓóÌÐò £¬ÀýÈçless»òmore£º

$ dmesg –color=always | less

ÆäÖеĖcolor=always²ÎÊýÓÃÓÚ±£´æ²ÊÉ«Êä³ö¡£

ÈôÊÇÒª¹ýÂË»º³åÇøÐÂÎÅ £¬¿ÉÄÜʹÓÃgrep¡£ÀýÈç £¬Òª½öÉó²éÓë USB Ïà¹ØµÄÐÂÎÅ £¬Çë¼üÈ룺

$ dmesg | grep -i usb

dmesg ´Ó/proc/kmsgÐéÄâÎļþÖжÁÈ¡ÄÚºËÌìÉúµÄÐÂÎÅ¡£¸ÃÎļþÌṩÁ˵½Äں˻·Ðλº³åÇøµÄ½Ó¿Ú £¬²¢ÇÒÖ»ÄÜÓÉÒ»¸öÀú³Ì·­¿ª¡£ÈôÊÇϵͳÉÏÕýÔÚÔËÐÐsyslogÀú³Ì £¬²¢ÇÒÄãʵÑéʹÓÃcat»òlessÏÂÁî¶ÁÈ¡Îļþ £¬ÔòÏÂÁ¹ÒÆð¡£

syslogÊØ»¤³ÌÐò½«ÄÚºËÐÂÎÅת´¢µ½/var/log/dmesg £¬Òò´ËÄãÒ²¿ÉÒÔʹÓøÃÈÕÖ¾Îļþ£º

$ cat /var/log/dmesg

ÃûÌû¯ dmesg Êä³ö¡£

dmesgÏÂÁîÌṩÁËÐí¶àÑ¡Ïî £¬¿É×ÊÖúÄãÃûÌû¯ºÍ¹ýÂËÊä³ö¡£

dmesgÖÐ×î³£ÓõÄÑ¡ÏîÖ®Ò»ÊÇ-H£¨–human£© £¬Ëü½«Êä³ö¸üÈÝÒ׶ÁµÄЧ¹û¡£

$ dmesg -H

Òª´òÓ¡ÈËÀà¿É¶ÁµÄʱ¼ä´Á £¬ÇëʹÓÃ-T£¨–ctimeÑ¡Ï£º

$ dmesg -T
[Mon Oct 14 14:38:04 2019] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0: link becomes ready

µÇ¼ºó¸´ÖÆ

ʱ¼ä´ÁÃûÌÃÒ²¿ÉÒÔʹÓÖtime-format Ñ¡ÏîÉèÖà £¬¿ÉÒÔÊÇctime £¬reltime £¬delta £¬notime»òiso¡£ÀýÈ磺ҪʹÓÃÔöÁ¿ÃûÌà £¬Äã¿ÉÒÔÊäÈ룺

$ dmesg –time-format=delta

ÄãÒ²¿ÉÒÔ×éºÏÁ½¸ö»ò¶à¸öÑ¡Ï

$ dmesg -H -T

ҪʵʱԢĿdmesgÏÂÁîµÄÊä³ö £¬ÇëʹÓÃ-w£¨–follow£©Ñ¡Ï

$ dmesg –follow

¹ýÂË dmesg Êä³ö¡£

Äã¿ÉÒÔ½«dmesgÊä³öÏÞÖÆΪ¸ø¶¨µÄÉèÊ©ºÍÆ·¼¶¡£dmesgÖ§³ÖÒÔÏÂÀàÐÍ£º

kern-ÄÚºËÐÂÎÅ

user-Óû§¼¶ÐÂÎÅ

mail-Óʼþϵͳ

daemon-ϵͳÊØ»¤³ÌÐò

auth-Çå¾²/ÊÚȨÐÂÎÅ

syslog-ÄÚ²¿ syslogd ÐÂÎÅ

lpr-ÐÐʽ´òÓ¡»ú×Óϵͳ

news-ÍøÂçÐÂÎÅ×Óϵͳ

-f£¨–facility £©Ñ¡ÏîÔÊÐíÄ㽫Êä³öÏÞÖÆΪÌض¨µÄ×°±¸ £¬¸ÃÑ¡Ïî½ÓÊÜÒ»¸ö»ò¶à¸ö¶ººÅÍÑÀëµÄ¹¦Ð§¡£

ÀýÈç £¬Òª½öÏÔʾÄں˺ÍϵͳÊØ»¤³ÌÐòÐÂÎÅ £¬¿ÉÒÔʹÓãº

$ dmesg -f kern,daemon

ÿÌõÈÕÖ¾ÐÂÎŶ¼ÓëÒ»¸öÏÔʾÐÂÎÅÖ÷ÒªÐÔµÄÈÕÖ¾¼¶±ðÏà¹ØÁª £¬dmesgÖ§³ÖÒÔÏÂÈÕÖ¾¼¶±ð£º

emerg-ϵͳÎÞ·¨Ê¹ÓÃ

alert-±ØÐèÁ¬Ã¦½ÓÄɲ½·¥

crit-½ôÆÈÇéÐÎ

err-¹ýʧÌõ¼þ

warn-ÖÒÑÔÌõ¼þ

notice-Õý³£µ«Ö÷ÒªµÄÌõ¼þ

info-ÐÅÏ¢ÐÔ

debug-µ÷ÊÔ¼¶ÐÂÎÅ

-l£¨–level £©Ñ¡ÏîÔÊÐíÄ㽫Êä³öÏÞÖÆΪ½ç˵µÄ¼¶±ð £¬¸ÃÑ¡Ïî½ÓÊÜÒ»¸ö»ò¶à¸ö¶ººÅÍÑÀëµÄ¼¶±ð¡£ÒÔÏÂÏÂÁî½öÏÔʾ¹ýʧºÍÑÏÖØÐÂÎÅ£º

$ dmesg -l err,crit

ɨ³ý»·Ðλº³åÇø

-C£¨–clear£©Ñ¡Ïî¿ÉÈÃÄúɨ³ý»·Ðλº³åÇø£º

$ sudo dmesg -C

Ö»ÓÐroot»ò¾ßÓÐsudoÌØȨµÄÓû§²Å»ªÉ¨³ý»º³åÇø¡£

ÒªÔÚɨ³ý֮ǰ´òÓ¡»º³åÇøÄÚÈÝ £¬ÇëʹÓÃ-c£¨–read-clear£©Ñ¡Ï

$ sudo dmesg -c

ÈôÊÇÒªÔÚɨ³ýÎļþ֮ǰ½«Ä¿½ñdmesgÈÕÖ¾ÉúÑĵ½ÎļþÖÐ £¬Äã¿ÉÒÔ½«Êä³öÖض¨Ïòµ½Îļþ£º

$ dmesg > dmesg_messages

½áÂÛ

dmesgÏÂÁîÔÊÐíÄãÉó²éºÍ¿ØÖÆÄں˻·Ðλº³åÇø¡£¶ÔÄں˻òÓ²¼þÎÊÌâ¾ÙÐйÊÕÏɨ³ýʱ £¬ËüºÜÊÇÓÐÓá£

ÔÚÖÕ¶ËÖÐÊäÈëman dmesg £¬Äã¿ÉÒÔ»ñÈ¡ÓйØËùÓпÉÓÃdmesgÑ¡ÏîµÄÐÅÏ¢¡£

ÒÔÉϾÍÊÇÄãÕæµÄ»áµ÷ÊÔ Linux Äں˹ÊÕÏÂ𠣬¿´ÍêÕâһƪºóÄã»áéÈû¶Ù¿ªµÄ£¡µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿