Find process running on port

From LemonWiki共筆
Jump to: navigation, search

Commands[edit]

  • Win Os windows.png netstat –na | find "4444"
  • Mac Os mac.png netstat -vanp tcp | grep 4444 or lsof -i tcp:4444
  • Linux Os linux.png CentOS7 netstat –nat | find 4444 or netstat -vanp tcp | grep 4444
## windows
## After running process on windows, and then input the command: netstat –na | find "4444"
  TCP    0.0.0.0:4444           0.0.0.0:0              LISTENING
  TCP    [::]:4444              [::]:0                 LISTENING

## mac
## After running process on mac, and then input the command: netstat -vanp tcp | grep 4444
tcp46      0      0  *.4444                 *.*                    LISTEN      131072 131072  15476      0 0x0000 0x00000006
tcp4       0      0  127.0.0.1.54419        127.0.0.1.4444         TIME_WAIT   408300 146988  15476      0 0x2031 0x00000000

## mac
## After running process on mac, and then input the command: lsof -i tcp:4444
COMMAND   PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    15476 user    8u  IPv6 0x8eb77926a50f8a53      0t0  TCP *:krb524 (LISTEN)

問題排除[edit]

FIND: 參數格式不正確[edit]

問題: Win Os windows.png netstat –na | find 4444 輸入後遇到「FIND: 參數格式不正確」錯誤訊息。

解決方式: 請將 <port> 加上雙引號,例如: netstat –na | find "4444"

參考資料[edit]