Install nethogs. It’s somewhat like top or nettop.

sudo apt-get install nethogs

To run

sudo nethogs

Keyboard shortcuts while you are in the nethogs interface.

m : Cycle between display modes (kb/s, kb, b, mb) r : Sort by received. s : Sort by sent. q : Quit and return to the shell prompt.

Command line options:

-d     delay for refresh rate. -h     display available commands usage. -p     sniff in promiscious mode (not recommended). -t     tracemode. -V     prints Version info.

For osx, you can use the built-in Activity Monitor and head over to the Network tab.

ref: http://www.cyberciti.biz/faq/linux-find-out-what-process-is-using-bandwidth/