How to check the status of occupied ports in CentOS?

In CentOS, you can use the following command to check the port usage:

  1. Network statistics
netstat -tuln

This will display all TCP and UDP ports that are currently being listened to, along with the processes they correspond to.

  1. List open files
lsof -i :<port>

Replace with the port number you want to view. This will display the processes and related information using the specified port.

  1. ss
ss -tuln

This will display all TCP and UDP ports that are currently being listened on along with the corresponding processes, similar to the netstat command.

These commands can help you view the ports in use and related processes in CentOS system.

bannerAds