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 lsof -n -i :80 | grep LISTEN
nginx 125004 nginx 3u IPv4 6645 0t0 TCP 0.0.0.0:80 (LISTEN)
xxxxxxxxxx
# To check the listening ports and applications on Linux
# Use any of the following command on terminal
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo lsof -i:80 # see a specific port such as 80
@Oceangreen Technology - We Work For Excellence
xxxxxxxxxx
$ sudo netstat -nlp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/nginx