What is the Linux command that encapsulates almost all of the other commands?
Solution 1:
The most popular could be BusyBox, but there are also toolbox (used by Android), toybox and maybe others.
Solution 2:
You’re probably referring to Busybox, an “all-in-one” shell.
Solution 3:
BusyBox is designed in a fairly novel way that can be quite confusing when you start rummaging around in your /bin directories.
As MSalters indicated, BusyBox is just one executable. But it depends on a symbolic link being created to that executable for every "command" in it. By knowing the symlink name it was started with, it knows to run the C function for that command.
Thus, the start of my PuppyLinux 5.2.8 Lucid /bin directory looks like ...
sh-4.1# ls -l
total 4889
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 [ -> busybox
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 [[ -> busybox
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 addgroup -> busybox
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 adduser -> busybox
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 ash -> busybox
-rwxr-xr-x 1 root root 2844 2011-08-17 11:04 autologinroot
lrwxrwxrwx 1 root root 4 2011-08-17 10:49 awk -> gawk
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 basename -> busybox
-rwxr-xr-x 1 root root 805960 2011-08-17 11:04 bash
-r-xr-xr-x 1 root root 6835 2011-01-21 01:29 bashbug
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 bbconfig -> busybox
-rwxr-xr-x 1 root root 30200 2011-08-17 11:04 bunzip2
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 bunzip2-BB-NOTUSED -> busybox
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 busybox
-rwxr-xr-x 1 root root 30200 2011-08-17 11:04 bzcat
lrwxrwxrwx 1 root root 7 2011-08-17 10:49 bzcat-BB-NOTUSED -> busybox
Note that most commands are symlinks to busybox
. This includes the ash
very minimalist shell used mostly during boot operations. Also note that the distribution author chose to include the standalone commands bunzip2
and bzcat
instead of using the busybox versions. The symlinks bunzip-BB-NOTUSED
and bzcat-BB-NOTUSED
are not really necessary but help document what's going on for just the cost of a symlink.
Note also that a directory listing that reports sizes for the target of symlinks (ls -lL
or ls -l --dereference
) instead of the symlink itself, will report the size of each command as the same as that of busybox
. Thus the same list with the -L
option shows ...
sh-4.1# ls -lL
total 60402
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 [
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 [[
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 addgroup
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 adduser
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 ash
-rwxr-xr-x 1 root root 2844 2011-08-17 11:04 autologinroot
-rwxr-xr-x 1 root root 317880 2011-08-17 11:04 awk
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 basename
-rwxr-xr-x 1 root root 805960 2011-08-17 11:04 bash
-r-xr-xr-x 1 root root 6835 2011-01-21 01:29 bashbug
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 bbconfig
-rwxr-xr-x 1 root root 30200 2011-08-17 11:04 bunzip2
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 bunzip2-BB-NOTUSED
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 busybox
-rwxr-xr-x 1 root root 30200 2011-08-17 11:04 bzcat
-rwxr-xr-x 1 root root 637960 2011-08-17 11:04 bzcat-BB-NOTUSED
The objective of BusyBox is maximum reuse of code within itself in order to minimize the memory and disk space required (i.e. the "footprint") for a common set of commands... without requiring a shell itself.
Bash and other shells accomplish the same thing. But to do so, they implement their own commandline environment. This objective is also one of the reasons for some of the very archaic syntax for many shell functionalities.
I'm currently using this "BusyBox technique" for a library of Bash functions and easier to use wrappers for various bashisms. It has let me easily "extend" commands with --help
options and fire off GUI versions when available.