How to Monitor Network Traffic on Mac Terminal


Below are some built-in commands that you can make use of on the Mac Terminal to monitor the network traffic.

netstat Command

Make use of the netstat command to display network statistics and all the active network connections.

 % netstat -i
Name       Mtu   Network       Address            Ipkts Ierrs    Opkts Oerrs  Coll
lo0        16384 <Link#1>                          3994     0     3994     0     0
lo0        16384 127           localhost           3994     -     3994     -     -
lo0        16384 localhost   ::1                   3994     -     3994     -     -
lo0        16384 c2cs-macboo fe80:1::1             3994     -     3994     -     -
gif0*      1280  <Link#2>                             0     0        0     0     0
stf0*      1280  <Link#3>                             0     0        0     0     0
anpi1      1500  <Link#4>    9e:00:90:d3:c2:cc        0     0        0     0     0
anpi0      1500  <Link#5>    9e:00:90:d3:c2:cb        0     0        0     0     0
en3        1500  <Link#6>    9e:00:90:d3:c2:ab        0     0        0     0     0
en4        1500  <Link#7>    9e:00:90:d3:c2:ac        0     0        0     0     0
en1        1500  <Link#8>    36:5f:76:30:f6:80        0     0        0     0     0
en2        1500  <Link#9>    36:5f:76:30:f6:84        0     0        0     0     0
ap1*       1500  <Link#10>   3a:3e:ef:d8:68:7c        0     0        0     0     0
en0        1500  <Link#11>   18:3e:ef:d8:68:7c   675074     0   338171     0     0
en0        1500  c2cs-macboo fe80:b::d1:abdc:8   675074     -   338171     -     -
en0        1500  192.168.0     192.168.0.105     675074     -   338171     -     -
awdl0      1500  <Link#12>   a6:fa:d5:9d:42:03        0     0       10     0     0
awdl0      1500  fe80::a4fa: fe80:c::a4fa:d5ff        0     -       10     -     -
llw0       1500  <Link#13>   a6:fa:d5:9d:42:03        0     0        0     0     0
llw0       1500  fe80::a4fa: fe80:d::a4fa:d5ff        0     -        0     -     -
bridge0    1500  <Link#14>   36:5f:76:30:f6:80        0     0        0     0     0
utun0      1500  <Link#15>                            0     0        1     0     0
utun0      1500  c2cs-macboo fe80:f::a941:6a66        0     -        1     -     -
utun1      1380  <Link#16>                            0     0        3     0     0
utun1      1380  c2cs-macboo fe80:10::e415:752        0     -        3     -     -
utun2      2000  <Link#17>                            0     0        4     0     0
utun2      2000  c2cs-macboo fe80:11::f908:bf5        0     -        4     -     -
utun3      1000  <Link#18>                            0     0        3     0     0
utun3      1000  c2cs-macboo fe80:12::ce81:b1c        0     -        3     -     -
utun4      1350  <Link#19>                            0     0        4     0     0
utun4      1350  c2cs-macboo fe80:13::b194:e5e        0     -        4     -     -
utun5      1380  <Link#20>                            0     0        4     0     0
utun5      1380  c2cs-macboo fe80:14::5e27:fa3        0     -        4     -     -
Mac Terminal Network Traffic Monitoring

tcpdump Command

Get the dump of your network using the tcpdump packet analyzer command. Note, that you will need administrative privileges to run this command.

sudo tcpdump -i en0

If you want to monitor network traffic in real-time on the Terminal you can make use of the console-based network bandwidth monitoring tool called iftop. You will need to get it installed using Homebrew.

brew install iftop

You will need administrative privileges to run this command.

sudo iftop 

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap