Find process listening on a port

In the old days, I used netstat -nlp | grep -w <port>. These days (2022), ss the preferred tool to use:

$ ss -lptn | grep -w 8080
LISTEN        0             4096                                   *:8080                             *:*            users:(("java",pid=205361,fd=327))

With ss, we can even do without the grep by asking for the source port directly::

$ ss -lptn 'sport = :8080'
State       Recv-Q      Send-Q           Local Address:Port             Peer Address:Port      Process
LISTEN      0           4096                         *:8080                        *:*          users:(("java",pid=205361,fd=327))

~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert