I’ve taken a lot of time to personalize my dotfiles. There are a couple of functions I wanted to share.

Make a Directory and Change Into It

My workflow often looked like this:

mkdir some-directory
cd some-directory

I wanted to put that workflow all into one command.

function mcd() {
  mkdir -p "$1" && cd "$1";
}

Now I can type

mcd some-directory

Add this function to your set up

To start using the mcd function, copy and paste the function above into your ~/.bashrc file (or ~/.zshrc file if you’re using zsh), and run source ~/.bashrc (or source ~/.zshrc) to start using it.