Make and Change Directory Shell Alias
If youโve ever cursed the fact that you need to mkdir <dirname>
followed by cd <dirname>
to create and change into a new directory, this snippet is for you.
function mcd() {
mkdir "$@" && cd "$@"
}
Just paste that into your shell configuration (.bashrc or .zshrc in your home folder), restart your shell, and start making and changing into directories with just mcd <dirname>
.