On linux, I'm used to typing ifconfig and looking for the line with "RX bytes" and "TX bytes" in it to find out how many bytes have been received and transmitted over a particular interface since boot. The line looks like this:

      RX bytes:106951129 (101.9 MB)  TX bytes:1577761831 (1.4 GB)

I tried running the same command in a terminal on a Mac (OS X, version 10.4.11) but didn't see this data anywhere. How do I get the same information from a Mac?

Edit: This is a test server, meant to simulate a typical out-of-the-box Mac install. So I need to avoid installing any programs if I can. A command-line tool would be ideal.

netstat -ib

seems to do the trick. Thanks to nik for pointing in the right direction. (Putting the result in a new answer so as not to make future readers dig through comments.)

  • From user Girish: Just building on this answer, netstat -ib -I en0 would return the stats for a specific interface. – fixer1234 Dec 9 '18 at 0:32

The easiest way I know of seeing bytes in/out over an interface (w/o command line) is with MenuMeters. You can see all that info right on the top bar so it's always visually accessible.

  • This mac is a test server so I don't want to install stuff on it if I can avoid it. I need a command-line tool if at all possible. I'll edit the question to say that. – Douglas Squirrel Sep 1 '09 at 15:41
  • Whoops. Sorry, I thought this was for a desktop. :) – osij2is Sep 1 '09 at 15:54

Try ifconfig -a.
But, I suspect there is a better command for the OSX.
It is discouraged to use the ifconfig command in OSX like its used in Linux.

check networksetup or netstat.

  • ifconfig -a doesn't have the number of bytes (or if it does, I can't find it). networksetup doesn't seem to be available, and netstat (and netstat -a) doesn't seem to have it either. – Douglas Squirrel Sep 1 '09 at 15:40
  • I expected "netstat -i en0" kind of command for the first Ethernet interface. – nik Sep 1 '09 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.