Change the name of current directory from the command line

Here is a simple bash function for renaming the current directory you are in from the command line:

rename_current_dir() {
cd=${PWD##*/}
cd ..
mv $cd $1
cd $1
}

Create an alias of your choice to this command so it’s easier to type:

alias rncd='rename_current_dir'