Find Which Process is Listening on a Port.
Sometimes I need to find out which process is listening on a specific port, usually so I can kill it.
On macOS:
sudo lsof -i -P | grep LISTEN | grep :$PORT
And on Linux:
netstat -pntl | grep $PORT
Sometimes I need to find out which process is listening on a specific port, usually so I can kill it.
On macOS:
sudo lsof -i -P | grep LISTEN | grep :$PORT
And on Linux:
netstat -pntl | grep $PORT