Useful Command-line Tools, Part 1: mktemp

This is the first part of the Useful Command-line Tools on useful command line tools. In this blog post I'm going to talk about the mktemp command.

This is a really cool command that generates unique file or directory names for temp files or directories based on a template you pass it.

Here's how you create a temp file in your /tmp directory:

$ tempfile=$(mktemp /tmp/footemp.XXXXXX) || exit 1
$ echo $tempfile

You can also create a temp directory:

Some fun unix commands

Cleaning up old Aegir backups

If you use the Backup Scheduler built into Aegir you've already figured out that it's weird to configure and can start to eat up a lot of disk space if you have an agressive backup scheme or a lot of Drupal instances. We had about 40 or so when I noticed that our disk space started to resemble a J curve: