How to disable cd command-line? How to disable cd command-line? unix unix

How to disable cd command-line?


You can use cd - to quickly return to the previous directory ($OLDPWD). In general, I recommend getting used to UNIX as it is. But if you really want to, add this function to ~/.bashrc. It will make cd with no arguments a noop.

cd() {    (( $# > 0)) && builtin cd "$@"}