Mac: number of bytes transmitted over interface

10,374
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.)

Share:
10,374

Related videos on Youtube

Douglas Squirrel
Author by

Douglas Squirrel

Updated on September 17, 2022

Comments

  • Douglas Squirrel
    Douglas Squirrel over 1 year

    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.

  • Douglas Squirrel
    Douglas Squirrel almost 15 years
    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
    Douglas Squirrel almost 15 years
    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.
  • nik
    nik almost 15 years
    I expected "netstat -i en0" kind of command for the first Ethernet interface.
  • trh88
    trh88 almost 15 years
    Whoops. Sorry, I thought this was for a desktop. :)
  • fixer1234
    fixer1234 over 5 years
    From user Girish: Just building on this answer, netstat -ib -I en0 would return the stats for a specific interface.