A BASH function that should be built-in.

The create directory command, cd, is one of those commands that I use almost every day on the command line. I realized after listening to a recent podcast 1, I should look at how many keystrokes I do and where I can make things more efficient.

function mcd() {
mkdir $1
cd $1
}

One extra character in the command to create a directory not only creates the new directory but then changes into that directory. 2 This saves at least 4 keystrokes each time I create a new directory!



  1. Pretty much any Back to Work episode where they talk about TextExpander šŸ™‚

  2. Which is what you do almost 100% of the time when you create a new directory.

Comments are closed.