Obtain TCP Network netstat output without netstat

There are times you may be on a system and for whatever insane reason, netstat is not installed.

Here is how you can obtain interface information without netstat

# awk '(f==0) { i=1; while ( i<=NF) {n[i] = $i; i++ }; f=1; next} (f==1){ i=2; while ( i<=NF){ printf "%s = %d\n", n[i], $i; i++}; f=0}'  /proc/net/netstat |column -t

Example results

# awk '(f==0) { i=1; while ( i<=NF) {n[i] = $i; i++ }; f=1; next} (f==1){ i=2; while ( i<=NF){ printf "%s = %d\n", n[i], $i; i++}; f=0}'  /proc/net/netstat |column -t
SyncookiesSent             =  0
SyncookiesRecv             =  0
SyncookiesFailed           =  5
EmbryonicRsts              =  0
PruneCalled                =  0
RcvPruned                  =  0
OfoPruned                  =  0
OutOfWindowIcmps           =  0
LockDroppedIcmps           =  0
ArpFilter                  =  0
TW                         =  1160
TWRecycled                 =  0
TWKilled                   =  0
PAWSPassive                =  0
PAWSActive                 =  0
PAWSEstab                  =  5
DelayedACKs                =  25254
DelayedACKLocked           =  21
DelayedACKLost             =  4129
ListenOverflows            =  0
ListenDrops                =  0
TCPPrequeued               =  419476
TCPDirectCopyFromBacklog   =  7131447
TCPDirectCopyFromPrequeue  =  70660208
TCPPrequeueDropped         =  0
TCPHPHits                  =  650154
TCPHPHitsToUser            =  35433
TCPPureAcks                =  241811
TCPHPAcks                  =  29236
TCPRenoRecovery            =  0
TCPSackRecovery            =  21
TCPSACKReneging            =  0
TCPFACKReorder             =  0
This entry was posted in Linux, Networking and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *