Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to view ports in linux

Shulou Source: shulou.com Published: 2022-06-02 21:54:26 10月04日 Update

This article shows you the way to view the linux port, the code is concise and easy to understand, it 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: indicate display TCP port-u: indicate display UDP port-l: display only listening sockets (the so-called socket is the program that enables the application to read, write, send and receive communication protocols (protocol) and data)-p: display process identifiers and program names, 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 80 ports 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 3306netstat-an look at the network port lsof-I: port. Using lsof-I: port, you can see the programs running on the specified port, as well as the current connection.

Nmap port scan

Netstat-nupl (UDP type port) netstat-ntpl (TCP type port) netstat-anp shows the usage of the system port. The above is the way to view the linux port. 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.

Tags: Ports services programs situations sockets that is skills methods servers knowledge types processes concise concise code content parameters and at the same time names commands Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple Linux macOS OPPO Reno