The Power of “Cd Create”: Bridging the Gap in Terminal Workflows
If you spend any significant amount of time working inside a command-line interface, you are undoubtedly familiar with the rhythmic, mechanical dance of directory management. You type mkdir project-alpha to manifest a new folder into existence, and then—as if paying a mandatory tax to the operating system—you immediately follow it up with cd project-alpha just to step inside.
Individually, these commands take only a fraction of a second. But scaled across hundreds of projects, nested sub-directories, and quick-fire testing environments, this repetitive motion introduces a subtle friction. It forces your brain to execute two distinct commands for what is conceptually a single human intent: “Take me into a new workspace.”
Enter “cd create”—not a native binary shipped out of the box, but a legendary developer philosophy and workflow pattern dedicated to merging creation and navigation into a single, seamless motion.
Why the Native Separation Exists
To understand why a combined cd create command doesn’t come pre-installed on Unix or Windows systems, you have to look at terminal architecture.
mkdiris an external binary executable. When you run it, the system spins up a separate process to create the directory on your disk and then terminates.cdis a shell builtin. Because it changes the working state of your current shell process itself, it has to be executed directly by the shell environment.
Because they live in fundamentally different operational domains, operating systems historically left them separate. However, shell customizability has allowed developers to bridge this gap brilliantly.
Implementing Your Own “Cd Create” Shortcut
Fortunately, adding a cd create (often lovingly named mkcd or cdd) to your workflow takes less than a minute. By dropping a tiny, elegant function into your shell configuration file (~/.bashrc, ~/.zshrc, or your PowerShell profile), you can fuse these commands forever.
1. The Classic Bash / Zsh Function (mkcd)
Open your terminal configuration file and add the following snippet:
mkcd() {
mkdir -p -- "$1" && cd -P -- "$1"
}
How it works:
mkdir -p: The-pflag is a lifesaver. It prevents errors if the directory already exists and automatically builds any missing parent directories if you pass a nested path (
Leave a Reply