Builtins and executables differ in several key ways:
-
Location:
- Builtins: These commands are integrated into the shell itself. They do not exist as separate files on the filesystem.
- Executables: These are standalone programs stored as files in the filesystem, typically located in directories like
/binor/usr/bin.
-
Execution:
- Builtins: Executed directly by the shell without spawning a new process, which makes them faster and more efficient for certain tasks.
- Executables: Require the shell to create a new process to run them, which can introduce some overhead.
-
Functionality:
- Builtins: Often provide functionality that directly interacts with the shell environment, such as changing directories or setting shell variables.
- Executables: Generally perform specific tasks or operations that may not directly affect the shell environment.
-
Availability:
- Builtins: Available in every shell session as part of the shell's core functionality.
- Executables: Availability depends on the system and the installed software; they may not be present on all systems.
In summary, builtins are commands that are part of the shell, while executables are separate programs that the shell can run.
