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 to use the netstat command to view network ports in Linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article shows you how to use the netstat command to view the network port in Linux. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The parameters of the netstat command are described as follows:

-t: indicates that the TCP port is displayed

-u: indicates that the UDP port is displayed

-l: display only listening sockets (sockets are programs that enable applications to read, write and send and receive protocol and data)

-p: displays the process identifier and program name, and each socket / port belongs to a program.

-n: show IP without DNS polling (operation can be accelerated)

All ports and process services on the current server can be displayed. Combined with grep, you can view a specific port and service.

Netstat-ntlp / / View all current tcp ports

Netstat-ntulp | grep 80 / / View the usage of all ports 80

Netstat-an | grep 3306 / / View the usage of all 3306 ports

Check which services and ports are on a server

Netstat-lanp

Check how many ports a service has. For example, to check mysqld

Ps-ef | grep mysqld

Check the number of connections to a port, such as port 3306

Netstat-pnt | grep: 3306 | wc

Check the connection client IP of a port, such as port 3306.

Netstat-anp | grep 3306

Netstat-an View Network Port

Lsof-I: port, using lsof-I: port, you can see the program running on the specified port, as well as the current connection.

Nmap port scan

Netstat-nupl (port of type UDP)

Netstat-ntpl (port of type TCP)

Netstat-anp displays system port usage

The above is how to use the netstat command to view network ports in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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

Internet Technology

Wechat

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

12
Report