Today I’m going to introduce you to the exciting world of lsof.
As you will see, it’s a nifty little tool that has various uses, and it has so many switches that you need both a – and a + to use all the options available! As the description of the command says in its man-page:
lsof – list open files
So, let’s get started.
List network connections
$ lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ssh 868 jorge 3u IPv4 12710 0t0 TCP j-laptop.fbarr.lan:55908->login.redpill-linpro.com:ssh (ESTABLISHED)
chrome 967 jorge 114u IPv4 372589 0t0 TCP j-laptop.fbarr.lan:44756->edge-star-ecmp-04-ams2.facebook.com:https (ESTABLISHED)