How to Create a Custom CD or DVD Easily

Written by

in

The Power of “CD Create”: Merging Directory Creation and Navigation into One Seamless Flow

Every developer, system administrator, or terminal power user knows the familiar rhythm of the command line:
mkdir project-folder followed immediately by cd project-folder.

While typing those few extra characters might only take a second, the philosophy of efficiency dictates that repetition is meant to be automated. Enter the concept of “cd create”—the ubiquitous developer workflow of combining directory creation and navigation into a single, seamless motion.


Why the Friction Exists

Operating systems and shells do not natively ship with a built-in cd-create command out of the box. This separation exists because cd is a shell builtin (managed directly by your active shell environment to alter its state), whereas mkdir is traditionally an independent binary executable.

When scaling projects, writing scripts, or organizing quick-fire testing environments, repeating these two steps introduces micro-frustrations:

  • Redundancy: Typing the exact same directory name twice leaves room for typos or misalignment between lines.
  • Context Switching: Your brain has to acknowledge two distinct steps for what is conceptually a single user intent: “Take me into a new workspace called X.”

How to Implement Your Own “CD Create” Shortcut

Fortunately, bridging this gap takes less than a minute. Depending on your shell (bash or zsh), you can easily drop a tiny utility function into your shell configuration file (~/.bashrc, ~/.zshrc, or ~/.bash_aliases).

1. The Classic mkcd Function

Open your terminal configuration file and add the following snippet:

mkcd() {
  mkdir -p -- "$1" && cd -P -- "$1"
}

What this code does:

  • mkdir -p: The -p flag ensures that if you specify a nested path (

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *