web123456

Which application takes up the port in Windows Linux system?

When managing service programs, it may query which process is currently occupied by a certain port. Not only can you find the problematic process and deal with it, it can also be used to assist in checking whether a program has enabled the service and listen to the port.


@TOC

Windowssystem

Can be used on Windows systemsPowerShellCommands to query programs that occupy a certain port.

For example, we need to query who is the process occupied by port 5000, and you can enter the command in PowerShell:

Get-Process -Id (Get-NetTCPConnection -LocalPort 5000).OwningProcess

Linuxsystem

Enter a command in the terminallsofYou can query processes that occupy a certain port.

lsof -i:port number

For example, we need to query who is the process occupied by port 5000, and you can enter a command in the interrupt:

  1. walterlv@localhost:~# lsof -i:5000
  2. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
  3. dotnet_serve 731 root 3u IPv6 12890 0t0 TCP *:5000

Or use netstat to query.

netstat -tunpl | grep port number

For example:

  1. walterlv@localhost:~# netstat -tunpl | grep 35412
  2. tcp6 0 0 :::5000 :::* 731/dotnet_serve

My blog will be published on/, and CSDN will be featured from it, but once it is released, it will rarely be updated.

If you see anything you don’t understand on the blog, please feel free to communicate. I built itdotnet Vocational and Technical CollegeEveryone is welcome to join.

This work usesCreative Commons Attribution-Non-Commercial Use-Share the same way 4.0 International License AgreementMake permission. Reprinting, use, and republishing are welcome, but be sure to keep the article's signature (including links:/) shall not be used for commercial purposes. Works modified based on this article must be published under the same license. If you have any questions, pleaseContact me