Linux – Cat command
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.
One thought on “Linux – Cat command”
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?