Search code examples
linuxresetbuilt-in

Reset a builtin function


I have the following code in my .bashrc file:

function cd {
builtin cd "$@" && ls
}

which overwrites cd to always execute the ls command immediately after.

Short of removing it and rerunning the file, what can I do to reset the cd command?


Solution

  • unset takes a -f flag to unset a function definition.

    unset -f cd