Linux – Cat command

This entry was posted on Thursday, October 1st, 2009 at 04:35 and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Heres a nice something some of you may find useful:

root@sat1 [/usr/local/apache/domlogs/ommited]# cat ommitedsite.com | awk ‘{print $1}’ | cut -d: -f1 | sort | uniq -c | sort -n
root@sat1 [/usr/local/apache/domlogs/ommited]#

Basically says how many times the ip has hit your site:

182 81.82.240.15
192 202.28.180.202
203 188.220.62.52
204 41.223.251.18
225 81.27.128.142
228 124.157.129.20

Looks good in terminal, usually I use it for checking if a box of mine is getting flooded or if theres simply getting too much traffic. That command looks like this:

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

Obviously if your getting too much and want to analyse the outpout in a text file, append > output.txt, and use vi, or nano to look into it.

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n > output.txt

Hope this helps some of you.

Update me when site is updated
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • blogmarks
  • StumbleUpon
  • Technorati
  • Global Grind
  • Reddit
  • Yigg

Leave a Reply