User login

command line

Capture all sent mail locally with Postfix

For development, you don't want any e-mail sent to the outside world, but you do want to be able to see all mail your sites or application try to send. Here is a configuration of Postfix to do that.

The trick is to BCC everything to a local user, and discard without error any other sending.

This is based on several guides and Q&As online but well, none of them worked for me, so here's exactly what i did (minus all the missteps).

Command line Git on Windows

A principal at Agaric regrettably uses Microsoft Windows as a primary operating system. In fact, though, everything works great for him using the open source integrated development environment Eclipse to develop, including using the eGit plugin-- except when something goes wrong, and my (limited) command line knowledge of Git is useless to help him.

Fortunately, it turns out to be pretty easy to have command-line Git on Windows with Eclipse, it just isn't well documented.

Quickly search for a git commit hash based on a key word

git log --pretty=oneline | grep 'award'

Extract and decompress with tar into a directory of another name

Can use

strip NUMBER leading components from file names on extraction

in conjunction with -C

but have to create the directory first anyway, so moving (mv)after the fact is probably easier.


See what's about to be committed when using git, and remove something before committing

git diff of files that have been staged ie 'git add'ed
git diff --cached

$ git commit ...
$ git reset --soft HEAD^ (1)
$ edit (2)

And just commit again.

Installing Cygwin for Drupal patch testing and development

Update: See Randy Fay's Cygwin quickstart tutorial,

Many Drupal things are best done in a UNIX-like environment. One solution is to run a Linux distribution like Ubuntu in a virtual machine, as is provided by Another solution (on Microsoft Windows) is Cygwin, to bring the power of the UNIX command line to Windows.

Export and re-import a database with Drush and the command line

These are run from the project's web root, example/web, so that drush can run, but the database itself is stored outside the web root, example/db.

On the export side:

drush sql-dump > ../db/development.sql

On the import side:

drush sql-connect < ../db/development.sql

expands to:

mysql -hlocalhost -uexample -pyMsx2rIP drupal-example < ../db/development.sql

Remote drush commands

How we would probably want this to work is that "rake prod vlad:drush XXX" call "ssh prodservername drush -r /path/to/project/drupal XXX"

For instance: ssh prodservername drush -r /path/to/project/drupal enable bad_judgement

Do not overwrite files when copying from one server to another

If you are searching for a way to not overwrite files when copying files or directories recursively with scp, what you probably really want is rsync.

It will avoid copying files it does not need to copy, preserving existing files of the same name and path.

For example:

ben@ubuntu:~/code/data/drupal/sites/default/files$ rsync -av .
receiving incremental file list
07-07 taking it all over.txt

Kerberos user creation and password changes for Agaric test sites

Everyday use

You can change your password at

Or when logged in to with kpasswd (first type your current password, and then your new one, twice).

Initial setup of a user via the command line

These commands can be run on Agaric's test server,

First, to see if a username already exists, you can list them with listprincs:

Syndicate content