xxxxxxxxxx
$ sudo lsof -n -i :80 | grep LISTEN
nginx 125004 nginx 3u IPv4 6645 0t0 TCP 0.0.0.0:80 (LISTEN)
xxxxxxxxxx
# Linux
ss -ltn
# windows
netstat -a -p -n tcp | findstr LISTENING
# SOURCE
https://solace.community/discussion/26/how-to-find-a-free-tcp-port-for-testing-pubsub-with-docker
xxxxxxxxxx
$ sudo ss -lptn 'sport = :80'
State Local Address:Port Peer Address:Port
LISTEN 127.0.0.1:80 *:* users:(("nginx",pid=125004,fd=12))
LISTEN ::1:80 :::* users:(("nginx",pid=125004,fd=11))
xxxxxxxxxx
$ sudo netstat -nlp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/nginx
xxxxxxxxxx
sudo firewall-cmd --add-port=4000/tcp --permanent
sudo firewall-cmd --reload