Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Find Which Process is Listening on a Port

Bits Networking SysAdmin #macos #linux #netstat #lsof #devops #terminal

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