summaryrefslogtreecommitdiff
path: root/content/posts/2019-2-24-walking-netstat-with-awk.md
blob: 1094bcea0f96c7168fc849583af2184a7b00856a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
layout: post
title: Walking /proc/net/netstat like a pro with awk
category: GNU/Linux
tags:
  - networking
---

Little snippet to parse `/proc/net/netstat` and format the output:

```bash
awk '{for(i=1;i<=NF;i++)title[i] = $i; getline; print title[1]; for(i=2;i<=NF;i++)printf " %s: %s\n", title[i], $i }' /proc/net/netstat

TcpExt:
 ...
IpExt:
 ...
```