linuxÉó²éÀú³ÌµÄÏÂÁîÊÇʲô
linux ²Ù×÷ϵͳÌṩһϵÁÐÏÂÁîÀ´Éó²éÀú³Ì£¬»®·ÖÊÇ£ºps£ºÉó²éÀú³ÌÏêϸÐÅÏ¢£¨pid¡¢Ãû³Æ¡¢ÏÂÁîÐС¢Óû§¡¢cpu/ÄÚ´æʹÓÃÂÊ£©top£º½»»¥Ê½¼àÊÓÆ÷£¬ÏÔʾÀú³ÌÔ˶¯£¨cpu/ÄÚ´æʹÓÃÂÊ¡¢Æô¶¯Ê±¼äµÈ£©pgrep£ºÍ¨¹ýÃû³ÆËÑË÷Àú³Ì£¨Êä³ö pid£©pidof£ºÍ¨¹ýÃû³ÆËÑË÷Àú³Ì£¨Êä³ö pid ÁÐ±í£©pstree£ºÒÔÊ÷ÐνṹÏÔʾÀú³ÌÌõÀí½á¹¹kill£ºÏòÀú³Ì·¢ËÍÐźţ¨Í¨³£Óë pid Ò»ÆðʹÓã©
Éó²é Linux Àú³ÌµÄÏÂÁî
Linux ²Ù×÷ϵͳÌṩÁËһϵÁÐÏÂÁîÀ´Éó²éÀú³Ì£¬ÆäÖÐ×î³£ÓõÄÈçÏ£º
1. ps ÏÂÁî
ps ÏÂÁîÊÇÉó²éÀú³ÌÐÅÏ¢µÄ±ê×¼ÏÂÁî¡£ËüÊä³öÓйØÄ¿½ñÕýÔÚÔËÐÐÀú³ÌµÄÏêϸÐÅÏ¢£¬°üÀ¨Àú³Ì ID (PID)¡¢Àú³ÌÃû³Æ¡¢ÏÂÁîÐвÎÊý¡¢Óû§¡¢CPU ʹÓÃÂʺÍÄÚ´æʹÓÃÂÊ¡£
ps aux
µÇ¼ºó¸´ÖÆ
2. top ÏÂÁî
top ÏÂÁîÊÇÒ»¸ö½»»¥Ê½Àú³Ì¼àÊÓÆ÷£¬ËüÒÔʵʱ·½·¨ÏÔʾÀú³ÌÔ˶¯¡£ËüÌṩÓйØÀú³Ì CPU ʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂÊ¡¢Æô¶¯Ê±¼äºÍÆäËûͳ¼ÆÐÅÏ¢µÄ¿ÉÅÅÐòÁÐ±í¡£
top
µÇ¼ºó¸´ÖÆ
3. pgrep ÏÂÁî
pgrep ÏÂÁîͨ¹ýÃû³ÆËÑË÷Àú³Ì¡£ËüÊä³öÖ¸¶¨Àú³ÌµÄ PID¡£
pgrep bash
µÇ¼ºó¸´ÖÆ
4. pidof ÏÂÁî
pidof ÏÂÁîÓë pgrep ÀàËÆ£¬µ«Ëüͨ¹ýÃû³ÆËÑË÷Àú³ÌµÄ PID£¬²¢ÒÔ¿Õ¸ñÍÑÀëµÄÁбíÐÎʽÊä³öЧ¹û¡£
pidof -x bash
µÇ¼ºó¸´ÖÆ
5. pstree ÏÂÁî
pstree ÏÂÁîÒÔÊ÷ÐνṹÏÔʾÀú³ÌÌõÀí½á¹¹¡£ËüչʾÁ˸¸Àú³ÌºÍ×ÓÀú³ÌÖ®¼äµÄ¹Øϵ¡£
pstree
µÇ¼ºó¸´ÖÆ
6. kill ÏÂÁî
kill ÏÂÁîÓÃÓÚÏòÀú³Ì·¢ËÍÐźš£Ëüͨ³£Óë PID Ò»ÆðʹÓá£
kill -9 PID
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇlinuxÉó²éÀú³ÌµÄÏÂÁîÊÇʲôµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡