Archive for the 'Bash' Category

Find duplicate files by size

Find the same files by their size:

1
ls -l | awk '$1!~/^d/{if(size[$5]!=""){ print}size[$5]=$8}'

Very useful to delete duplicate photos or videos.

Windows 7 USB installer

I hate CDs and DVDs, we are living in digital world and one gigabyte cost at the time about 0,03€ cents. I try to copy everything on my flash drives and HDDs. This post will show you how you can throw away your windows seven CD/DVD.

Insert a 8 or 16GB usb flash drive in your USB port. Careful! this Continue reading ‘Windows 7 USB installer’

Remove logs older than X days

The simplest way to remove files older than $NUMBER of days..

Dry run (files will be NOT deleted, you will see a list with files older than 100 days)

1
find /var/log/squid3/ -mtime +100 -exec echo {} \; | less

Another dry run, see what you will delete :

1
2
3
find /var/log/squid3/ -mtime +600 -exec echo rm {} \;
rm /var/log/squid3/access.log.0
rm /var/log/squid3/access.log.2

Finally if you decided to remove the files:

1
find /var/log/squid3/ -mtime +600 -exec rm {} \;

OpenVZ adjust RAM

Long Long time ago I wrote how I migrated from Xen to OpenVZ. This post will show you how to manage your VE memory.

First you set the veid=yournumberofve and the rest is copy paste ; Look at the examples:
Continue reading ‘OpenVZ adjust RAM’

WordPress Munin Plugin

The original Plugin was written by Chris Bair, after some tunings it worked fine for me.

I made some useful modifications to this Plugin:
- Visualization of the number of Drafts
- Set table prefix (I hate hardcodet things)



And now how to use it, first you need to create a configuration file for the plugin(replace the needed credentials) Continue reading ‘WordPress Munin Plugin’