Why are commands like
"ls", "cat", "touch", "rm", "mkdir"
not internal commands when they already there when you install bash? I feel like external commands should be commands that you can download from elsewhere.
Why are commands like
"ls", "cat", "touch", "rm", "mkdir"
not internal commands when they already there when you install bash? I feel like external commands should be commands that you can download from elsewhere.
Because these commands are not part of bash
. Even though they are available on most systems by default, those come as a separate software with separate codebase. If you remove those, bash will still continue to operate without any issues.
At the same time bash
has built-in tools which are described in built-in section in man (or here). Those are inseparatable from the shell.
Moreover, there's a restricted mode for shell, where you can't execute "external" commands, but builtins are still available for execution.
cat
and ls
builtin (generally not enabled by default, and the latter often not even available by default). There is an "example" cat
builtin in bash
as well (also generally not enabled by default, more as part of a proof of the concept of loadable builtins in bash
).
– Stéphane Chazelas
Dec 17 '21 at 19:01