What exactly is Busybox / Ash?

Really, what is busybox and ash?

I have never seen a good explaination to what it is.

I've used it and i know its a Linux shell, but I would like to get a real understanding of it.


Ash is a simple unix shell, as compared to bash, which is the more typical fully featured shell preferred on Linux systems.

Busybox is a program that implements an ash like shell, as well as a number of other common unix programs, though in a stripped down version, all in a single program. It is intended to provide a semi-typical unix like environment in a very space limited environment, hence, why it implements many ( stripped down ) programs as single program, and then has the separate program commands symlinked to the busybox binary, which figures out which program it is supposed to emulate and does its best to behave in a similar way to the fully featured program that it is replacing.

Busybox was originally developed for use in very space limited environments such as a single floppy boot disk, and continues to see use today in space limited environments like embedded systems such as dd-wrt.


Let me expound upon @psusi's answer.

@psusi said (emphasis added):

Busybox is a program that implements an ash like shell, as well as a number of other common unix programs, though in a stripped down version, all in a single program...hence, why it implements many ( stripped down ) programs as single program, and then has the separate program commands symlinked to the busybox binary, which figures out which program it is supposed to emulate and does its best to behave in a similar way to the fully featured program that it is replacing.

Check this out. This is interesting, and confirms what is said in the quote above.

Here is a snippet from the beginning of the output from ls -alF /bin on an embedded Linux device. As you can see, nearly all the executables in /bin are actually symlinks to /bin/busybox (and can be called with /bin/busybox <cmd>, by the way):

/bin# ls -alF /bin
total 1184
drwxr-xr-x    2 root     root          4096 Nov 11  2021 ./
drwxr-xr-x   22 root     root          4096 Nov 11  2021 ../
lrwxrwxrwx    1 root     root             7 Nov 11  2021 arch -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 ash -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 base64 -> busybox*
-rwsr-xr-x    1 root     root        709792 Nov 11  2021 busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 cat -> busybox*
-rwxr-xr-x    1 root     root         10288 Nov 11  2021 chattr*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 chgrp -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 chmod -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 chown -> busybox*
-rwxr-xr-x    1 root     root          1342 Nov 11  2021 compile_et*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 cp -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 cpio -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 date -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 dd -> busybox*
lrwxrwxrwx    1 root     root             7 Nov 11  2021 df -> busybox*

So, if you run ash, which ash shows that the ash executable is located at /bin/ash, and ls -alF /bin/ash shows that that executable is a symlink to busybox. Notice /bin/ash -> busybox*, where the * at the end is due to the ls -F flag and means "executable":

/bin# la -alF /bin/ash
lrwxrwxrwx    1 root     root             7 Nov 11  2021 /bin/ash -> busybox*

So, running ash is the same as running /bin/ash which is the same as running busybox ash which is the same as running /bin/busybox ash.

Once I run any of those ash or busybox ash cmds I can see that the output of echo $0 has changed from -sh to ash, meaning I am now running the ash shell inside the default -sh shell. exit will bring me back out of the ash shell and back into the -sh shell.

To see all the programs busybox can run, simply type busybox or busybox --help and it will spit out a big list of all of the programs compiled into its binary. Or, use busybox --list to see them all on a separate line. Run them as:

busybox program_name args

Anyway, busybox is a popular program for small embedded Linux devices where Linux is a custom build using build tools such as Buildroot or Yocto, the two main ones. And, apparently ash is a lightweight rewrite of bash and is available as a command within part of the main busybox binary.

See also:

  1. https://unix.stackexchange.com/questions/82357/what-do-the-symbols-displayed-by-ls-f-mean/82358#82358
  2. What do the symbols like =, * and | in the output of "ls -F" mean?