Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Widows and Linux view and operate port methods

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces Widows and Linux how to view and operate the port method, has a certain reference value, friends in need can refer to. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

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 reading this article carefully. I hope it is helpful for everyone to share how Widows and Linux view and operate port methods. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report