One Thing Well

A weblog about simple, useful software.

Follow on Twitter, Google+ or via the feed. Feel free to get in touch. Sponsor the site.

mkcd Improved

Reader Martin got in touch to suggest some changes to mkcd, a simple shell function that lets you make a new directory and change into it in one step, and I added one little fix of my own:

# mkdir, cd into it
mkcd () {
    mkdir -p "$*"
    cd "$*"
}

The new improved mkcd will let you make a new directory and change into it with support for directory names that contain spaces, and the creation of new directory hierarchies.

To use, add it to your shell configuration file (~/.bashrc, ~/.zshrc, &c.) and do, for example:

mkcd directory/directorytwo/directory three with spaces