lsof is short of "LiSt Open Files". Among other things, these open files include network files like internet sockets, UNIX domain sockets, etc.
By itself, it will list all the open internet and network files. Otherwise, it will attempt to match the provided argument, which should be an internet address specified as follows:
lsofto not convert IP addresses to hostnames. The lookup times for the hostnames can drastically affect the time it takes to run
lsof. I'm guessing this is because the
lsofservice has to reach out to the internet and check DNSs until it finds one that knows the hostname of the IP address it's checking against.
List tersely. I.e., it lists just the PIDs.
lsof -i :3000will list every open network file listening on port :3000
lsof -nti :3000will list just the PIDs listening on port :3000
lsof -n | grep LISTENwill list every listening process/open-file