Articles about linux

Linux is a great OS, don't you think? I know I do - and here is a list of stuff about linux such as tips on use and useful software.

This afternoon I needed to rename a bunch of files from one form to another in a command shell… Well technically I didn't need to do it in a shell - but, as sure as there is a hole in my ass, I wasn't gonna go through renaming them all manually!

They needed to go from, for example, add.png to add_32.png. After a little research into commands like printf, awk, bison and so on - I suddenly realized that 'cut' held the key!

Lighttpd Logo

This blog is now no longer powered by Apache (the feature filled but slightly bloated beast), instead I have decided to give Lighttpd (pronounced Lighty) a whirl.

What convinced me? Ages ago I read an article by Dries Buytaert comparing webserver configurations. It was shocked to see that Lighttpd appeared to be able to serve almost twice as many pages per second as Apache. There is also the advantage that a static file will only cost you substantially less memory to serve in Lighty than it will in Apache due to Apache bundling ALL the mods into every process.

So what is Lighttpd? The inventors describe it perfectly…

Recently at work we had been having issues with spiking server load. One of the potential suspects was the Apache configuration as it was allowing 256 MaxClients. Combine that with Drupal eating RAM for breakfast (say a minimum of 12Mb per page) and you have a recipe for disaster - too many visitors cause a RAM shortage, lots of swapping and eventually a server meltdown. After speaking the Rackspace Technical Support Team, one of the guys there (Daniel) wrote a VERY useful script for us to run on the server to monitor Apache usage.

MySQL and Apache

I recently looked into which versions of software I was running and was a little concerned to see how backward Fedora Core 4 was in some areas. I did a little Googling around and found a website ( which is predominately written in French (but has a few English translations) which provides a new repository for Fedora Core 4's Yum Installer Package which provides far more recent RPM's for the likes of PHP and MySQL... So I installed it!

Apache Logo

I recently needed to force a PDF to download using Apache. The default behaviour for most browsers is to try to open the PDF inside the browser itself. This is fine for a small PDF or for powerful machines - but a large PDF on even a modest machine can often lock the browser up. This needed fixing!

After 20 minutes of perusing the Apache documents, I happened across the FilesMatch option which takes Regular Expressions. Regular Expressions are cool things which pattern match; you give it a rather complicated (yet logical) pattern and it matches it for you. Initially I used something like this...

Drupal Grep

I recently needed to find out a list of modules which used hook_cron. I have SSH access to my server. Instead of writing a module (or using devel to execute some PHP) which returned the result of module_implements, I turned to grep. Simply cd into your modules folder (can be the Drupal install, but you end up recursing through unlikely folders) and run this:

grep -R "^function.*_cron" *module

Baby Tux

I recently needed to remotely copy over SSH a folder from the remote machine to my local machine. Usually this is not a problem, however the path to this folder had a space in it. The folder itself is rather large and contains files which wouldn't really benefit from compression. It turns out the solution was quite simple.

Spam With Cheese

I've recently been receiving some spam from some Russian IP's. As each spam attempt was from a different IP, blocking individual ones was a little futile and time consuming. I did a quick Google and ended up at Deekayen's website as it seems he has had similar issues. His solution was an Apache level "Deny"… My solution uses iptables.

Firstly - YAFC? "What on earth is YAFC?" I hear you say. YAFC is a command line FTP tool which, unfortunately, only comes in source code which means you need to know how to compile it. Fortunately, compiling it is easy - it required very few dependencies and most of those I could install using yum on my linux box (Redhat Fedora).

Subscribe to Articles about linux