Faster, Higher, Stronger
更快,更高,更强

Find Program using Specific Port and Closed It

Assume that you now want to use port 18080 to run your new program, but you find that the port is already employed by other program. What need you do? First, find the target program using the specific port (18080, in this case), then shut the program down to free the specific port.

To find the target program using the port 18080:

lsof -i:18080

And then you will get information looking like the below one:

COMMAND PID    USER     FD   TYPE  DEVICE   SIZE/OFF  NODE  NAME
node    19802  orzzone  llu  IPv6  7394347       0t0  TCP   *:18080(LISTEN)

See the PID (19802, in the above example)? It’s what you need in the next step.

Now kill the process:

kill -9 19802

All is done. Now the port 18080 is free for further use again.

赞(0) 打赏
未经允许不得转载:峰间的云 » Find Program using Specific Port and Closed It

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏