hush/docs/busybox.pod
Erik Andersen 62dc17a3b1 Some docs
-Erik
2000-04-13 01:18:23 +00:00

861 lines
18 KiB
Plaintext

=head1 NAME
busybox - I am BusyBox of Borg. Unix will be assimilated.
=head1 SYNOPSIS
busybox <function> [arguments...] # or
<function> [arguments...] # if symlinked
=head1 DESCRIPTION
BusyBox is a multi-call binary that combines many common Unix utilities into a
single executable. Most people will create a link to busybox for each function
they wish to use, and BusyBox will act like whatever it was invoked as. For
example,
ln -s ./busybox ls
./ls
will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled
into busybox). You can also invoke BusyBox by providing it the command to run
on the command line. For example,
./busybox ls
will also cause BusyBox to behave as 'ls'.
BusyBox has been written with size-optimization in mind. It is very easy to
include or exclude the commands (or features) you want installed. BusyBox
tries to make itself useful to small systems with limited resources.
=head1 COMMANDS
Currently defined functions include:
basename, cat, chmod, chown, chgrp, chroot, clear, chvt, cp, mv, date,
dd, df, dirname, dmesg, du, dutmp, echo, fbset, fdflush, find, free,
freeramdisk, deallocvt, fsck.minix, mkfs.minix, grep, gunzip, gzip,
halt, head, hostid, hostname, init, kill, killall, length, ln, loadacm,
loadfont, loadkmap, ls, lsmod, makedevs, math, mkdir, mkfifo, mknod,
mkswap, mnc, more, mount, mt, nslookup, poweroff, ping, printf, ps,
pwd, reboot, rm, rmdir, rmmod, sed, sh, fdisk, sfdisk, sleep, sort,
sync, syslogd, logger, logname, swapon, swapoff, tail, tar, [, test,
tee, touch, tr, true, false, tty, umount, uname, uptime, uniq, update,
usleep, wc, whoami, yes, zcat
=head1 OPTIONS
Common Options:
Most BusyBox commands support the "--help" option to provide a
terse runtime description of their behavior.
=over 4
=item basename
Usage: basename [file ...]
Strips directory and suffix from filenames.
Example:
$ basename /usr/local/bin/foo
foo
$ basename /usr/local/bin/
bin
=item cat
Usage: cat [file ...]
Concatenates files and prints them to the standard output.
Example:
$ cat /proc/uptime
110716.72 17.67
=item chmod
Usage: chmod [-R] MODE[,MODE]... FILE...
Changes file access permissions for the specified file(s) or directory(s).
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
PERISSION for the file(s) or directory(s).
WHO may be chosen from:
u the User who owns the file
g users in the file's Group
o Other users not in the file's group
a All users
OPERATOR may be chosen from:
+ add a permission
- remove a permission
= assign a permission
PERMISSION may be chosen from:
r Read
w Write
x eXecute (or access for directories)
s Set user (or group) ID bit
t sTickey bit (for directories prevents removing files by non-owners)
Alternately, permissions may be set numerically where the first three
numbers are calculated by adding the octal values:
4 Read
2 Write
1 eXecute
An optional fourth digit may also be used to specify
4 Set user ID
2 Set group ID
1 sTickey bit
Options:
-R change files and directories recursively.
Example:
$ 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
=item chown
Usage: chown [OPTION]... OWNER[.[GROUP] FILE...
Changes the owner and/or group of each FILE to OWNER and/or GROUP.
Options:
-R change files and directories recursively
Example:
$ 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
=item chgrp
Usage: chgrp [OPTION]... GROUP FILE...
Change the group membership of each FILE to GROUP.
Options:
-R change files and directories recursively
Example:
$ 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
=item chroot
Usage: chroot NEWROOT [COMMAND...]
Run COMMAND with root directory set to NEWROOT.
Exmaple:
$ ls -l /bin/ls
lrwxrwxrwx 1 root root 12 Apr 13 00:46 /bin/ls -> /bin/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*
=item clear
Clears the screen.
=item chvt
Usage: chvt N
Change foreground virtual terminal to /dev/ttyN
=item cp
Usage: cp [OPTION]... SOURCE DEST
or: cp [OPTION]... SOURCE... DIRECTORY
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
-a same as -dpR
-d preserve links
-p preserve file attributes if possable
-R copy directories recursively
=item date
Usage: date [OPTION]... [+FORMAT]
or: date [OPTION] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.
Options:
-R output RFC-822 compliant date string
-s set time described by STRING
-u print or set Coordinated Universal Time
Example:
$ date
Wed Apr 12 18:52:41 MDT 2000
=item dd
Usage: dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]
Copy a file, converting and formatting according to options
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
Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)
Example:
$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4
4+0 records in
4+0 records out
=item df
Usage: df [filesystem ...]
Prints the filesystem space used and space available.
Exmaple:
$ 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% /
=item dmesg
Usage: dmesg [-c] [-n level] [-s bufsize]
Print or controls the kernel ring buffer.
=item du
Usage: du [OPTION]... [FILE]...
Summarize disk space used for each FILE and/or directory.
Disk space is printed in units of 1k (i.e. 1024 bytes).
Options:
-l count sizes many times if hard linked
-s display only a total for each argument
Example:
$ ./busybox du
16 ./CVS
12 ./kernel-patches/CVS
80 ./kernel-patches
12 ./tests/CVS
36 ./tests
12 ./scripts/CVS
16 ./scripts
12 ./docs/CVS
104 ./docs
2417 .
=item fbset
Usage: fbset [options] [mode]
Show and modify frame buffer device settings
Options:
-h
-fb
-db
-a
-i
-g
-t
-accel
-hsync
-vsync
-laced
-double
=item find
Usage: find [PATH...] [EXPRESSION]
Search for files in a directory hierarchy. The default PATH is
the current directory; default EXPRESSION is '-print'
EXPRESSION may consist of:
-follow
Dereference symbolic links.
-name PATTERN
File name (with leading directories removed) matches PATTERN.
-print
print the full file name followed by a newline to stdout.
Example:
$ find / -name /etc/passwd
/etc/passwd
=item free
Usage: free
Displays the amount of free and used memory in the system.
Example:
$ free
total used free shared buffers
Mem: 257628 248724 8904 59644 93124
Swap: 128516 8404 120112
Total: 386144 257128 129016
=item deallocvt
Usage: deallocvt N
Deallocates unused virtual terminal /dev/ttyN
=item fsck.minix
Usage: fsck.minix [-larvsmf] /dev/name
Performs a consistency check for MINIX filesystems.
OPTIONS:
-l Lists all filenames
-r Perform interactive repairs
-a Perform automatic repairs
-v verbose
-s Outputs super-block information
-m Activates MINIX-like "mode not cleared" warnings
-f Force file system check.
=item mkfs.minix
Usage: mkfs.minix [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]
Make a MINIX filesystem.
OPTIONS:
-c Check the device for bad blocks
-n [14|30] Specify the maximum length of filenames
-i Specify the number of inodes for the filesystem
-l FILENAME Read the bad blocks list from FILENAME
-v Make a Minix version 2 filesystem
=item grep
Usage: grep [OPTIONS]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
OPTIONS:
-h suppress the prefixing filename on output
-i ignore case distinctions
-n print line number with output lines
-q be quiet. Returns 0 if result was found, 1 otherwise
This version of grep matches full regular expresions.
Example:
$ grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
$ grep ^[rR]oo. /etc/passwd
root:x:0:0:root:/root:/bin/bash
=item head
Usage: head [OPTION] [FILE]...
Print first 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the
file name. With no FILE, or when FILE is -, read standard input.
Options:
-n NUM Print first NUM lines instead of first 10
Example:
$ head -n 2 /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
=item hostname
Usage: hostname [OPTION] {hostname | -F file}
Get or set the hostname or DNS domain name. If a hostname is given
(or a file with the -F parameter), the host name will be set.
Options:
-s Short
-i Addresses for the hostname
-d DNS domain name
-F FILE Use the contents of FILE to specify the hostname
Example:
$ hostname
slag
=item kill
Usage: kill [-signal] process-id [process-id ...]
Send a signal (default is SIGTERM) to the specified process(es).
Options:
-l List all signal names and numbers.
Example:
$ ps | grep apache
252 root root S [apache]
263 www-data www-data S [apache]
264 www-data www-data S [apache]
265 www-data www-data S [apache]
266 www-data www-data S [apache]
267 www-data www-data S [apache]
$ kill 252
=item ln
Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY
Create a link named LINK_NAME or DIRECTORY to the specified TARGET
Options:
-s make symbolic links instead of hard links
-f remove existing destination files
=item ls
Usage: ls [-1acdelnpuxACF] [filenames...]
=item lsmod
=item mkdir
Usage: Usage: mkdir [OPTION] DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist
Options:
-m set permission mode (as in chmod), not rwxrwxrwx - umask
-p no error if existing, make parent directories as needed
=item mknod
Usage: mknod NAME TYPE MAJOR MINOR
Make block or character special files.
TYPEs include:
b: Make a block (buffered) device.
c or u: Make a character (un-buffered) device.
p: Make a named pipe. Major and minor are ignored for named pipes.
=item mkswap
Usage: mkswap [-c] [-v0|-v1] device [block-count]
Prepare a disk partition to be used as a swap partition.
Options:
-c Check for read-ability.
-v0 Make version 0 swap [max 128 Megs].
-v1 Make version 1 swap [big!] (default for kernels > 2.1.117).
block-count Number of block to use (default is entire partition).
=item more
Usage: more [file ...]
=item mount
Usage: mount [flags]
mount [flags] device directory [-o options,more-options]
Flags:
-a: Mount all file systems in fstab.
-o option: One of many filesystem options, listed below.
-r: Mount the filesystem read-only.
-t filesystem-type: Specify the filesystem type.
-w: Mount for reading and writing (default).
Options for use with the "-o" flag:
async / sync: Writes are asynchronous / synchronous.
dev / nodev: Allow use of special device files / disallow them.
exec / noexec: Allow use of executable files / disallow them.
loop: Mounts a file via loop device.
suid / nosuid: Allow set-user-id-root programs / disallow them.
remount: Re-mount a currently-mounted filesystem, changing its flags.
ro / rw: Mount for read-only / read-write.
There are EVEN MORE flags that are specific to each filesystem.
You'll have to see the written documentation for those.
=item mv
Usage: mv SOURCE DEST
or: mv SOURCE... DIRECTORY
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
=item ping
=item poweroff
=item ps
Usage: ps
Report process status.
This version of ps accepts no options.
=item pwd
=item reboot
=item rm
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).
Options:
-f remove existing destinations, never prompt
-r or -R remove the contents of directories recursively
=item rmdir
Usage: rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.
=item sed
Usage: sed [-n] -e script [file...]
Allowed sed scripts come in the following form:
'ADDR [!] COMMAND'
where address ADDR can be:
NUMBER Match specified line number
$ Match last line
/REGEXP/ Match specified regexp
(! inverts the meaning of the match)
and COMMAND can be:
s/regexp/replacement/[igp]
which attempt to match regexp against the pattern space
and if successful replaces the matched portion with replacement.
aTEXT
which appends TEXT after the pattern space
Options:
-e add the script to the commands to be executed
-n suppress automatic printing of pattern space
This version of sed matches full regular expresions.
=item sleep
Usage: sleep N
Pause for N seconds.
=item sort
Usage: Usage: sort [OPTION]... [FILE]...
=item sync
Usage: sync
Write all buffered filesystem blocks to disk.
=item syslogd
Usage: syslogd [OPTION]...
Linux system and kernel (provides klogd) logging utility.
Note that this version of syslogd/klogd ignores /etc/syslog.conf.
Options:
-m Change the mark timestamp interval. default=20min. 0=off
-n Do not fork into the background (for when run by init)
-K Do not start up the klogd process (by default syslogd spawns klogd).
-O Specify an alternate log file. default=/var/log/messages
=item swapon
Usage: swapon device
Start swapping virtual memory pages on the given device.
=item swapoff
Usage: swapoff device
Stop swapping virtual memory pages on the given device.
=item tail
Usage: tail [OPTION]... [FILE]...
Print last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE, or when FILE is -, read standard input.
-c=N[kbm] output the last N bytes
-f output appended data as the file grows
-n=N output the last N lines, instead of last 10
-q never output headers giving file names
-v always output headers giving file names
--help display this help and exit
If the first character of N (bytes or lines) is a `+', output begins with
the Nth item from the start of each file, otherwise, print the last N items
in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).
=item tar
=item tee
Usage: tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.
Options:
-a append to the given FILEs, do not overwrite
=item touch
Usage: touch [-c] file [file ...]
Update the last-modified date on the given file[s].
=item true
=item false
=item uname
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
Options:
-a print all information
-m the machine (hardware) type
-n print the machine's network node hostname
-r print the operating system release
-s print the operating system name
-p print the host processor type
-v print the operating system version
=item umount
Usage: Usage: umount [flags] filesystem|directory
Flags:
-a: Unmount all file systems
=item uniq
Usage: Usage: uniq [OPTION]... [INPUT [OUTPUT]]
Discard all but one of successive identical lines from INPUT (or
standard input), writing to OUTPUT (or standard output).
-h display this help and exit
A field is a run of whitespace, then non-whitespace characters.
Fields are skipped before chars.
=item zcat
Usage: gunzip [OPTION]... FILE
Uncompress FILE (or standard input if FILE is '-').
Options:
-c Write output to standard output
-t Test compressed file integrity
=item gunzip
Usage: gunzip [OPTION]... FILE
Uncompress FILE (or standard input if FILE is '-').
Options:
-c Write output to standard output
-t Test compressed file integrity
=item gzip
Usage: gzip [OPTION]... FILE
Compress FILE with maximum compression.
When FILE is -, reads standard input. Implies -c.
Options:
-c Write output to standard output instead of FILE.gz
=back
=head1 SEE ALSO
textutils(1), shellutils(1), etc...
=head1 MAINTAINER
Erik Andersen <erik@lineo.com>
=head1 AUTHORS
The following people have contributed code to BusyBox whether
they know it or not.
Erik Andersen <erik@lineo.com>
=for html <br>
John Beppu <beppu@lineo.com>
=for html <br>
Brian Candler <B.Candler@pobox.com>
=for html <br>
Randolph Chung <tausq@debian.org>
=for html <br>
Dave Cinege <dcinege@psychosis.com>
=for html <br>
Bruce Perens <bruce@perens.com>
=for html <br>
Linus Torvalds <torvalds@transmeta.com>
=for html <br>
Charles P. Wright <cpwright@villagenet.com>
=for html <br>
Enrique Zanardi <ezanardi@ull.es>
=for html <br>
=cut