BusyBox: A Swiss Army Knife for Linux
Linux is being used in more and more tight places—devices or situations where multiple gigabytes of storage or dozens of megabytes of RAM are simply not available. Many Linux Journal articles have addressed this growing embedded systems space. Here, I will describe a terrific open-source tool for people needing a suite of utilities for use in these tight places.
BusyBox is a single-binary application that includes the capabilities of more than 70 standard Linux utilities. The BusyBox project was started by Bruce Perens when he was leading the Debian project. Many others have contributed code since then; the project is currently maintained by Erik Andersen, who also maintains a web page for it at http://busybox.lineo.com/. (BusyBox is sponsored by embedded Linux vendor Lineo, Inc. See http://www.lineo.com/.)
The corresponding standard utilities that BusyBox replaces occupy about 1.5MB of disk space in a standard Linux system. The BusyBox program uses only 260KB of disk space; it can even be compiled to include only a handful of utilities that you select, still within a single binary. We'll see how to do this later.
Linux distributions normally include packages with many separate utilities, often in sets named textutils, shellutils or something similar. These utilities are generally very full-featured. For example, the command to list files, ls, supports over 50 command-line options. Because these utilities are so full-featured, they are sometimes larger than you might expect. For example, the ls command (dynamically linked) occupies 48KB of disk space. While you wouldn't notice that on a standard PC, many of those 50 options are just wasted space on an embedded system or boot disk. BusyBox combines numerous utilities in a single binary, limiting the features of each utility to those most commonly needed. The ls command in BusyBox has a mere 12 options—more than enough for most of us.
When you enter the name of a utility in a shell (at the Linux command line), the shell locates the binary with that name and executes it. When you install BusyBox, it creates links in your file system so that instead of having a real ls command, you have a symbolic link named “ls” that refers to the BusyBox binary. A directory listing of ls would then appear like this:
lrwxrwxrwx 1 nwells users 12 May 17 14:47 ls ->/bin/busybox
Typing ls at the command prompt causes the shell to launch the BusyBox program, which in turn examines the name under which you invoked it. Seeing that you entered ls in this example, the BusyBox program proceeds to act like ls, interpreting any additional options according to that command.
If this talk about 70 utilities in one is making you curious, here are a few samples of what BusyBox includes. The web site given above has a complete list with documentation:
chmod, chown, chroot, lsmod, rmmod, insmod
dd, df, du, mkfs.minix, fsck.minix, mount, sfdisk
find, grep, sed, gzip, gunzip, tar
kill, killall, ps
cp, cut, mv, rm, ln, more, tr
nslookup, ping, telnet
init, syslogd, sh
Many of these utilities are reduced versions to fit in the 260KB total space mentioned above. For example, the sh shell doesn't support if/then/else statements or while loops, but it has enough built-in commands to handle simple startup shell scripts. Also, commands like init and tar have greatly reduced functionality, but they are sufficient to get the job done for many applications where you don't have space for the full-blown utility.
Adding BusyBox to your system is simple. First, obtain the source code by visiting ftp.lineo.com/pub/busybox and downloading the most recent version of the compressed tar file. As of this writing, the most recent version is the file busybox-0.45.tar.gz, but newer versions will probably be available by the time you read this. Work on BusyBox seems to progress at a steady pace.
After you've downloaded the tar file, place it in a working directory and use this command to untar the file:
tar xvzf busybox-0.45.tar.gz
Change to the newly created busybox directory (I write the name in lowercase this time to match the binary name) and enter the make command:
cd busybox-0.45 makeNow you're ready to test a few BusyBox commands. The busybox binary is located in the main busybox directory after you use the make command. In order to use a particular feature of BusyBox, execute the busybox binary with a command name as a parameter. For example, to use the ls command, from within the busybox-0.45 directory, enter:
./busybox lsOr to use the lsmod command, enter:
./busybox lsmodAdditional command options can be placed after the command name. For example, to use the du command to view only the contents of the /etc directory tree, type this: ./busybox du /etc
Another important feature of BusyBox is that you can see a small on-line help screen for each utility that BusyBox replaces. Just use the --help option with the command. For example, to learn about the ls options that BusyBox supports, enter ./busybox ls --help
This displays the following help text:
BusyBox v0.45 (2000.05.17-20:38+0000) multi-call
binary -- GPL2
Usage: ls [-1acdelnpuxACF] [filenames...]
Options:
-a do not hide entries starting with .
-c with -l: show ctime (the time of last
modification of file status information)
-d list directory entries instead of contents
-e list both full date and full time
-l use a long listing format
-n list numeric UIDs and GIDs instead of names
-p append indicator (one of /=@|) to entries
-u with -l: show access time (the time of last
access of the file)
-x list entries by lines instead of by columns
-A do not list implied . and ..
-C list entries by columns
-F append indicator (one of */=@|) to entries
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




4 hours 45 min ago
15 hours 26 min ago
21 hours 12 min ago
21 hours 29 min ago
23 hours 22 min ago
1 day 1 hour ago
1 day 8 hours ago
1 day 8 hours ago
1 day 10 hours ago
1 day 16 hours ago