5.4. Executable Files Versus Built-in CommandsMost Linux commands invoke utility programs that are stored in the directory hierarchy. Utilities are stored in files that have execute permission. For example, when you type: $ ls the shell locates the executable program called "ls," which is typically found in the "/bin" directory, and executes it. The way that the shell finds a utility is described later in this chapter. In addition to its ability to locate and execute utilities, the shell contains several built-in commands, which it recognizes and executes internally. I'll describe two of the most useful ones now: echo and cd. 5.4.1. Displaying Information: echoThe built-in echo command displays its arguments to standard output (Figure 5-4).
All of the shells we will see contain this built-in function, but you may also invoke the utility called echo (found in /bin) instead. This is sometimes useful, as some arguments and subtle behavior may vary between the different built-ins and it can be confusing if you write scripts in more than one of these shells. We'll look at writing shell scripts shortly. 5.4.2. Changing Directories: cdThe built-in cd command changes the current working directory of the shell to a new location, and was described fully in Chapter 3, "GNU Utilities for Nonprogrammers." |