linuxÉó²éÀú³ÌÊÇÄĸö³ÌÐò
ʹÓà linux ÏÂÁîÉó²éÀú³Ì¶ÔÓ¦µÄ³ÌÐò£ºÊ¹Óà “ps” ÏÂÁps -e -o comm=£¬ÏÔʾËùÓÐÀú³ÌµÄÏÂÁîÃû³Æ¡£Ê¹Óà “/proc” Îļþϵͳ£ºcat /proc/pid/cmdline£¬ÆäÖÐ “pid” ÊÇÀú³Ì id£¬ÏÔʾÀú³ÌÏÂÁîÐвÎÊý£¨°üÀ¨³ÌÐò·¾¶£©¡£
ÔõÑùʹÓà Linux ÏÂÁîÉó²éÀú³Ì¶ÔÓ¦µÄ³ÌÐò
ÒªÁì 1£ºÊ¹Óá°ps” ÏÂÁî
“ps” ÏÂÁîÁгöÄ¿½ñϵͳÕýÔÚÔËÐеÄÀú³Ì¡£
Ñ¡Ïî “-e” ÏÔʾËùÓÐÀú³Ì¡£
Ñ¡Ïî “-o comm=”½öÏÔʾÀú³ÌÏÂÁîÃû³Æ¡£
ÏÂÁîʾÀý£º
ps -e -o comm=
µÇ¼ºó¸´ÖÆ
ÒªÁì 2£ºÊ¹Óá°/proc¡±Îļþϵͳ
“/proc” Îļþϵͳ°üÀ¨ÓйØϵͳÖÐÿ¸öÀú³ÌµÄÐÅÏ¢¡£
ÒÔÀú³Ì ID ×÷ΪĿ¼ÃûµÄĿ¼°üÀ¨¸ÃÀú³ÌµÄÏêϸÐÅÏ¢¡£
Îļþ “cmdine” ´æ´¢ÁËÀú³ÌÏÂÁîÐвÎÊý£¬°üÀ¨³ÌÐò·¾¶¡£
ÏÂÁîʾÀý£º
cat /proc/PID/cmdline
µÇ¼ºó¸´ÖÆ
ÆäÖÐ “PID” ÊÇÒªÉó²éÆä³ÌÐòµÄÀú³Ì ID¡£
ÔõÑù»ñÈ¡Àú³Ì ID
ʹÓà “ps” ÏÂÁѡÏî “-p” Ö¸¶¨Àú³Ì ID£º
ps -p PID
µÇ¼ºó¸´ÖÆ
ʹÓà “pgrep” ÏÂÁָ¶¨³ÌÐòÃû³Æ£º
pgrep program-name
µÇ¼ºó¸´ÖÆ
ʾÀý
ÒªÉó²éÀú³Ì ID Ϊ 1234 µÄÀú³Ì¶ÔÓ¦µÄ³ÌÐò£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
ÒªÁì 1£º”ps” ÏÂÁî
ps -p 1234 -o comm=
µÇ¼ºó¸´ÖÆ
ÒªÁì 2£º”/proc” Îļþϵͳ
cat /proc/1234/cmdline
µÇ¼ºó¸´ÖÆ
Õ⽫Êä³ö¸ÃÀú³ÌµÄÏÂÁîÐвÎÊý£¬ÆäÖаüÀ¨³ÌÐò·¾¶¡£
ÒÔÉϾÍÊÇlinuxÉó²éÀú³ÌÊÇÄĸö³ÌÐòµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡