-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [...]>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ ]>
<book id="BusyBoxDocumentation">
<bookinfo>
<title>BusyBox - The Swiss Army Knife of Embedded Linux</title>
<chapter id="Syntax">
<title>How to use BusyBox</title>
- <sect1 id="How to use BusyBox">
- <title>Syntax</title
+ <sect1 id="How-to-use-BusyBox">
+ <title>Syntax</title>
<para>
<screen>
</para>
</sect1>
- <sect1 id="Invoking BusyBox">
+ <sect1 id="Invoking-BusyBox">
+ <title>Invoking BusyBox</title>
+
<para>
When you create a link to BusyBox for the function you wish to use, when
BusyBox is called using that link it will behave as if the command itself
</sect1>
- <sect1 id="Common options">
+ <sect1 id="Common-options">
+ <title>Common options</title>
+
<para>
Most BusyBox commands support the <emphasis>--help</emphasis> option to provide
a terse runtime description of their behavior.
<chapter id="Commands">
<title>BusyBox Commands</title>
- <sect1 id="Available BusyBox Commands">
+ <sect1 id="Available-BusyBox-Commands">
<title>Available BusyBox Commands</title>
<para>
Currently defined functions include:
</para>
<para>
- ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear, cp, cut, date,
- dc, dd, deallocvt, df, dirname, dmesg, du, dutmp, echo, false, fbset,
- fdflush, find, free, freeramdisk, fsck.minix, grep, gunzip, gzip, halt,
- head, hostid, hostname, id, init, insmod, kill, killall, length, ln,
- loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, mkdir,
- mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
- nslookup, ping, poweroff, printf, ps, pwd, reboot, rm, rmdir, rmmod, sed,
- setkeycodes, sfdisk, sh, sleep, sort, swapoff, swapon, sync, syslogd, tail,
- tar, tee, telnet, test, touch, tr, true, tty, umount, uname, uniq, update,
- uptime, usleep, uudecode, uuencode, wc, which, whoami, yes, zcat, [
+ ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear,
+ cp, cut, date, dc, dd, deallocvt, df, dirname, dmesg, du,
+ dumpkmap, dutmp, echo, false, fbset, fdflush, find, free,
+ freeramdisk, fsck.minix, grep, gunzip, gzip, halt, head,
+ hostid, hostname, id, init, insmod, kill, killall, length, ln,
+ loadacm, loadfont, loadkmap, logger, logname, ls, lsmod,
+ makedevs, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp,
+ more, mount, mt, mv, nc, nslookup, ping, poweroff, printf, ps,
+ pwd, reboot, renice, reset, rm, rmdir, rmmod, sed, setkeycodes, sh, sleep,
+ sort, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet,
+ test, touch, tr, true, tty, umount, uname, uniq, update,
+ uptime, usleep, uudecode, uuencode, wc, which, whoami, yes,
+ zcat, [
</para>
</sect1>
-b LIST Output only bytes from LIST
-c LIST Output only characters from LIST
-d CHAR Use CHAR instead of tab as the field delimiter
- -s Only output Lines if the include DELIM
+ -s Output only the lines containing delimiter
-f N Print only these fields
-n Ignored
</screen>
</para>
</sect1>
+ <sect1 id="dos2unix">
+ <title>dos2unix</title>
+
+ <para>
+ Usage: dos2unix < dosfile > unixfile
+ </para>
+
+ <para>
+ Converts a text file from dos format to unix format.
+ </para>
+
+ </sect1>
+
<sect1 id="du">
<title>du</title>
</para>
</sect1>
+ <sect1 id="dumpkmap">
+ <title>dumpkmap</title>
+
+ <para>
+ Usage: dumpkmap
+ </para>
+
+ <para>
+ Prints out a binary keyboard translation table to standard input.
+ </para>
+
+ <para>
+ Example:
+ </para>
+
+ <para>
+ <screen>
+ $ dumpkmap < keymap
+ </screen>
+ </para>
+ </sect1>
+
<sect1 id="dutmp">
<title>dutmp</title>
</para>
</sect1>
+ <sect1 id="expr">
+ <title>expr</title>
+
+ <para>
+ Usage: expr EXPRESSION
+ </para>
+
+ <para>
+ Prints the value of EXPRESSION to standard output.
+ </para>
+
+ <para>
+ EXPRESSION may be:
+ </para>
+
+ <para>
+ <screen>
+ ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2
+ ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0
+ ARG1 < ARG2 ARG1 is less than ARG2
+ ARG1 <= ARG2 ARG1 is less than or equal to ARG2
+ ARG1 = ARG2 ARG1 is equal to ARG2
+ ARG1 != ARG2 ARG1 is unequal to ARG2
+ ARG1 >= ARG2 ARG1 is greater than or equal to ARG2
+ ARG1 > ARG2 ARG1 is greater than ARG2
+ ARG1 + ARG2 arithmetic sum of ARG1 and ARG2
+ ARG1 - ARG2 arithmetic difference of ARG1 and ARG2
+ ARG1 * ARG2 arithmetic product of ARG1 and ARG2
+ ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2
+ ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2
+ STRING : REGEXP anchored pattern match of REGEXP in STRING
+ match STRING REGEXP same as STRING : REGEXP
+ substr STRING POS LENGTH substring of STRING, POS counted from 1
+ index STRING CHARS index in STRING where any CHARS is found, or 0
+ length STRING length of STRING
+ quote TOKEN interpret TOKEN as a string, even if it is a
+ keyword like `match' or an operator like `/'
+ ( EXPRESSION ) value of EXPRESSION
+ </screen>
+ </para>
+
+ <para>
+ Beware that many operators need to be escaped or quoted for shells.
+ Comparisons are arithmetic if both ARGs are numbers, else
+ lexicographical. Pattern matches return the string matched between
+ \( and \) or null; if \( and \) are not used, they return the number
+ of characters matched or 0.
+ </para>
+
+ </sect1>
+
+
<sect1 id="false">
<title>false</title>
</screen>
</para>
</sect1>
+
+ <sect1 id="getopt">
+ <title>getopt</title>
+
+ <para>
+ Usage: getopt [OPTIONS]...
+ </para>
+
+ <para>
+ Parse command options
+ </para>
+
+ <para>
+ <screen>
+ -a, --alternative Allow long options starting with single -\n"
+ -l, --longoptions=longopts Long options to be recognized\n"
+ -n, --name=progname The name under which errors are reported\n"
+ -o, --options=optstring Short options to be recognized\n"
+ -q, --quiet Disable error reporting by getopt(3)\n"
+ -Q, --quiet-output No normal output\n"
+ -s, --shell=shell Set shell quoting conventions\n"
+ -T, --test Test for getopt(1) version\n"
+ -u, --unqote Do not quote the output\n"
+ </screen>
+ </para>
+
+
+ <para>
+ Example:
+ </para>
+
+ <para>
+ <screen>
+ $ cat getopt.test
+ #!/bin/sh
+ GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \
+ -n 'example.busybox' -- "$@"`
+ if [ $? != 0 ] ; then exit 1 ; fi
+ eval set -- "$GETOPT"
+ while true ; do
+ case $1 in
+ -a|--a-long) echo "Option a" ; shift ;;
+ -b|--b-long) echo "Option b, argument \`$2'" ; shift 2 ;;
+ -c|--c-long)
+ case "$2" in
+ "") echo "Option c, no argument"; shift 2 ;;
+ *) echo "Option c, argument \`$2'" ; shift 2 ;;
+ esac ;;
+ --) shift ; break ;;
+ *) echo "Internal error!" ; exit 1 ;;
+ esac
+ done
+ </screen>
+ </para>
+ </sect1>
<sect1 id="grep">
<title>grep</title>
</para>
</sect1>
-< <sect1 id="gzip">
+ <sect1 id="gzip">
<title>gzip</title>
<para>
<screen>
<id>:<runlevels>:<action>:<process>
</screen>
- <para>
+ </para>
<sect2>
<title>id</title>
</para>
</sect2>
- <para>
- Example /etc/inittab file:
- </para>
+ <sect2>
+ <title>Example /etc/inittab file</title>
<para>
<screen>
# /bin/sh invocations on selected ttys
#
# Start an "askfirst" shell on the console (whatever that may be)
- ::askfirst:/bin/sh
- # Start an "askfirst" shell on /dev/tty2
- tty2::askfirst:/bin/sh
+ ::askfirst:-/bin/sh
+ # Start an "askfirst" shell on /dev/tty2-4
+ tty2::askfirst:-/bin/sh
+ tty2::askfirst:-/bin/sh
+ tty2::askfirst:-/bin/sh
# /sbin/getty invocations for selected ttys
#
- tty4::respawn:/sbin/getty 38400 tty4
- tty5::respawn:/sbin/getty 38400 tty5
+ tty4::respawn:/sbin/getty 38400 tty5
+ tty5::respawn:/sbin/getty 38400 tty6
# Example of how to put a getty on a serial line (for a terminal)
#
#ttyS2::respawn:/sbin/getty -x0 -s 57600 ttyS2
# Stuff to do before rebooting
- ::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1
- ::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1
+ ::ctrlaltdel:/bin/umount -a -r
+ ::ctrlaltdel:/sbin/swapoff
</screen>
</para>
+ </sect2>
</sect1>
<sect1 id="insmod">
-A Do not list implied . and ..
-C List entries by columns
-F Append indicator (one of */=@|) to entries
+ -L list entries pointed to by symbolic links
-R List subdirectories recursively
</screen>
</para>
</para>
</sect1>
+ <sect1 id="rdate">
+ <title>rdate</title>
+
+ <para>
+ Usage: rdate [OPTION] HOST
+ </para>
+
+ <para>
+ Get and possibly set the system date and time from a remote HOST.
+ </para>
+
+ <para>
+ Options:
+ </para>
+
+ <para>
+ <screen>
+ -s Set the system date and time (default).
+ -p Print the date and time.
+ </screen>
+ </para>
+ </sect1>
+
<sect1 id="reboot">
<title>reboot</title>
</para>
</sect1>
+ <sect1 id="renice">
+ <title>renice</title>
+
+ <para>
+ Usage: renice priority pid [pid ...]
+ </para>
+
+ <para>
+ Changes priority of running processes. Allowed priorities range
+ from 20 (the process runs only when nothing else is running) to 0
+ (default priority) to -20 (almost nothing else ever gets to run).
+ </para>
+ </sect1>
+
+ <sect1 id="reset">
+ <title>reset</title>
+
+ <para>
+ Usage: reset
+ </para>
+
+ <para>
+ Resets the screen.
+ </para>
+ </sect1>
+
<sect1 id="rm">
<title>rm</title>
</para>
</sect1>
- <sect1 id="sfdisk">
- <title>sfdisk</title>
-
- <para>
- Usage: sfdisk [OPTION]... DEVICE
- </para>
-
- <para>
- Partition DEVICE.
- </para>
-
- <para>
- Options:
- </para>
-
- <para>
- <screen>
- -s List size of a partition
- -c Print or change partition Id
- -l List partitions of each device
- -d Idem, but in a format suitable for later input
- -i Number cylinders etc. from 1 instead of from 0
- -uS Accept/report in units of sectors
- -uB Accept/report in units of blocks
- -uC Accept/report in units of cylinders
- -uM Accept/report in units of MB
- -T List the known partition types
- -D For DOS-compatibility: waste a little space
- -R Make kernel reread partition table
- -N NUM Change only the partition with number NUM
- -n Do not actually write to disk
- -O FILE Save the sectors that will be overwritten to FILE
- -I FILE Restore these sectors from FILE
- </screen>
- </para>
-
- <para>
- Dangerous options:
- </para>
-
- <para>
- <screen>
- -g Print the kernel's idea of the geometry
- -x Also list extended partitions on output
- or expect descriptors for them on input
- -L Do not complain about things irrelevant for Linux
- -q Suppress warning messages
- </screen>
- </para>
-
- <para>
- You can override the detected geometry using:
- </para>
-
- <para>
- <screen>
- -C NUM Set the number of cylinders to use
- -H NUM Set the number of heads to use
- -S NUM Set the number of sectors to use
- </screen>
- </para>
-
- <para>
- You can disable all consistency checking with:
- </para>
-
- <para>
- <screen>
- -f Do what I say, even if it is stupid
- </screen>
- </para>
- </sect1>
<sect1 id="sh">
<title>sh</title>
-n Run as a foreground process
-K Do not start up the klogd process
-O FILE Use an alternate log file (default=/var/log/messages)
+ -R HOST[:PORT] Log messages to HOST on PORT (default=514) over UDP.
</screen>
</para>
<para>
<screen>
+ $ syslogd -R masterlog:514
+ $ syslogd -R 192.168.1.1:601
</screen>
</para>
</sect1>
<para>
<screen>
- f FILE Use FILE for tarfile (or stdin if '-')
- O Extract to stdout
- --exclude FILE Exclude FILE
- v List files processed
+ f FILE Use FILE for tarfile (or stdin if '-')
+ O Extract to stdout
+ exclude FILE File to exclude
+ v List files processed
</screen>
</para>
</para>
<para>
- <screen>
or: [ EXPRESSION ]
+ </para>
<para>
Check file types and compare values returning an exit
</screen>
</para>
</sect1>
+
+ <sect1 id="unix2dos">
+ <title>unix2dos</title>
+
+ <para>
+ Usage: unix2dos < unixfile > dosfile
+ </para>
+
+ <para>
+ Converts a text file from unix format to dos format.
+ </para>
+
+ </sect1>
+
+ <sect1 id="unrpm">
+ <titleunrpmuniq</title>
+
+ <para>
+ Usage: unrpm < package.rpm | gzip -d | cpio -idmuv
+ </para>
+
+ <para>
+ Extracts an rpm archive.
+ </para>
+
+ </sect1>
<sect1 id="update">
<title>update</title>
</para>
</sect1>
+ <sect1 id="xargs">
+ <title>xargs</title>
+
+ <para>
+ Usage: xargs [OPTIONS] [COMMAND] [ARGS...]
+ </para>
+
+ <para>
+ Executes COMMAND on every item given by standard input.
+ </para>
+
+ <para>
+ Options:
+ </para>
+
+ <para>
+ <screen>
+ -t Print the command just before it is run
+ </screen>
+ </para>
+
+
+ <para>
+ Example:
+ </para>
+
+ <para>
+ <screen>
+ $ ls | xargs gzip
+ $ find . -name '*.c' -print | xargs rm
+ </screen>
+ </para>
+ </sect1>
+
<sect1 id="yes">
<title>yes</title>
Linus Torvalds <torvalds@transmeta.com>
</para>
+ <para>
+ Mark Whitley <markw@lineo.com>
+ </para>
+
<para>
Charles P. Wright <cpwright@villagenet.com>
</para>