Continuous performance monitoring with the netstat command

The netstat command is useful in determining the number of sent and received packets.

The following is a sample report produced by the netstat command:

# netstat -I en0 5
    input    (en0)     output           input   (Total)    output
 packets  errs  packets  errs colls  packets  errs  packets  errs colls 
 8305067     0  7784711     0     0 20731867     0 20211853     0     0
       3     0        1     0     0        7     0        5     0     0
      24     0      127     0     0       28     0      131     0     0
CTRL C

Remember that the first report from the netstat command shows cumulative activity since the last system boot. The second report shows activity for the first 5-second interval.

Other useful netstat command options are -s and -v. For details, see netstat command.