linuxÔõôÉó²é¶Ë¿ÚÊÇ·ñ±»Õ¼ÓÃ
linuxϵͳÉϼì²é¶Ë¿ÚÕ¼ÓÃÇéÐΣºÊ¹Óà netstat ÏÂÁnetstat -tnlp | grep ʹÓÃÆäËû¹¤¾ß£ºlsoffuserss
ÔõÑù¼ì²é Linux ÉϵĶ˿ÚÕ¼ÓÃÇéÐÎ
ÔÚ Linux ϵͳÉÏ£¬Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´¼ì²éÌض¨¶Ë¿ÚÊÇ·ñ±»Õ¼Óãº
netstat -tnlp | grep <port_number></port_number>
µÇ¼ºó¸´ÖÆ
ÆäÖУº
ÊÇÄúÒª¼ì²éµÄ¶Ë¿ÚºÅ¡£
-t Ñ¡ÏîÏÔʾ TCP ÅþÁ¬¡£
-n Ñ¡ÏîÏÔʾÊý×ֵصã¶ø²»ÊÇÖ÷»úÃû¡£
-l Ñ¡ÏîÏÔʾ¼àÌýÌ×½Ó×Ö¡£
-p Ñ¡ÏîÏÔʾÀú³ÌÐÅÏ¢¡£
ÈôÊÇÏÂÁîÊä³öÀàËÆÒÔÏÂÄÚÈÝ£¬Ôò¶Ë¿ÚÕýÔÚ±»Ê¹Óãº
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1234/myapp
µÇ¼ºó¸´ÖÆ
ÕâÌåÏÖ 8080 ¶Ë¿ÚÕýÔÚ±»Àú³Ì 1234 ¼àÌý£¬¸ÃÀú³ÌÃûΪ “myapp”¡£
ÆäËûÒªÁ죺
Äú»¹¿ÉÒÔʹÓÃÒÔϹ¤¾ß¼ì²é¶Ë¿ÚÕ¼ÓÃÇéÐΣº
lsof£ºlsof -i tcp:
fuser£ºfuser -n tcp
ss£ºss -tulpn | grep
ÒÔÉϾÍÊÇlinuxÔõôÉó²é¶Ë¿ÚÊÇ·ñ±»Õ¼ÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£