Busybox creates those links linking to /bin/busybox.
Why are they there and what are they used for?
Busybox creates those links linking to /bin/busybox.
Why are they there and what are they used for?
They're commands used to figure things out in shell scripts. They're usually used to decide between multiple possible actions in shell scripts. For example:
#!/bin/sh
if [ "$1" -eq "5" ]; then
echo You gave me a five.
else
echo You didn't give me a five.
fi
The part that starts with [
checks whether the first argument to the script is 5
. To do that, it uses the [
command. [[
is similar but has different capabilities.
The link to /bin/busybox
is a trick used by several commands on BusyBox. The /bin/busybox
program handles the tasks performed by all of those commands, figuring out which command to perform by looking at which command you originally used to start up /bin/busybox
.
This is to save some space on the disk by not having to duplicate things like executable file headers and common functionality and so on for each executable file.
Instead, there's only one executable file for a bunch of commands, so there's only one file header and the common functionality only needs to be included in one file, allowing tricks like static linking without a bunch of duplication, which is nice for embedded systems.