Archive for category internet
So, I run GeekTools on my iMac, and I wanted to be able to view all established internet connections on my Mac.
Here’s how I did it.
netstat -abf inet | grep “ESTABLISHED” -C 1 | grep -v “localhost” | sort -rk7
1. netstat -abf inet
Shows me a list of all internet connections
2. grep “ESTABLISHED” -C 1
It filters the netstat output to show only the ESTABLISHED connections, and it keeps the heading by using -C 1 option.
3. grep -v “localhost”
Basically I’m removing any “localhost” lines from the grep output in command 2.
4. sort -rk7
I’m going to (r)everse sort on column (k7). So it displays my output from largest number of bytes transmitted.
The screenshot shows the output on the lower right hand corner.