[OS X] List processes using internet

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:

Example of output from the lsof command

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.

man lsof

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s