Blog Archives

MySQL Latin1 to UTF8 conversion

Many people think it’s as simple as doing a mysqldump->sed->mysql command (or clicking Change->Collation in PhpMyAdmin) but that only changes the encoding for NEW data, while leaving the old data intact and possibly coming out dirty. Luckily there is a

Posted in bash, Database, linux, servers Tagged with: , , , , , , , , , ,

Rename spaces to underscores

How to rename files with spaces to use the underscore character instead .. or any other web friendly character. I’ve just been handed a zip full of files, and want to host them, but they’ve all got nice pretty spaces

Posted in bash Tagged with: , , , , ,

Vim as Man page viewer

Linux man pages are gold, and much quicker than googling, but I hate having to learn yet another interface for what is just a text flatfile that’s a bit to big to fit on a single 80 x 24 character

Posted in bash, linux, vim Tagged with: , , , , , ,

SSH works, but file copy utilities fail

The symptoms vary across OS’s and connection utilities/programs but in essence it’s the same. Connecting to a remote filesystem via SSH fails with no good error message. Transmit on Mac mounting the drive is no better than Nautilus on Linux

Posted in linux, ssh Tagged with: , , , , , , , ,

Recursive unzipping many zip and rar files in many folders.

So I have a directory with ~100 folders, each containing atleast 1 zip/rar file that needs extraction. No point in keeping the zip/rar file afterwards either so remove it. find . -name "*.zip" -exec unzip {} \; -exec /bin/rm {}

Posted in bash, compression, linux Tagged with: , , , , , , ,

Finding the install date of a linux system

Easy was to find install date of system is as follows: sudo passwd -S bin bin P 09/19/2010 -1 -1 -1 -1

Posted in linux Tagged with: , ,

I’m still running out of space

A server has no space! Where has it all gone? I want to see a list of where the disk usage is. Linux has a built in function du but that’s rather limited sometimes. du -mxS / | sort -n

Posted in linux Tagged with: , , ,

I’d like my linux box to email me when it’s hard drive is full.

I’d like my linux box to email me when it’s hard drive is full. It could be my webserver, my home file server full of movies and music, or even my netbook after getting a bit hit of Dropbox files.

Posted in linux Tagged with: , , , ,

Running PNGCrush on a recursive directories

One easy way of reducing website load time is by optimizing your images, which is what PNGCrush does. PNG graphics are often more bloated than they need to be so using PNGCRUSH should be obvious. Basic usage flags don’t allow for recursive

Posted in bash, compression, linux Tagged with: , , ,

Prefetching updated packages with Trickle, Pacman and Apt-Get

To make package updating easier, you can download packages/package lists in advance so that when it comes to the update everything is ready and just requires overview and confirmation. Archlinux: trickle -d 5 pacman -Syuw –noconfirm Ubuntu: trickle -d 5

Posted in linux, package managers Tagged with: , , , ,

.bashrc doesn’t get loaded when logging in through TTY

Symptom: ~/.bashrc doesn’t load when logging in through TTY, but it will through xterm/guake/etc.. Solution: TTY loads ~/.bash_profile by default, so append to/create ~/.bash_profile the line $HOME/.bashrc and it will load. Under some installs, it may be ~/.profile rather than

Posted in bash, linux Tagged with: ,