One-liner to count current IP connections

September 2nd, 2009

A quick one-liner to show the IP addresses with an established connection to your server, sorted in order:

netstat -ant | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr

If you care only about a certain TCP port, say 80 for web traffic, the command becomes:

netstat -ant | grep :80 | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr

Output would look like:


36 14.21.23.10
8 14.21.23.107
7 14.21.23.114
6 14.21.2.34
5 14.21.23.108
5 14.21.23.106
5
2 14.21.13.120
1 14.21.2.23
1 14.21.13.147
1 14.21.13.130
1 14.21.13.128
1 14.21.13.122
1 14.21.13.118
1 14.21.13.112

Read the rest of this entry »

Pidgin fix so Yahoo works agai…

June 20th, 2009

Pidgin fix so Yahoo works again: in Advanced tab, change Pager Server to 66.163.181.170. Pidgin 2.6.0 will fix, but n/a yet…

Holy crap that was some close …

June 19th, 2009

Holy crap that was some close lightning/LOUD thunder!! Whole house shook like a So Cal earthquake!

vim replace with newline

June 10th, 2009

Just a quick vi/vim tip that I’d never had to do before now.

Scenario: a file with multiple lines, each terminated with a semicolon, that needed to be broken out into separate lines for easier reading.

Solution:

In vim, use \r in the search-and-replace command to indicate a new line:

:%s/;/;\r/g

Twitter-Facebook interlink com…

June 10th, 2009

Twitter-Facebook interlink completed…?

Deciding which project to tack…

June 5th, 2009

Deciding which project to tackle first…

Sitting in another hospital ro…

May 21st, 2009

Sitting in another hospital room, watching people sleep, makes me… sleepy!

Dad’s been moved from ICU to R…

May 20th, 2009

Dad’s been moved from ICU to Rm 217 following today’s MRI, and is sleeping now.

Testing out Twitter gadget for…

May 14th, 2009

Testing out Twitter gadget for gmail…

Email forwarding to multiple recipients with cPanel

February 26th, 2009

At first I thought I’d have to do something complicated like an email list. But I found out that you just have to create multiple single forwarder entries with the same “Address to forward” for each, and the different recipients in each “Forward to email address” field per entry.

Example:


boardofdirectors@example.com -> joe.blow@example.net
boardofdirectors@example.com -> jane.smith@example.org