IP address Apache access logs

If You want find out which ip address occurs the most in apache logs (to determine bot attack) run :

cat access_log | awk '{print $1}' | sort | uniq -c | sort -n | tail

To determine if given IP occurs in iptables rules:

iptables -L -n -v | grep [ip_address]

That helped me a lot lately…


Quick Tip: Watch Me!

Very, very, very useful command!

Let’s say You want to observe the result of something being done every 5 seconds. For example list directory contents in which You’re creating backups in other thread. How to do this? Simply – use watch command:

watch -n5 'ls -lh /srv/backups'

Remember that brackets are very important and command in brackets can’t be alias (like ll for ls -l).