Some commands that you type are internal, built into the shell. For example, the cd command is built-in. That is, the shell interprets that command and changes your for you. The ls command, on the other hand, is an external program stored in the file /bin/ls.
The shell doesn't start a separate process to run internal commands. External commands require the shell to 7.4 shows an example where extra speed can be important.)a new ; this takes some time, especially on a busy system. (Article
When you type the name of a command, the shell first checks to see if it is a built-in command and, if so, executes it. If the command name is anbeginning with /, like /bin/ls, there is no problem: the command is likewise executed. If the command is neither built-in, nor specified with an absolute pathname, the shell looks in its for an executable program or script with the given name.
The search path isn't built into the shell; it's something you specify in your.
UNIX system programs are kept in directories called /bin and /usr/bin, with additional programs usually used only by system administrators in /etc and /usr/etc. Many versions of UNIX also have programs stored in /usr/ucb (named after the University of California at Berkeley, where many UNIX programs were written). There may be other directories containing programs. For example, the programs that make up the are stored in /usr/bin/X11. Users or sites often also have their own directories where custom commands and scripts are kept, such as /usr/local/bin.,
The search path is stored in ancalled . A typical PATH setting might look something like this:
The path is searched in order, so if there are two commands with the same name, the one that is found first in the path will be executed.
You canon the fly, but the path is usually set in shell setup files.