Friday, May 24, 2013

How To Show What Apps and Processes Are Using An Internet Connection In Mac OS X Using Command Line

May 1, 2011 by · Leave a Comment 

Well, here’s something for our Mac OS X users! Yes, just as we have monitored the Mac OS X filesystem usage using the command line, now, we can also discover what apps are currently using your internet connection. Actually, there are two ways to perform the above. But, both will use the Command lines as I said earlier. Now, just head down to below for the commands to know what apps and processes are currently using your internet connection.

Show what apps and processes are using your internet connection using commands

The first way provides easy to read output and will print names of apps and processes that are connecting to the outside world;

First, launch the Terminal, and type the following command;

lsof -nPi | cut -f 1 -d " "| uniq | tail -n +2

The above command will provide the output as following;

SystemUIS
Dropbox
iChatAgen
Finder
iTunes
Google
ssh

Naturally, these are just the names of the apps and there’s not much more data here, nut if you are just trying to track down a rogue bandwidth hogging app it’s sometimes adequate.

But, if you want some more information along with the names of the apps, then, you can go for the second command, which is a revise of the above command so that we get more raw data out of lsof by removing the pipes to other command line utilities, leaving us with unrefined details directly from lsof. Also, you can notice that the -n flag has been cut as I want to see the host names this time around :

lsof -Pi

This command line will provide much more data, including the app name, PID, protocol, IP address, hostname and the current status of the connection, that are very useful.

But, if that information overloaded, then, try piping the command through “more” so it’s easier to read in chunks, or use grep to sort data for a specific app or process, like following;

$ lsof -Pi |grep iChatAgen
iChatAgen 228 David 10u IPv4 0x0bfe44ec 0t0 UDP 127.0.0.1:5191->bos-d25v-r2d2.blue.aol.com:5191
iChatAgen 228 David 13u IPv4 0x1e148b1e 0t0 TCP 192.168.1.29:50051->206.198.4.49:5190 (ESTABLISHED)

NOTE : lsof is a powerful utility with a countless number of uses.

Well, if you’ll have any difficulty while executing the above commands, then, don’t hesitate, just write to us in our comment section below. Also, if you are successful in performing the above, then, just don’t forget to share your views and comments on this with us.


Did not find what you were looking for? Try using our below search engine..

Loading
We will send you some more information related to How To Show What Apps and Processes Are Using An Internet Connection In Mac OS X Using Command Line
Article by Prativa Khuntia

Hello Friends ! This is Prativa, a full time writer who covers breaking Apple News and writes all the things about iPhone, iPad, iPod touch and Mac OS X exclusively for 3noobs.com. I love descriptive writing. Apart from that I have great interest on Science related topics as I was a Science student.

Prativa Khuntia has written 2680 articles for us.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!