Before login

Tidbits

Used for small, but helpful bits of information. Usually discoveries, or handy "one liners"

How to Reset MySQL Root Password

 Ever needed to know how to reset your MySQL root users password? Happens to the best of us - we all forget, or we're helping out someone who's forgotten. Here's a quick and concise guide on how to do it, as sometime's you just need it quickly without any massive explanation - hence, our little tidbit for you!

Count Occurrences of Phrase, Word, Number, etc., in a file

 Earlier today, I was analysing some logs, and wanted to count the number of times each IP address occured within these logs, and then have the IP address next to the number of times it appeared (thereby assisting in recognising the biggest visitors). I started off with Apache logs, so to get the list of IP address from all files into one *long* list, I just did this:

cat * | awk '{print $1}' > ip_access_list

Then, to do the actual counting, I did the following:

sort ip_access_list | uniq -c | sort -nr