ÏÈÈÝLinuxÖÐPSÏÂÁîµÄÓ÷¨
ÎÊÌ⣺ÉîÈëÏàʶLinux PSÏÂÁ¹¦Ð§ÏÈÈÝÓë´úÂëʾÀý
ÔÚLinux²Ù×÷ϵͳÖУ¬PSÏÂÁîÊÇÒ»¸öºÜÊÇÊÊÓõŤ¾ß£¬¿ÉÒÔ×ÊÖúÓû§Éó²éϵͳÖÐÔËÐеÄÀú³ÌÐÅÏ¢£¬¼à¿ØϵͳµÄÔËÐÐÇéÐΡ£±¾ÎĽ«ÏÈÈÝPSÏÂÁîµÄ»ù±¾¹¦Ð§¼°³£ÓÃÑ¡Ï²¢Í¨¹ýÏêϸµÄ´úÂëʾÀýÑÝʾÔõÑùʹÓÃPSÏÂÁîÀ´Éó²éºÍÖÎÀíÀú³Ì¡£
Ò»¡¢PSÏÂÁî¼ò½é
PSÏÂÁîÊÇProcess StatusµÄËõд£¬ÓÃÓÚÏÔʾϵͳÖÐÄ¿½ñÔËÐеÄÀú³ÌÐÅÏ¢¡£Í¨¹ýPSÏÂÁÓû§¿ÉÒÔÉó²éÀú³ÌµÄPID£¨Àú³ÌID£©¡¢CPUÕ¼Óá¢ÄÚ´æÕ¼ÓõÈÐÅÏ¢£¬×ÊÖúÓû§¼à¿ØϵͳµÄÔËÐÐÇéÐΡ£
¶þ¡¢PSÏÂÁî»ù±¾Ó÷¨
ÏÔʾËùÓÐÀú³ÌÐÅÏ¢
ps -ef
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÕâÌõÏÂÁÁгöϵͳÖÐËùÓÐÀú³ÌµÄÏêϸÐÅÏ¢£¬°üÀ¨Àú³ÌµÄÓû§¡¢PID¡¢CPUÕ¼Óõȡ£
ÏÔʾָ¶¨Óû§µÄÀú³ÌÐÅÏ¢
ps -u username
µÇ¼ºó¸´ÖÆ
ͨ¹ý¸ÃÏÂÁî¿ÉÒÔÉó²éÖ¸¶¨Óû§µÄÀú³ÌÐÅÏ¢£¬Ö»ÏÔʾ¸ÃÓû§µÄÀú³ÌÁÐ±í¡£
ÏÔʾָ¶¨Àú³ÌµÄÏêϸÐÅÏ¢
ps -p PID
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁî¿ÉÒÔÏÔʾÌض¨Àú³ÌµÄÏêϸÐÅÏ¢£¬ÆäÖÐPIDΪÀú³ÌµÄIDºÅ¡£
Èý¡¢PSÏÂÁî³£ÓÃÑ¡Ïî
-e£ºÏÔʾËùÓÐÀú³ÌÐÅÏ¢¡£
-f£ºÏÔʾÍêÕûµÄÀú³ÌÐÅÏ¢¡£
-u£ºÏÔʾָ¶¨Óû§µÄÀú³ÌÐÅÏ¢¡£
-p£ºÏÔʾָ¶¨Àú³ÌµÄÏêϸÐÅÏ¢¡£
-l£ºÏÔʾÏêϸÃûÌõÄÀú³ÌÐÅÏ¢¡£
-aux£ºÏÔʾËùÓÐÀú³ÌÐÅÏ¢£¬°üÀ¨Ã»ÓпØÖÆÖն˵ÄÀú³Ì¡£
ËÄ¡¢PSÏÂÁîʾÀý
ÏÔʾϵͳÖÐËùÓÐÀú³ÌÐÅÏ¢£º
ps -ef
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Êä³öЧ¹ûʾÀý£º
UID PID PPID C STIME TTY TIME CMD root 1 0 0 11:25 ? 00:00:06 /sbin/init root 2 0 0 11:25 ? 00:00:00 [kthreadd] root 3 2 0 11:25 ? 00:00:00 [ksoftirqd/0]
µÇ¼ºó¸´ÖÆ
ÏÔʾָ¶¨Óû§µÄÀú³ÌÐÅÏ¢£º
ps -u root
µÇ¼ºó¸´ÖÆ
Êä³öЧ¹ûʾÀý£º
PID TTY TIME CMD 1 ? 00:00:06 init 2 ? 00:00:00 kthreadd 3 ? 00:00:00 ksoftirqd/0
µÇ¼ºó¸´ÖÆ
Îå¡¢×ܽá
ͨ¹ýÒÔÉ϶ÔPSÏÂÁîµÄ¹¦Ð§ÏÈÈݼ°´úÂëʾÀý£¬ÎÒÃÇ¿ÉÒÔ¿´µ½PSÏÂÁî×÷Ϊһ¸öÇ¿Ê¢µÄÀú³ÌÖÎÀí¹¤¾ß£¬ÔÚLinuxϵͳÏÂÓÐ×ÅÆÕ±éµÄÓ¦Óá£Óû§¿ÉÒÔƾ֤×ÔÉíÐèÇóÑ¡Ôñ²î±ðµÄÑ¡ÏîÀ´Éó²éϵͳÖеÄÀú³ÌÐÅÏ¢£¬×ÊÖú¼à¿ØϵͳµÄÔËÐÐÇéÐΣ¬ÊµÏÖ¸üºÃµÄϵͳÖÎÀí¡£Ï£Íû±¾ÎĶÔÄúÏàʶLinuxϵÄPSÏÂÁîÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÏÈÈÝLinuxÖÐPSÏÂÁîµÄÓ÷¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡