World Backup Day

For those of you who don’t know, today March 31st is World Backup Day. In our increasingly digitized world, keeping your data safe and secure both professionally and personally becomes increasingly important!

Today I received an email from Host Gator with the following stats:

  • All hard drives will crash during their lifetime
  • More than 1 in 10 laptops will be stolen in their lifetime
  • A laptop is stolen every 53 seconds
  • Every year 46% of computer users lose their music, photos, and documents
  • 50% of all hard drives will crash within 5 years
  • 89.1% of PC users don’t perform regular backups
  • A recent study from Gartner, Inc., found that 90 percent of companies that experience data loss go out of business within two years.
  • 70 percent of companies go out of business after a major data loss

If you are not regularly backing up your files please take the time to find and setup a backup solution. You can read a number of articles on how to backup your computer at

Personally I use a mixture of Rsync and Rsnapshot to backup both my personal and business data. I love the amount of control I have over the backup process, and the fact that none of my data is stored in a proprietary format that locks me into one company or program.

If you aren’t backing up your website can help you setup an automatic, easy to use solution.

Redirecting your website to a new domain

Have you ever needed to move your website to a new domain? This can be a tricky thing to do without breaking all the links to your website that exist in emails, print media, Facebook, or anywhere else on the internet. It is possible to redirect all incoming links with a piece of .htaccess code that will keep all your old links working.

.htaccess Code

RewriteEngine On
RewriteBase /

# New code to redirect from to
# Permanent redirect for caching purposes, also include the query string
RewriteCond %{HTTP_HOST} ^
RewriteRule (.*)$1 [R=permanent,QSA,L]

# New code to redirect from to
RewriteCond %{HTTP_HOST} ^
RewriteRule (.*)$1 [R=permanent,QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Replace with your old domain name, and with your new domain name. This will redirect all links that go to your old domain to your new domain.

Link Examples
Takes you too
Takes you too

Speed up your website with Zlib

Having your website load as quickly as possible is crucial to make sure that you don’t scare your visitors away and recently even search engines are starting to rank your site based on its load time.

One way in which you can decrease the load time on your website is to enable zlib or gzip on your server.

If you have access to your php.ini you can enable zlib for all the pages/sites running on your server by changing the following values in your php.ini file to look like this:
[Read more…]

Using Trickle to Control Bandwidth Use in Any Program

There are a number of reasons why you would want to control how much bandwidth any given program is able to use. This can be done in a couple different ways, including options right with in the software, or through a software or hardware firewall. A great little program for managing bandwidth use is Trickle. Trickle runs completely in userspace, which means we don’t need to mess with a firewall, or even need root access.

If you’re on Ubuntu/Debian you should be able to install Trickle using

sudo apt-get install trickle

Now that you’ve got Trickle installed just use it before any network command to limit its bandwidth. Quite self-explanatory -u specifies upload and -d download.

trickle -u 25 -d 100 myCommand

The reason I first started using Trickle was so I could use Rsync and SCP to copy/backup files on my computer without negatively affecting the speed of my Internet connection. I have a fairly limited upload speed and this is an example of how I would limit the upload speed to 100 KB/s when backup up a folder with Rsync. Please note that when using Trickle with Rsync you have to use the -e option.

trickle -a -e "trickle -u 100 ssh" myFiles

It is even easier using Trickle with SCP where all you would need to do is use:

trickle -u 100 scp

Simplifying Managing Your SSH Connections by Using an SSH Config File

I’ve been using Linux as my primary operating system for over five years, and spent a good deal of time with it before that time. It’s only been within the last year or so that I’ve really begun to explore and enjoy working from the Linux/Unix command line. It’s greatly simplified my work flow when it comes to many tasks, and it seems I spend the majority of my time either in a command line or web browser now a days. Now that nearly 100% of the time when I’m working on a remote system, whether it is a server, Linux/Unix PC, or networking equipment, I’m usually connecting with SSH.

SSH is an incredibly powerful tool that can be used for everything from remote terminal access, to running entire graphical programs over a network. For me though remembering and having to type in all the IP Addresses, DNS Names, usernames and port numbers for all the SSH connections I use daily can be a real pain. That’s why setting up your own SSH config file can save huge amounts of time and effort in your day-to-day work.

This tutorial will be much easier to follow if you have a basic understanding of how to use SSH.
The steps in this tutorial were performed on Ubuntu 11.10. You may need to modify some steps depending on what system you are running.

GUI Version

1. Open Gedit (or your editor of your choice)
2. Click File->Save
Go to your home folder, and display hidden files by hitting CTRL+H on your keyboard.
Open the .ssh folder and save your new file as config

Command Line Version

1. First open up the terminal on your Linux/Unix based system.
2. Use vi (or any editor of your choice)

vi ~/.ssh/config

3. There are many options that you can set in a config file, but we will go over the settings that I usually use. Here’s an example:

Host myServer

User root
Port 222

Host myDesktop


This example shows two different SSH connections and their different options. The first is an example server that we want to connect to at, with the username root, and where the SSH service is running on the non-standard port 222. The second is an example of a computer on your local network. As you can see we used a local IP address instead of a DNS name, also we didn’t bother setting a port number since it is running on the standard port 22. Also because in this example I’m assuming your connecting from another computer you own at the location there is no username set since I’m assuming you are using the same username on both computers you’re using for the connection.

4. Other options that I often use would be ServerAliveInterval, and ServerAliveCountMax.

Host myServer

User root
Port 222
ServerAliveInterval 30
ServerAliveCountMax 120

Host myDesktop

ServerAliveInterval 30
ServerAliveCountMax 120

This example would keep your SSH connection live for an hour by refreshing the connection every 30 seconds. This can be handy if you don’t want to be logged out every time you step away from your keyboard.

With your new SSH Config file instead of having to type in:

ssh -p 222 

You can just use:

ssh myServer

Hope this little trick saves you as much time as it has saved me.

Fix VIM in Ubuntu

An issue that I’ve noticed over the last couple releases of Ubuntu is that the “tiny” version of VIM is installed by default. This for me has always been a big issue, as a number of the controls in the regular VIM don’t work in the “tiny” version. Luckily for us though, this is a very easy and quick fix.
Just install the vim-gtk package using apt-get.

sudo apt-get install vim-gtk

You’ll now have the full version of VIM, as well as the GUI version.

Running RSYNC on a non-standard port

When it comes to using and managing Linux/Unix based systems RSYNC has consistently proven itself a lifesaver for me. It is by far the easiest, safest, and most reliable way to copy, sync, and backup files. I’ve even started using it on Windows machines with Cygwin when I need a good way to transfer large amounts of data between drives. Now when using RSYNC to backup computers across networks I often come across situations where SSH is running on a non-standard port, something other than Port 22, and I need to figure out a way to let RSYNC know what port to run on.


Now when you’re just logging in with SSH it is as easy as using:

ssh -p 2222 matthew@

instead of:

ssh matthew@

and with SCP all you need to use is:

scp -P 2222 matthew@ /home/matthew/localFolder/

instead of:

scp matthew@ /home/matthew/localFolder/

When you are using RSYNC though things are a bit different. You need to use the -e parameter like this:

rsync -avz -e "ssh -p 2222" matthew@ /home/matthew/localFolder/

Just like that you can run RSYNC on whatever port you need to get the job done. If you’ve never heard of RSYNC or aren’t using it and do any type of work involving file transfers/backups I highly recommend you check it out!