Useful linux commands for webmasters

calendar September 17, 2009

Some basic linux commands are more than necessary to perform and control critical points of your system.

  • Checking the number of  apache processes for example.

ps aux|grep httpd -c

  • Number of ip’s that are connected to your http server.

netstat -plan|grep :80|awk {’print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1

  • Hits of googlebot at your log files.

grep googlebot /var/log/httpd/YOUR_access_log* | awk ‘{print $7}’|cut -d: -f 1|sort | uniq -c|awk ‘END{print NR}’

or better at he specifice date.

grep googlebot /var/log/httpd/YOUR_access_log* |grep day?/month?/year? |awk ‘{print $7}’|cut -d: -f 1|sort | uniq -c|awk ‘END{print NR}’

  • This command is reading disk swapping under the swap column.

vmstat 1 10

  • Mysql resources..

ps aux | awk ‘{print $1 ” CPU ” $3 ” MEMORY ” $4}’|grep mysql

admin

Leave a Reply

You must be logged in to post a comment.