The command to view ports under Linux is the netstat command. You can use the netstat command to know the network status of the entire Linux system; the syntax for using this command is "netstat [-acCeFghilMnNoprstuvVwx][-A
][--ip ]", setting the "-t" parameter will display the TCP port, and setting the "-u" parameter will display the UDP port.
The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
What is the command to view the port in Linux?
The Linux netstat command is used to display network status.
Using the netstat command allows you to know the network status of the entire Linux system.
Syntax:netstat [-acCeFghilMnNoprstuvVwx][-A<Network Type>][--ip]
##Common commands for linux to view ports
netstat command parameters:
-t: Specify the TCP port to display
-u: Specify the display UDP port
-l: Only display the listening socket (the so-called socket is a program that enables the application to read, write, and send and receive communication protocols and data)
-p: Display process identifier and program name. Each socket/port belongs to a program.
-n: Do not perform DNS polling, display IP (can speed up the operation)
can display all ports and process services on the current server, in Combining grep can check a specific port and service situation··netstat -ntlp//查看当前所有tcp端口· netstat -ntulp |grep80//查看所有80端口使用情况· netstat -an | grep3306//查看所有3306端口使用情况·
netstat -lanp
ps -ef |grep mysqld
netstat -pnt |grep :3306|wc
netstat -anp |grep3306
netstat -an 查看网络端口
lsof -i :port, use lsof -i :port to see the program running on the specified port, as well as the current connection.
nmap 端口扫描 netstat -nupl (UDP类型的端口) netstat -ntpl (TCP类型的端口) netstat -anp 显示系统端口使用情况
Linux Video Tutorial"
The above is the detailed content of What is the command to view the port in Linux?. For more information, please follow other related articles on the PHP Chinese website!