So, do you ever needed to change the behavior of a shell’s built in command? O.K. the command builtin comes to save the day.

First thing is to know which are built in commands, to do that, read the man of your shell

echo $SHELL

This will let you know your shell, and now read the man page of it.

a good example, about changing the behavior of a build in command is, to make cd print your current directory each time it is used.

Enter this in your shell window

builtin cd "$@" && echo $PWD

Just write all of that in a console window, and then test your new cd function.

What we did, is to maintain the original function of cd and add the “echo $PWD” part.