Under OS X if you are interest to find out which process is using internet you can using the following command:
lsof -i -P -n
This command normally list all the open file on the system, but using the -i option it will list all the “internet” files.
The output will be something like:
As you can see the following useful information are available:
- Command (unix command or application name)
- PID (Process ID)
- Type (IPv4 / IPv6)
- Node (UDP / TCP)
- Name (IP address, port number, etc.)
The option I have used in the command ( -P and -n ) are used to make the lsof command run faster as it won’t make translation of IP addresses into domain name.
Feel free to play around and add some more command (pipe, uniq, etc.). And don’t forget to refer to the manual of this command to find out more details.