Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.7: Handy command-line network traffic utility System 10.7
Ever wonder what's using your internet connection? If you have LittleSnitch you're already there with a nice GUI, but if you're logged on to the system remotely or prefer CLI commands check out 'nettop' in OS X Lion. I noticed this when I was looking for any new network utilities in Lion. This command wasn't there in Snow Leopard or before.

I usually compile and install mtr, ntop, trafshow and other networking tools, but it's not always the safest thing to compile and install executables as root downloaded from the Internet.

Open a Terminal window, and then type nettop. You can also type:

man nettop or nettop --help for more command options.

The nice thing about this vs. other utilities is that it works as a normal user. If you put your Terminal session into fullscreen mode and have a large display (1920x1200 for me) you can see a ton of info about network connections, traffic from to, ipv4 and ipv6, tcp or udp and routing changes.

[crarko adds: As the name of the command implies, this is like top for network activity instead of CPU usage for local processes. I also checked in Snow Leopard and it wasn't included there. I think it's like 'nethogs' for Linux.]
    •    
  • Currently 3.67 / 5
  You rated: 1 / 5 (6 votes cast)
 
[29,496 views]  

10.7: Handy command-line network traffic utility | 9 comments | Create New Account
Click here to return to the '10.7: Handy command-line network traffic utility' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.7: Handy command-line network traffic utility
Authored by: tbertran on Sep 13, '11 08:59:10AM

Great stuff!
Anybody know of a similar utility that could be run to monitor traffic in/out of the Airport Extreme Base Station? Ideally, I'd like to get a detailed picture of what comes in/goes out or, at a minimum, monitor bandwidth.
I've tried WireShark (client-based and way too feature-rich for me) and also to monitor logs but there's little information about traffic in there.



[ Reply to This | # ]
10.7: Handy command-line network traffic utility
Authored by: BiL Castine on Sep 13, '11 09:54:03AM

I use NetUse Traffic Monitor (available in the Mac App Store) to monitor my Airport. It's a GUI app that monitors both incoming and outgoing bandwidth. NetUse Traffic Monitor uses SMTP to poll the Airport so you may be able to find an SMTP monitoring agent that works from the command line.



[ Reply to This | # ]
SNMP
Authored by: SeanAhern on Sep 13, '11 10:20:11AM

I think you mean SNMP, not SMTP.



[ Reply to This | # ]
SNMP
Authored by: BiL Castine on Sep 13, '11 11:51:10AM

indeed I did. thanks for catching that. (too bad i can't edit the post)



[ Reply to This | # ]
10.7: Handy command-line network traffic utility
Authored by: glusk on Nov 04, '11 04:23:03PM

I use MRTG on a machine I have that is always on and a script to update the web display every five minutes or so.

http://oss.oetiker.ch/mrtg/



[ Reply to This | # ]
10.7: Handy command-line network traffic utility
Authored by: afingal on Sep 13, '11 02:39:23PM

While it may be true that it's dangerous to download and compile stuff from the internet, it's much worse to download and run stuff that's already compiled. Having the source code open for review makes it a bit safer, even if you don't review it yourself. There is always the possibility that someone else will look at it and raise the alarm if there is a problem. So, to put that another way, if things are equal in terms of the trustworthiness of the source, then source code is safer than executable code.



[ Reply to This | # ]
10.7: Handy command-line network traffic utility
Authored by: cybermill on Sep 14, '11 12:26:21AM

not sure I get your point? are you suggesting that apple including this is a bad thing?



[ Reply to This | # ]
10.7: Handy command-line network traffic utility
Authored by: lurch99 on Sep 14, '11 09:45:07AM
Of course, if you have Mac Ports installed (http://www.macports.org/), then you could use 'iftop' # sudo port install iftop This is an industry standard (and free) network monitor

[ Reply to This | # ]
10.7: Handy command-line network traffic utility
Authored by: negritude on Sep 14, '11 08:09:09PM

"...but it's not always the safest thing to compile and install executables as root downloaded from the Internet."

More FUD BS from the Homebrew crowd.



[ Reply to This | # ]