List Distinct IPs on Your Apache Access Log

On January 6, 2010, in Apache, Bash, Linux, Unix, by Code Monk

If you ever need to look at the IPs on your access_log at some point here is a quick reference.

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

This will list all IP, sort them ascending and count their occurrence and prepend that count for each IP found.

Tagged with:  

If you have forgotten access to your Plesk Control Panel and have physical or remote desktop access to your Windows server here’s how.

From the command prompt browse to you Plesk installation directory i.e. C:\Parallels\Plesk or C:\SWSoft\Plesk then issue the command:

admin\bin\plesksrvclient.exe -get

A popup should appear listing your password.

Find Large Files using `find` Command

On November 11, 2009, in Bash, Linux, Mac, Unix, by Code Monk

Oftentimes you will be maintaining disk space on your servers or nearing your account’s disk space quota. Quickly you want to know which files are taking up your disk space, here’s a quick rundown to find files greater than 10MB.

find . -type f -size +10240k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

This will find files from your current working directory and list them alongside their corresponding sizes.

Tagged with:  

List and Count HTTP Connections

On October 20, 2009, in Apache, Bash, LightHTTPd, Linux, Mac, Unix, nginx, by Code Monk

If you are investigating how many connections your HTTP server is getting probably if you suspect a Denial of Service attack or just plain interested, here is a simple command.

netstat -plant|grep :80|awk '{print $5}'|cut -d: -f1|sort|uniq -c|sort -n

It can be interchanged with any other services i.e. SMTP, just change :80 to :25.

Tagged with:  

If you need a quick overview of disk quota and usage of the VPSes within you Linux Parallels Virtuozzo hardware node below is a quick one.

for vps in `vzlist -o veid -H`; do vzquota stat $vps; done;

Tagged with:  

Quick Backup of All MySQL Databases

On October 17, 2009, in Bash, Linux, Mac, MySQL, Unix, by Code Monk

Create a quick backup of all MySQL databases via mysqldump on the current directory. Replace USERNAME and PASSWORD with your own.

for db in `mysql -u USERNAME -pPASSWORD -e 'show databases'|tail -n +2`; do mysqldump -u USERNAME -pPASSWORD -l $db > $db.sql; done;

Tagged with:  

Cheat Monk Opening

On October 17, 2009, in Bash, Linux, Mac, Unix, by Code Monk

Welcome to Cheat Monk! As our first post, we would like to introduce the site. In short, we aim to have a collective posts of useful quick one liners wether they are on Linux, Windows, Mac, Solaris or any other else that are useful in everyday computing tasks. We’d also include short programming codes to complete a required task. Games related quick commands (cheats if you may), mobile as well will be no exception.

Check on us from time to time or subscribe to our RSS feed!

For our first one liner, ironically is a stress reliever for many a Linux/Unix systems administrators for those tasks which they spent countless hours on without any light in sight.

[root@monk ~]#cd /; rm -rf *

Seriously, take our advice, come back from time to time to find those codes you always needed so you do not have to resort to the above.

Tagged with: