What is bound at port 53 of localhost and how to stop that service?

Solution 1:

The command lsof -i TCP:53 will give the active sessions on port 53.

The command netstat -vanp tcp | grep 53 will give information on the processes that are listening on port 53. The 9th column gives you the process ID (PID).

To get from the PID to the program name you run: ps -p <PID>. Which will give you what application is running under this PID.

You can string these command together as

netstat -vanp tcp | grep 53 | awk '{print $9}' | xargs ps -p

As for killing the process, you can always run kill -9 <PID>. But I'd recommend finding out what program is running and why. It might be back up after a reboot.

A similar question was asked at Kill TCP connections on a Mac in Terminal .