The environment variable PATH is the search path for executable commands, so I thought changing the PATH to something that doesn't exist (for instance, export PATH=blah) would make me unable to use any command.

After I change it, it doesn't let me use all commands (e.g. I can't use ls). But apparently, I can still use numerous commands, and I can still use export and change it back.

Aren't all commands just executable files in the search path? Where are the executable files for these still-usable commands located? How come I can still use them when my search path is gibberish?

2 Answers 2


You can still run builtin commands, i.e. commands internal to your shell thus not needing to be backed by an executable.

For example, if your shell is bash, you can have a look to: https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html

Note that some commands that internally affect the shell like cd, exec and exit for example can't be provided by an external binary because they just wouldn't work as expected (at all even).


Assuming that your shell is bash, there are many shell builtins, shell keywords, shell aliases, such as the shell builtins:

alias, bg, bind, break, builtin, case, cd, command, compgen, complete, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, fc, fg, getopts, hash, help, history, if, jobs, kill, let, local, logout, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, type, typeset, ulimit, umask, unalias, unset, until, wait, while

The following will still work:

echo "Hello, world!'

cd /opt

printf '%s\n' /home/user/*


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .