linuxÔõô¿´Àú³Ì¶Ë¿Ú
ÔÚ linux ϵͳÖÐÉó²éÀú³Ì¶Ë¿ÚÓÐÁ½ÖÖ³£ÓÃÒªÁ죺ʹÓà netstat ÏÂÁîÉó²éÕýÔÚÔËÐÐÀú³ÌµÄ¶Ë¿Ú£¬ÁгöÍâµØµØµã¡¢Ô¶³ÌµØµã¡¢ÐÐÁÐÊý¾Ý°üÊýÄ¿¡¢ÅþÁ¬×´Ì¬¡¢Àú³Ì pid ºÍ³ÌÐòÃû³Æ¡£Ê¹Óà lsof ÏÂÁîÉó²éÒÑ·¿ªÎļþµÄÀú³Ì£¬°üÀ¨ËüÃǵÄÍøÂçÅþÁ¬£¬ÁгöÀú³ÌÃû³Æ¡¢pid¡¢¶Ë¿Ú¡¢ÅþÁ¬ÀàÐͺÍÎļþÐÎò·û¡£
Linux ÖÐÉó²éÀú³Ì¶Ë¿Ú
ÔÚ Linux ϵͳÖУ¬Éó²éÀú³Ì¶Ë¿ÚÓжàÖÖÒªÁì¡£ÒÔÏÂÊÇÆäÖÐÁ½ÖÖ×î³£ÓõÄÒªÁ죺
ÒªÁì 1£ºÊ¹Óà netstat ÏÂÁî
netstat ÏÂÁî¿ÉÓÃÓÚÏÔʾÍøÂçÅþÁ¬¡¢Â·ÓɱíºÍ½Ó¿Úͳ¼ÆÐÅÏ¢¡£ÒªÊ¹Óà netstat ÏÂÁîÉó²éÀú³Ì¶Ë¿Ú£¬ÇëÖ´ÐÐÒÔÏ°취£º
·¿ªÖն˴°¿Ú¡£
ÔËÐÐÒÔÏÂÏÂÁ
netstat -tulpn
µÇ¼ºó¸´ÖÆ
Êä³ö½«ÏÔʾËùÓÐÕýÔÚÔËÐеÄÀú³Ì¼°Æä¶Ë¿Ú¡£
½â¶ÁЧ¹û£º
ÁÐÎÊÌâÖÐµÄ “LAdd” ºÍ “FAdd” »®·ÖÌåÏÖÍâµØµØµãºÍÔ¶³ÌµØµã¡£
“Recv-Q” ºÍ “Send-Q” ÁÐÏÔʾÀú³ÌÕýÔÚÎüÊպͷ¢Ë͵ÄÅŶÓÊý¾Ý°üÊýÄ¿¡£
“State” ÁÐÏÔʾÀú³ÌµÄÅþÁ¬×´Ì¬£¬ÀýÈç “LISTEN”£¨ÕìÌý£©»ò “ESTABLISHED”£¨Òѽ¨É裩¡£
“PID/Program name” ÁÐÏÔʾÀú³ÌµÄ PID ºÍ³ÌÐòÃû³Æ¡£
ÒªÁì 2£ºÊ¹Óà lsof ÏÂÁî
lsof ÏÂÁî¿ÉÒÔÁгöÒÑ·¿ªµÄÎļþºÍÀú³Ì£¬°üÀ¨ËüÃǵÄÍøÂçÅþÁ¬¡£ÒªÊ¹Óà lsof ÏÂÁîÉó²éÀú³Ì¶Ë¿Ú£¬ÇëÖ´ÐÐÒÔÏ°취£º
·¿ªÖն˴°¿Ú¡£
ÔËÐÐÒÔÏÂÏÂÁ
lsof -i -P
µÇ¼ºó¸´ÖÆ
Êä³ö½«ÏÔʾËùÓÐÕýÔÚÔËÐеÄÀú³Ì¼°Æä¶Ë¿Ú¡£
½â¶ÁЧ¹û£º
“COMMAND” ÁÐÏÔʾÀú³ÌµÄÃû³Æ¡£
“PID” ÁÐÏÔʾÀú³ÌµÄ PID¡£
“Internet address” ÁÐÏÔʾÀú³ÌÕýÔÚʹÓõĶ˿ڡ£
“TYPE” ÁÐÏÔʾÅþÁ¬ÀàÐÍ£¬ÀýÈç “TCP” »ò “UDP”¡£
“FD” ÁÐÏÔʾÎļþÐÎò·û£¬¿ÉÓÃÓÚ½øÒ»²½±êʶÅþÁ¬¡£
ÒÔÉϾÍÊÇlinuxÔõô¿´Àú³Ì¶Ë¿ÚµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡