In Unix, a shell builtin is a command or a function, called from a Shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute.

How can I tell if the command I am using is a shell builtin rather than an external program?

  • type <command_name>
$ type cd
cd is a shell builtin

$ type mkdir
mkdir is /bin/mkdir

But I want to use an external program rather than a shell-builtin.

If a command specified to the shell contains a slash /, the shell will not execute a builtin command. Thus, while specifying echo causes a builtin command to be executed under shells that support the builtin echo command, specifying /bin/echo does not.

Why can I not use sudo <shell_builtin> ?

A shell builtin is not an executable file so sudo does not know about it. (obviously wont be found in any dirs in sudo's PATH). You will need to use the command sudo -s to get a new shell with root privileges or alternatively you can do sudo bash -c "<shell_builtin>" [args].