Make and Change to a Directory in a Single Command
I've always been annoyed that I must create a directory and change into it using two commands. It seems the default behavior should change me into the directory I just made since I most likely want to work there. I wrote a really simple alias to do both in one shot:
function mcd() {
    mkdir "$@" && cd "$@"
}Just drop this into your .bashrc or .zshrc and restart your shell. Now, you can mcd <dirname> to make a directory and change to it in one shot!
Written by Devon Campbell
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Shell 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
 
