Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How do Widows and Linux view and operate ports

Shulou Source: shulou.com Published: 2022-06-02 07:51:48 10月02日 Update

This article mainly explains the "Widows and Linux how to view and operate the port", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Widows and Linux how to view and operate the port" bar!

Open cmd

1.netstat-n

View all ports used on this computer

①. Proto indicates that there are two protocols: tcp and udp

②. Local Address represents the native IP, followed by the port number we use

③ .Foreign Address connects to the IP address of the outside server and the server port

④. State: indicates some specific state, such as: LAST_ACK waiting for the packet used to die

two。 Confirm the port number to be queried

Command netstat-aon | findstr 1044 (specified port number)

The last number of the query result is the pid of the current program or service.

3. Enter the command: tasklist | findstr 2612 (enter the pid queried above)

So you can view the programs running on this port.

Then query from the task manager, you can see the program

4. If we use the specified port number, two schemes

1. End the program running on this port in Task Manager, and then you can use this port number.

two。 Then enter the command in the cmd interface: taskkill / f / pid 2612 (enter the query pid), you can also kill this program

Linux

Netstat-tln # finds all occupied ports

Netstat-tln | grep 80 # find the specified occupied port

Install lsof

Yum install lsof

Through lsof, we can know which program our port belongs to.

Lsof-I: 80 # query port

Kill-9 # Kill process id multiple processes ID is separated by spaces

Thank you for your reading, the above is the content of "how to view and operate the port of Widows and Linux". After the study of this article, I believe you have a deeper understanding of how to view and operate the port of Widows and Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Port program query slogan input command learning service task content that is server process native management run two address multiple ideas Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi macOS Redmi Microsoft Apple