How to check linux port occupation


 description

Check the occupancy of a certain port in linux,

 command

netstat -apn|grep 3306

 parameter

netstat :  Used to display various network related information, such as network connection, routing table, interface status (Interface Statistics), masquerade connection
-a, --all :  show all sockets (default :  connected)
-p, --programs :  display the PID/program name of the socket
-n, --numeric :  don't resolve names
grep :  used to find qualified strings in the file

 result

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2067/docker-proxy
tcp6       0      0 :::3306                 :::*                    LISTEN      2071/docker-proxy

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.