Apache server stats with small and useful bash script.

2013-11-29 3 min read bash Linux Uncategorized Wordpress
Just copy this script to your web-server cgi-bin directory and enjoy. The script with show the common errors like 404 Error, Internal Server Error and others. It will show the User agent distribution using simple commands like grep, uniq, awk and so on. You would need to change the tfile – which is temporary file and also the access.log path in the next line. Just re-direct the output to some file with html extenstion. Continue reading

Ranking of the most frequently used commands

2011-01-31 2 min read Linux Uncategorized
Lets take a quick look at how to get the most frequently used commands on you shell. So what we need to do is this: 1 <td> <div class="text codecolorer"> history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr </div> </td> </tr> So, how did we arrive at this and will this always work? No it might not always work. Continue reading

find duplicate entry in a list in bash with sed

2010-06-25 1 min read bash Fedora Learning
Here I will take an example of rss2email list, but I guess I will be able to pass on the concept. Here is example of the output of the r2e list command: 1: http://blog.amit-agarwal.co.in/feed (default: amitag@localhost) 2: http://feeds2.feedburner.com/AllAboutLinux (default: amitag@localhost) 3: http://feeds2.feedburner.com/Command-line-fu (default: amitag@localhost) 4: http://blogs.members.freewebs.com/Members/Blogs/viewBlogRSS.jsp?userid=29731143 (default: amitag@localhost) Target here is to get the list of all duplicate entries if any. So, first we need to remove the numbers from the begining and the email ID from the end. Continue reading