Linux – Cat command

Linux – Cat command

Heres a nice something some of you may find useful:

[email protected] [/usr/local/apache/domlogs/ommited]# cat | awk ‘{print $1}’ | cut -d: -f1 | sort | uniq -c | sort -n
[email protected] [/usr/local/apache/domlogs/ommited]#

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


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.

One thought on “Linux – Cat command

  1. This technique seems to break down a bit when you need to grab items in a range of say, 25-35. I guess you could do sniethmog like 2[5-9]|3[0-5] but do you know of a more general purpose technique?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.