📄 busybox.sgml
字号:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ ]><book id="BusyBoxDocumentation"> <bookinfo> <title>BusyBox - The Swiss Army Knife of Embedded Linux</title> <legalnotice> <para> This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. </para> <para> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </para> <para> You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </para> <para> For more details see the file COPYING in the source distribution of Linux. </para> </legalnotice> </bookinfo><toc></toc> <chapter id="Introduction"> <title>Introduction</title> <para> BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in fileutils, shellutils, findutils, textutils, grep, gzip, tar, etc. BusyBox provides a fairly complete POSIX environment for any small or embedded system. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. </para> <para> BusyBox has been written with size-optimization and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems. To create a working system, just add a kernel, a shell (such as ash), and an editor (such as elvis-tiny or ae). </para> </chapter> <chapter id="Syntax"> <title>How to use BusyBox</title> <sect1 id="How-to-use-BusyBox"> <title>Syntax</title> <para> <screen> BusyBox <function> [arguments...] # or </screen> </para> <para> <screen> <function> [arguments...] # if symlinked </screen> </para> </sect1> <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 has been invoked. </para> <para> For example, entering </para> <para> <screen> ln -s ./BusyBox ls ./ls </screen> </para> <para> will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled into BusyBox). </para> <para> You can also invoke BusyBox by issuing the command as an argument on the command line. For example, entering </para> <para> <screen> ./BusyBox ls </screen> </para> <para> will also cause BusyBox to behave as 'ls'. </para> </sect1> <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. </para> </sect1> </chapter> <chapter id="Commands"> <title>BusyBox Commands</title> <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, dpkg-deb, 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> <sect1 id="ar"> <title>ar</title> <para> Usage: ar [OPTION] archive [FILENAME]... </para> <para> Extract or list files from an ar archive. </para> <para> Options: </para> <para> <screen> o Preserve original dates p Extract to stdout t List x Extract v Verbosely list files processed </screen> </para> </sect1> <sect1 id="basename"> <title>basename</title> <para> Usage: basename FILE [SUFFIX] </para> <para> Strip directory path and suffixes from FILE. If specified, also removes any trailing SUFFIX. </para> <para> Example: </para> <para> <screen> $ basename /usr/local/bin/foo foo $ basename /usr/local/bin/ bin $ basename /foo/bar.txt .txt bar </screen> </para> </sect1> <sect1 id="cat"> <title>cat</title> <para> Usage: cat [FILE]... </para> <para> Concatenate <literal>FILE(s)</literal> and prints them to the standard output. </para> <para> Example: </para> <para> <screen> $ cat /proc/uptime 110716.72 17.67 </screen> </para> </sect1> <sect1 id="chgrp"> <title>chgrp</title> <para> Usage: chgrp [OPTION]... GROUP FILE... </para> <para> Change the group membership of each FILE to GROUP. </para> <para> Options: </para> <para> <screen> -R Change files and directories recursively </screen> </para> <para> Example: </para> <para> <screen> $ ls -l /tmp/foo -r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo $ chgrp root /tmp/foo $ ls -l /tmp/foo -r--r--r-- 1 andersen root 0 Apr 12 18:25 /tmp/foo </screen> </para> </sect1> <sect1 id="chmod"> <title>chmod</title> <para> Usage: chmod [<emphasis>-R</emphasis>] MODE[,MODE]... FILE... </para> <para> Change file access permissions for the specified <literal>FILE(s)</literal> (or directories). Each MODE is defined by combining the letters for WHO has access to the file, an OPERATOR for selecting how the permissions should be changed, and a PERMISSION for <literal>FILE(s)</literal> (or directories). </para> <para> WHO may be chosen from </para> <para> <screen> u User who owns the file g Users in the file's Group o Other users not in the file's group a All users </screen> </para> <para> OPERATOR may be chosen from </para> <para> <screen> + Add a permission - Remove a permission = Assign a permission </screen> </para> <para> PERMISSION may be chosen from </para> <para> <screen> r Read w Write x Execute (or access for directories) s Set user (or group) ID bit t Sticky bit (for directories prevents removing files by non-owners) </screen> </para> <para> Alternately, permissions can be set numerically where the first three numbers are calculated by adding the octal values, such as </para> <para> <screen> 4 Read 2 Write 1 Execute </screen> </para> <para> An optional fourth digit can also be used to specify </para> <para> <screen> 4 Set user ID 2 Set group ID 1 Sticky bit </screen> </para> <para> Options: </para> <para> <screen> -R Change files and directories recursively. </screen> </para> <para> Example: </para> <para> <screen> $ ls -l /tmp/foo -rw-rw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo $ chmod u+x /tmp/foo $ ls -l /tmp/foo -rwxrw-r-- 1 root root 0 Apr 12 18:25 /tmp/foo* $ chmod 444 /tmp/foo $ ls -l /tmp/foo -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo </screen> </para> </sect1> <sect1 id="chown"> <title>chown</title> <para> Usage: chown [OPTION]... OWNER[<.|:>[GROUP] FILE... </para> <para> Change the owner and/or group of each FILE to OWNER and/or GROUP. </para> <para> Options: </para> <para> <screen> -R Change files and directories recursively </screen> </para> <para> Example: </para> <para> <screen> $ ls -l /tmp/foo -r--r--r-- 1 andersen andersen 0 Apr 12 18:25 /tmp/foo $ chown root /tmp/foo $ ls -l /tmp/foo -r--r--r-- 1 root andersen 0 Apr 12 18:25 /tmp/foo $ chown root.root /tmp/foo ls -l /tmp/foo -r--r--r-- 1 root root 0 Apr 12 18:25 /tmp/foo </screen> </para> </sect1> <sect1 id="chroot"> <title>chroot</title> <para> Usage: chroot NEWROOT [COMMAND...] </para> <para> Run COMMAND with root directory set to NEWROOT. </para> <para> Example: </para> <para> <screen> $ ls -l /bin/ls lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /BusyBox $ mount /dev/hdc1 /mnt -t minix $ chroot /mnt $ ls -l /bin/ls -rwxr-xr-x 1 root root 40816 Feb 5 07:45 /bin/ls* </screen> </para> </sect1> <sect1 id="chvt"> <title>chvt</title> <para> Usage: chvt N </para> <para> Change the foreground virtual terminal to /dev/ttyN </para> </sect1> <sect1 id="clear"> <title>clear</title> <para> Usage: clear </para> <para> Clear the screen. </para> </sect1> <sect1 id="cp"> <title>cp</title> <para> Usage: cp [OPTION]... SOURCE DEST </para> <para> <screen> or: cp [OPTION]... SOURCE... DIRECTORY </screen> </para> <para> Copy SOURCE to DEST, or multiple <literal>SOURCE(s)</literal> to DIRECTORY. </para> <para> Options: </para> <para> <screen> -a Same as -dpR -d Preserve links -p Preserve file attributes if possible -R Copy directories recursively </screen> </para> </sect1> <sect1 id="cut"> <title>cut</title> <para> Usage: cut [OPTION]... [FILE]... </para> <para> Print selected fields from each input FILE to standard output. </para> <para> Options: </para> <para> <screen> -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 Output only the lines containing delimiter -f N Print only these fields -n Ignored </screen> </para> <para> Example: </para> <para> <screen> $ echo "Hello world" | cut -f 1 -d ' ' Hello $ echo "Hello world" | cut -f 2 -d ' ' world </screen> </para> </sect1> <sect1 id="date"> <title>date</title> <para> Usage: date [OPTION]... [+FORMAT] </para> <para> <screen> or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]] </screen> </para> <para> Display the current time in the given FORMAT, or set the system date. </para> <para> Options: </para> <para> <screen> -R Output RFC-822 compliant date string -s Set time described by STRING -u Print or set Coordinated Universal Time </screen> </para> <para> Example: </para> <para> <screen> $ date Wed Apr 12 18:52:41 MDT 2000 </screen> </para> </sect1> <sect1 id="dc"> <title>dc</title> <para> Usage: dc [EXPRESSION] </para> <para> This is a Tiny RPN calculator that understands the following operations: +, -, /, *, and, or, not, eor. If no arguments are given, dc will process input from stdin. </para> <para> The behaviour of BusyBox/dc deviates (just a little ;-) from GNU/dc, but this will be remedied in the future. </para> <para> Example: </para> <para> <screen> $ dc 2 2 + 4 $ dc 8 8 \* 2 2 + / 16 $ dc 0 1 and 0 $ dc 0 1 or 1 $ echo 72 9 div 8 mul | dc 64 </screen> </para> </sect1> <sect1 id="dd"> <title>dd</title> <para> Usage: dd [OPTION]... </para> <para> Copy a file, converting and formatting according to options. </para> <para> Options: </para> <para> <screen> if=FILE Read from FILE instead of stdin of=FILE Write to FILE instead of stdout bs=N Read and write N bytes at a time count=N Copy only N input blocks skip=N Skip N input blocks seek=N Skip N output blocks </screen> </para> <para> Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2). </para> <para> Example: </para> <para> <screen> $ dd if=/dev/zero of=/dev/ram1 bs=1M count=4 4+0 records in 4+0 records out </screen> </para> </sect1> <sect1 id="deallocvt"> <title>deallocvt</title> <para> Usage: deallocvt N </para> <para> Deallocate unused virtual terminal /dev/ttyN. </para> </sect1> <sect1 id="df"> <title>df</title> <para> Usage: df [FILE]... </para> <para> Print the filesystem space used and space available. </para> <para> Example: </para> <para> <screen> $ df Filesystem 1k-blocks Used Available Use% Mounted on /dev/sda3 8690864 8553540 137324 98% / /dev/sda1 64216 36364 27852 57% /boot $ df /dev/sda3 Filesystem 1k-blocks Used Available Use% Mounted on /dev/sda3 8690864 8553540 137324 98% / </screen> </para> </sect1> <sect1 id="dirname"> <title>dirname</title> <para> Usage: dirname NAME </para> <para> Strip non-directory suffix from NAME. </para> <para> Example: </para> <para> <screen> $ dirname /tmp/foo /tmp $ dirname /tmp/foo/ /tmp </screen> </para> </sect1> <sect1 id="dmesg"> <title>dmesg</title> <para> Usage: dmesg [OPTION]... </para> <para> Print or control the kernel ring buffer. </para> <para> Options: </para> <para> <screen> -c Clear the ring buffer after printing -n LEVEL Set the console logging level to LEVEL -s BUFSIZE Query ring buffer using a buffer of BUFSIZE </screen> </para> </sect1> <sect1 id="dos2unix">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -