The nicstat command is top like utility for network interface card (NIC). It displays information and statistics about all your network card such as packets, kilobytes per second, average packet sizes and more. It works under Solaris and Linux operating systems.
In this post, I will explain how to install and use the nicstat command to find out stats about your NICs under Debian / Ubuntu / RHEL / CentOS Linux operating systems.
The old good netstat -i command
The -i option display a table of all network interfaces along with the following information:
# netstat -i
Sample outputs:
Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 199549124 0 0 0 153882468 0 0 0 BMRU eth1 1500 0 138357627 0 630 0 151312724 0 0 0 BMRU lo 16436 0 0 0 0 0 0 0 0 0 LRU
However, nicstat provides more information about your nic such as:
- Show TCP statistics.
- Show UDP statistics.
- Reports bytes in & out.
- Report packets in & out.
- Reports nic utilization.
- Reports nic saturation and more.
Step #1: Download and install nicstat
Type the following wget command to download the latest version of nicstat :
# wget http://nchc.dl.sourceforge.net/project/nicstat/nicstat-1.92.tar.gz
Extract tar ball
Use tar command to extract the tar ball called nicstat-1.92.tar.gz, enter:
# tar xvf nicstat-1.92.tar.gz
You will get both source code and binary files:
# cd nicstat-1.92
# ls -la
Sample outputs:
drwxr-xr-x. 2 509833 wheel 4096 Mar 10 07:43 . dr-xr-x---. 13 root root 4096 Mar 10 07:43 .. -rw-r--r--. 1 509833 wheel 4952 Oct 22 13:05 ChangeLog.txt -rwxr-xr-x. 1 509833 wheel 475 Oct 15 16:49 dladm.sh -rw-r--r--. 1 509833 wheel 1312 Oct 17 18:47 enicstat -rw-r--r--. 1 509833 wheel 8902 Oct 17 18:47 LICENSE.txt -rw-r--r--. 1 509833 wheel 1629 Sep 4 2012 Makefile.Linux -rw-r--r--. 1 509833 wheel 1596 Oct 17 19:31 Makefile.Solaris -rw-r--r--. 1 509833 wheel 9423 Oct 22 13:05 nicstat.1 -rw-r--r--. 1 509833 wheel 67376 Oct 22 13:05 nicstat.c -rwxr-xr-x. 1 509833 wheel 29645 Mar 10 07:46 .nicstat.RedHat_5_i386 -rwxr-xr-x. 1 509833 wheel 4134 Oct 15 20:38 nicstat.sh -rwxr-xr-x. 1 509833 wheel 69772 Oct 18 19:35 .nicstat.Solaris_10_i386 -rwxr-xr-x. 1 509833 wheel 74920 Oct 18 19:36 .nicstat.Solaris_10_sparc -rwxr-xr-x. 1 509833 wheel 77700 Oct 18 19:37 .nicstat.Solaris_11_i386 -rwxr-xr-x. 1 509833 wheel 83636 Oct 18 19:39 .nicstat.Solaris_11_sparc -rwxr-xr-x. 1 509833 wheel 112448 Oct 18 19:49 .nicstat.Solaris_9_i386 -rwxr-xr-x. 1 509833 wheel 127104 Oct 18 19:44 .nicstat.Solaris_9_sparc -rwx------. 1 509833 wheel 32250 Oct 18 20:02 .nicstat.Ubuntu_8_i386 -rw-r--r--. 1 509833 wheel 834 Oct 22 13:05 README.txt
Step #2: Install required 32-bit package
You need to install the 32 bit glibc package. It contains standard libraries which is used by nicstat command. Only install the following packages if you are using 64-bit version:
A note about Debian Linux 6.0.5 64 bit version
Type the following command to install required 32 bit libc6:
$ sudo apt-get install libc6-i386
A note about Ubuntu Linux 12.04 LTS 64 bit version
Type the following command to install required 32 bit libc6:
$ sudo apt-get install libc6:i386
cd into nicstat directory and type the following command to crate a soft link to Ubuntu_8_i386 binary:
# cd nicstat-1.92
# ln -s .nicstat.Ubuntu_8_i386 .nicstat.Linux_i386
A note about CentOS / RHEL 6.4 64 bit version
Type the following command to install required 32 bit libc6:
# yum install glibc.i686
cd into nicstat directory and type the following command to crate a soft link to .nicstat.RedHat_5_i386 binary:
# cd nicstat-1.92
# ln -s .nicstat.RedHat_5_i386 .nicstat.RedHat_6_i386
How do I use nicstat command?
Simply type the following command:
# ./nicstat.sh
Sample outputs:
Pass the -x option to see extended output:
# ./nicstat.sh -x
Sample outputs:
15:39:22 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util eth0 349.4 31.98 325.0 250.6 0.00 0.00 0.00 0.00 0.00 3.12 eth1 28.68 169.4 226.3 247.4 0.00 0.00 0.00 0.00 0.00 1.62
Pass the -s option to see extended output:
# ./nicstat.sh -s
Sample outputs:
Time Int rKB/s wKB/s 15:40:55 eth0 349.372 31.981 15:40:55 eth1 28.686 169.365
To print summary every 1 second, type:
./nicstat.sh 1
To print summary every 2 second 5 times only, type:
./nicstat.sh 2 5
Sample outputs:
Understanding nicstat output
The fields of nicstat's from the above output display are:
- 5:51:22 (HH:MM:SS) : The time corresponding to the end of the sample in 24 hour clock format.
- eth0 and eth1 : The interface name.
- rKB/s : Kilobytes/second received.
- wKB/s : Kilobytes/second written.
- rPk/s : Packets/second received.
- wPk/s : Packets/second written.
- rAvs : Average size of packets received).
- wAvs : Average size of packets transmitted.
- %Util : Percentage utilization of the interface. For full-duplex interfaces, this is the greater of rKB/s or wKB/s as a percentage of the interface speed. For half-duplex interfaces, rKB/s and wKB/s are summed.
- Sat : This the number of errors/second seen for the interface. An indicator the interface may be approaching saturation. This statistic is combined from a number of kernel statistics. It is recommended to use the -x option to see more individual statistics when attempting to diagnose a network issue.
How do I see my TCP nic stats?
Pass the -t option to see the TCP stats:
# ./nicstat.sh -t
Sample outputs:
16:13:44 InKB OutKB InSeg OutSeg Reset AttF %ReTX InConn OutCon Drops TCP 0.00 0.00 811.3 592.2 0.01 0.02 0.000 12.6 2.09 0.02
Where,
- InKB : Kilobytes/second received.
- OutKB : Kilobytes/second transmitted.
- InSeg : TCP Segments/second received.
- OutSeg : TCP Segments/second transmitted.
- Reset : The number of times TCP connections have made a direct transition to the CLOSED state from either the ESTABLISHED state or the CLOSE-WAIT state.
- AttF : The number of times that TCP connections have made a direct transition to the CLOSED state from either the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition to the LISTEN state from the SYN-RCVD state.
- %ReTX : Percentage of TCP segments retransmitted - that is, the number of TCP segments transmitted containing one or more previously transmitted octets.
- InConn : The number of times that TCP connections have made a direct transition to the SYN-RCVD state from the LISTEN state.
- OutCon : The number of times that TCP connections have made a direct transition to the SYN-SENT state from the CLOSED state..
- Drops : Number of connections dropped from the completed connection queue and incomplete connection queue.
How do I see my UDP nic stats?
Pass the -u option to see the UDP stats:
# ./nicstat.sh -u
Sample outputs:
16:15:11 InDG OutDG InErr OutErr UDP 0.35 0.36 0.00 0.00
Where,
- InDG : UDP Datagrams)/second received.
- OutDG : UDP Datagrams)/second transmitted.
- InErr : Packets received that could not be processed because they contained errors.
- OutErr : Packets that were not successfully transmitted because of errors.
Other option
You can combine options
# ./nicstat.sh -x -t -u
OR pass the -a option which is equivalent to -x -t -u:
# ./nicstat.sh -a
Sample outputs:
16:34:10 InKB OutKB InSeg OutSeg Reset AttF %ReTX InConn OutCon Drops TCP 0.00 0.00 545.4 448.5 2.71 0.03 0.000 10.9 21.3 0.00 16:34:10 InDG OutDG InErr OutErr UDP 0.01 0.01 0.00 0.00 16:34:10 RdKB WrKB RdPkt WrPkt IErr OErr Coll NoCP Defer %Util eth0 348.9 31.94 324.5 250.3 0.00 0.00 0.00 0.00 0.00 3.12 eth1 28.71 169.2 227.1 248.1 0.00 0.00 0.00 0.00 0.00 1.62
Print statistics for eth0 interfaces, setting speed of "eth0" and "eth1" to 100mbps/full-duplex and 100mbps/full-duplex, respectively:
# ./nicstat.sh -S eth0:100Full,eth1:100Full 5
Print statistics for eth0 interfaces, setting speed of "eth0" and "eth1" to 100mbps/half-duplex and 1000mbps/full-duplex, respectively:
# ./nicstat.sh -S eth0:100h,eth1:1000 5
References:
- nicstat blog entry.
- Project home page and/or nicstat - the Solaris and Linux Network Monitoring Tool.
- nicstat man page
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











