I'm trying to understand which ports are actively listening (in use?) on my machine and don't really know what I'm doing. The three commands I've experimented with are nmap, ss (?netscan?) and lsof.
netscan reports that only 1 port is actively listening (631):
$ sudo nmap -sT localhost Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-02 21:28 EDT Nmap scan report for localhost (127.0.0.1) Host is up (0.000094s latency). Not shown: 999 closed ports PORT STATE SERVICE 631/tcp open ipp ss (?netscan?) reports 2 ports are in use (631 & 53):
$ sudo ss -tulwn | grep LISTEN tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* tcp LISTEN 0 5 127.0.0.1:631 0.0.0.0:* tcp LISTEN 0 5 [::1]:631 [::]:* Finally, if I check individual ports with lsof -i:xx, I see results for 631 & 53, but also for ports 80 & 443:
$ sudo lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME firefox 3481 me 74u IPv4 85172 0t0 TCP Machine:56024->lga25s63-in-f3.1e100.net:http (ESTABLISHED) $ sudo lsof -i:443 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME skypeforl 2426 me 27u IPv4 77133 0t0 TCP Machine:60396->13.83.65.43:https (ESTABLISHED) skypeforl 2453 me 72u IPv4 56536 0t0 TCP Machine:58945->40.86.187.166:https (ESTABLISHED) firefox 3481 me 95u IPv4 81375 0t0 TCP Machine:53788->104.16.249.249:https (ESTABLISHED) firefox 3481 me 157u IPv4 80283 0t0 TCP Machine:49080->lga34s15-in-f5.1e100.net:https (ESTABLISHED) chrome-gn 3799 me 74u IPv4 55080 0t0 TCP Machine:42196->server-52-85-61-100.ewr53.r.cloudfront.net:https (CLOSE_WAIT) chrome-gn 3799 me 95u IPv4 55072 0t0 TCP Machine:43998->104.16.248.249:https (CLOSE_WAIT) I had thought these three commands were basically different views of the same information. Why are some ports only revealed by some of these commands?