See which processes are using the Internet

By Rob Griffiths, Macworld |  Internet, Mac OS 1 comment

If you've ever wondered about which programs are using your Internet connection at any point in time, here's one way to find out using Terminal. Open Terminal, in Applications -> Utilities, and run this command:

lsof -P -i -n | cut -f 1 -d " " | uniq

When you press return, you'll see a list of processes that are using the Internet connection; at the time I wrote this, my output looked like this:

$ lsof -P -i -n | cut -f 1 -d " " | uniq

COMMAND

AppleVNCS

PTHPasteb

SystemUIS

aosnotify

iTunes

GrowlHelp

Transmit

iChatAgen

firefox-b

VPNClient

Mail

The first row, COMMAND, is just the column header. Below that are the processes that are using the Internet connection. Most of the time, they are self-explanatory, or can be figured out with relative ease. On my list, most of the entries are pretty clear, but perhaps not aosnotify. A bit of work with Google, though, determines that that process is related to MobileMe syncing.

If you just want to use this command, you know all you need to know now. If you're curious how it works, though, then keep reading.

While the command may look complex, it's actually three relatively simple commands strung together with the pipe (|) symbol. The first one, lsof -P -i -n, runs lsof to list open files, with options set to focus only on those connections using the Internet connection (-i), and to not try to convert port and host numbers into names (-P and -n).

The output from this command is then sent to cut, which cuts out everything except the first field (-f 1), based on using spaces to delimit fields (-d " "). Finally, that output is sent to uniq, which strips out duplicate entries from the list--without this last bit, you'd see a lot of repetition in the list, because every open app will have multiple open files.

And that's all there is to it; thanks to commandlinefu.com for posting this useful tidbit.

1 comment

    Anonymous 1 year ago
    Well, I tried this command on Linux and it works perfectly. Showing current three processes. However in my opinion there should be such a command for Windows as well...I am not aware if any such command is there or not but if it's there it would help Windows users immensely because those are ones affected by viruses a lot so they can see what are the processes eating up their Internet power and whether they're viruses or what. But anyways thanks for providing this command. I will copy it somewhere because it's a command I won't be able to remember hehe.RegardsGregPalos Verdes real estate

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      InternetWhite Papers & Webcasts

      White Paper

      Smarter Commerce is redefining value chain visibility

      Smarter Commerce is redefining the value chain in the age of the customer. It starts with putting the customer at the center of your operations - which of itself is not a new idea - however, truly operationalizing this strategy is not easy.

      White Paper

      IBM Synchronizes its Commerce 2.0 Strategy with 'Smarter Commerce' Initiative

      On March 14, IBM announced "Smarter Commerce", a strategic initiative that addresses the surging market for Commerce 2.0 solutions that take advantage of the convergence of a number of disruptive software and hardware technologies.

      See more White Papers | Webcasts

      Ask a question

      Ask a Question